Re: Code that edits XML documents
Paul Libbrecht <[email protected]>
| Newsgroups | gmane.text.xml.general |
|---|---|
| Message-ID | <[email protected]> |
All "DOM-like" libraries would do, or ? dom4j, jdom (two very good libraries for in-memory representation of the XML-tree, both support XPath, JDOM exposes children with java-collections) and DOM (which is a standard implemented by Xerces). Presumably other such libraries as well as stax or xpp can do it. They all have support for lexical-handling but that's sadly, not enough to have everything, for example, entities within attribute-values or DTD-implied attributes. Generally this means that the re-output is considerably less readable, at least that's my experience. I'd love to be contradicted! paul Le 15 juin 05, à 13:16, Martin Olsson a écrit : > Hi, > > I need to implement a program that modifies an XML file, this file will > frequently also be edited by hand in a plain text editor. Of course, > it's > important that the program does not remove or undo any of the > hand-edited > changes (xml data, comments or whitespace). I have previously used > Xerces > for reading XML. > > What library can you recommend for editing/writing XML data? Can > Xerces or > some addon do this? Is there anything in the JDK that I missed? Is > there > another Apache project for this? > > I'm looking for something that is simple, open source and java. > Ideally I > would like something that works like this: > > void updateXmlTagContent(Sometype document, > String xpathSayingWhichTagToUpdate, > String newTagContent); > > Have anyone seen a library or tool that does this or something > similar? It > doesnt have to be based on xpath, any solution that gets the XML > document > updated will do. > > > rgrds, > martin > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >