1

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.

1
  • I've already written my own parser now, but am still interested in improving my knowledge on the use of alternative parsers. As far as I can tell from the documentation, you can name a limited number of pre-approved parsers. If you try to substitute your own home-grown parser, or anything not on the approved list, it will throw an error. Commented Oct 21, 2014 at 12:13

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.