Java XML-replace using org.xml.sax.XMLReader
In this answer there's an recommendation "Use a SAX (or StAX) parser and writer at the same time.". As I understand it, it should combine e.g., a org.xml.sax.XMLReader
with some XML-writer, my problem is that there seem to be many of them and none fits exactly to the XMLReader
. Ideally, I'm looking for somet开发者_如何学编程hing capable of both
- accepting the arguments as they come from
startElement
andendElement
- writing an arbitrary XML-containing string
The name of the factory class for the writer is probably sufficient for me.
Not knowing exactly what you want to do, but have a look at David Megginsons XMLWriter: http://www.megginson.com/downloads/xml-writer-0.2.zip
It is an XMLReader and you can easily extend it to accomplish what the other answer implies: i.e use your extended XMLWriter as an XMLreader in a filetered set up.
精彩评论