以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  insertBefore的用法  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=63953)


--  作者:crazythinker
--  发布时间:6/21/2008 11:15:00 PM

--  insertBefore的用法
<ns1:activities>
<ns1:activity-structure structure-type="selection" identifier="章节在线">
<ns1:learning-activity-ref ref="第1章"/>
<ns1:learning-activity-ref ref="第2章"/>
</ns1:activity-structure>
<ns1:learning-activity identifier="第1章">
<ns1:title>第1章 </ns1:title>
<ns1:activity-description>
<ns1:item/>
</ns1:activity-description>
</ns1:learning-activity>
<ns1:learning-activity identifier="第2章">
<ns1:title>第2章 </ns1:title>
<ns1:activity-description>
<ns1:item/>
</ns1:activity-description>
</ns1:learning-activity>


部分代码:
String cs=" <!--";
String cf="-->";
String filePath = PathSource+File.separator+"imsmanifest.xml";
FileWriter writer = null;
BufferedReader buff = new BufferedReader(new FileReader(filePath));
writer = new FileWriter(ManifestSource, true);
writer.write(cs);
writer.write(cf);


现在写入的内容总是在最后一行,怎么把内容写进对应的节点里去?
最好个给个例子````3Q`~~


问题补充:好象可以用insertBefore(cs,"<ns1:learning-activity-ref ref="第2章"/>");
但是怎么用啊?


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
62.500ms