Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
帮助我编写用于生成 xml 文件的代码,该文件JTree是通过 java 代码动态创建的。如何从中生成 XML 文件?请解释。
JTree
由于 TreeNode 可以序列化,因此您可以使用 xstream 来执行此操作。
见http://www.java-forums.org/xml/25994-how-can-i-create-xml-file-jtree-need-ur-valueable-suggestions.html
IE:
System.out.println( new XStream().toXml(jtree) );