1
我想将XML文件作为节点树读入内存,在该节点上我可以执行其他操作。类似于C#的XDocument
。什么是C#的XDocument.Load
的Java等价物?将XML加载到内存中
我想将XML文件作为节点树读入内存,在该节点上我可以执行其他操作。类似于C#的XDocument
。什么是C#的XDocument.Load
的Java等价物?将XML加载到内存中
您在寻找属于JAXP的Java XML DOM类。它比C#中的丑得多。
DocumentBuilderFactory
创建...DocumentBuilder
...Document
这是你真的后在做什么。这是一个很好的参考:JAXP Tutorial, Chapter 3: The Document Object Model。
你在问'XDocument'或'XmlDocument'吗? 'XDocument'是LINQ to XML的一部分,因此您可能不会找到任何Java等价物,因为LINQ仅存在于.NET中。 – 2011-06-05 04:48:06
请参阅http://stackoverflow.com/questions/6159047/modern-alternative-to-用于某些Java XML库的java-xstream-library。有些东西可能适合你比普通DOM更好的工作方式。此外,Simple(http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#deserialize)似乎很容易使用。 – extraneon 2011-06-05 08:44:51