Search code examples
javaxmlparsingstax

Custom StAX Parser for XML using javax wrappers


Custom StAX Parser for XML using javax wrappers

How do you do this; or at least good suggestions on the right documentation / examples / tutorials?

I've been using the javax.xml.stream package to process XML files but the application is begging for some "non-standard XML" (easy to understand what the means if you're not picky). I can write the parser, but I want this to be configurable: so that the app continues to use the same XML processing code except for changing the parser as needed.

The hard part at this point is finding concrete info on how this is done. Documentation speaks of, for example, configuring the parameters of SAXParserFactory and such, but I haven't found specific documentation or examples. I've even looked into some existing StAX source code. Need some good hints / guidance on how this is done in order to move forward.


Solution

  • According to the documentation, you can't. You can use one of three approved parsers. Anything else will result in an error.