Property WstxInputProperties.P_VALIDATE_TEXT_CHARS unrecognized
See original GitHub issueTrying to use the lib (v5.0.3) because it was intend to have a feature to ignore invalid characters in xml text, but in fact it is not there:
The code:
XMLInputFactory2 f = (XMLInputFactory2)XMLInputFactory2.newInstance(); f.setProperty(WstxInputProperties.P_VALIDATE_TEXT_CHARS, Boolean.FALSE);
Produces the following error:
java.lang.IllegalArgumentException: Unrecognized property ‘com.ctc.wstx.validateTextChars’
at com.ctc.wstx.api.CommonConfig.reportUnknownProperty(CommonConfig.java:168)
at com.ctc.wstx.api.CommonConfig.setProperty(CommonConfig.java:159)
at com.ctc.wstx.api.ReaderConfig.setProperty(ReaderConfig.java:35)
at com.ctc.wstx.sr.BasicStreamReader.setProperty(BasicStreamReader.java:1306)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
java - xml validation with StAX: Unrecognized property 'javax ...
We found two solutions to this problem. One option is to thinly wrap the XmlStreamReader in a new class which will ignore the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hmmh. That is certainly unexpected… and does not appear to be tested or used. I will need to investigate what is the background story here.
Thank you for reporting this.
I created a workaround at https://github.com/ltuch/staxtest which demonstrates a method that I use to ignore the invalid XML characters - this uses a FilterInputStream to strip out the bad characters.
Edit: after a bit of thinking I think this workaround has limitations in that it won’t work with UTF-16 and possibly other encodings.
Edit 2: I updated the workaround to use a filtered InputStreamReader. Don’t think this is the most elegant solution, so would be interested in finding a better solution than my hacks 😃.