开发者

how can i easily format this .xml into every node being under one tag?

    <Variables Name="" Date="2011/06/06 13:09:38">
    <yo>http://www.teamliquid.net/video/streams/Competo</yo>
    <name>Competo</name>
    <word>434</word>
</Variables>
<Variables Name="" Date="2011/06/06 13:09:39">
    <yo>http://www.teamliquid.net/video/streams/Rmdx</yo>
    <name>Rmdx</name>
    <word>66</word>
</Variables>

i开发者_StackOverflow wish to get all nodes under one tag.. not sure how i would go about it.


Well the easiest way is to edit the xml file. Add a <root> at the beginning of the file and </root> at the end.

A more general method has been described by Marrow at http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/df9b1f1091aeabf0/e7f384763756affb?q=XML+staticinc+appending&pli=1

The idea here is that we have another file that contains the root and includes the real file. If the real file is named variables.xml then then the root file would contain:

<?xml version="1.0"?> 
<!DOCTYPE staticinc [ 
   <!ENTITY variables SYSTEM "variables.xml"> 
]> 
<root> 
<!-- include the non-well formed XML --> 
  &variables; 
</root> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜