简体   繁体   中英

Command Line Input to modify and XML

I am planning to make a java application which takes input from command line to create a xml file then one can update the xml file with putting/editing records, read the xml file and delete a entry in the xml file. Does it makes sense to let the xml be modified from the command prompt and what would be the xml related tools to be used with my java application to make it happen

If you want to modify XML from your application you'll probably need to work with DOM or DOM like interface. So you might consider using Jdom, which is much nicer API as long as you don't need to work with mixed-content XML. In the latter case you have to deal with DOM interface for Java directly.

You might also try not to work with XML only with Java objects and then serialize/deserialize them to XML using for instance XStream.

Java, as an object oriented language, is not best suited to work with tree-like structure like XML. Functional language would be better, so consider using Scala (can be used together with Java code), which has nice facility to work with XML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM