Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation error due to white-space being handled as CData by BaseStreamWriter #47

Closed
hxc9 opened this issue Apr 25, 2018 · 2 comments
Closed
Milestone

Comments

@hxc9
Copy link
Contributor

hxc9 commented Apr 25, 2018

Hello,

I've found a bug in the way white-space is handled by the BaseStreamWriter when using validation with release 5.1.0

The exception we get is the following:
Exception in thread "main" com.ctc.wstx.exc.WstxValidationException: Element <Document> has non-mixed content specification; can not contain non-white space text, or any CDATA sections at [row,col {unknown-source}]: [1,49] at com.ctc.wstx.exc.WstxValidationException.create(WstxValidationException.java:50) at com.ctc.wstx.sw.BaseStreamWriter.reportProblem(BaseStreamWriter.java:1248) at com.ctc.wstx.sw.BaseStreamWriter.reportValidationProblem(BaseStreamWriter.java:1739) at com.ctc.wstx.sw.BaseStreamWriter.reportInvalidContent(BaseStreamWriter.java:1691) at com.ctc.wstx.sw.BaseStreamWriter.verifyWriteCData(BaseStreamWriter.java:1516) at com.ctc.wstx.sw.BaseStreamWriter.writeCData(BaseStreamWriter.java:331) at com.ctc.wstx.sw.BaseStreamWriter.copyEventFromReader(BaseStreamWriter.java:806) at Converter.main(Converter.java:34)

This happens because white-space events copied to the BaseStreamWriter, at BaseStreamWriter:806, are handled by writeCData() and therefore treated as a CDATA block for validation purposes.

@hxc9
Copy link
Contributor Author

hxc9 commented Apr 25, 2018

I've provided a minimal fix in #48

hxc9 added a commit to hxc9/woodstox that referenced this issue May 4, 2018
cowtowncoder added a commit that referenced this issue Aug 21, 2018
Fix #47 write white-space events as character events
@cowtowncoder cowtowncoder changed the title Validation error due to white-space being handled as CData by BaseStreamWriter Validation error due to white-space being handled as CData by BaseStreamWriter Aug 21, 2018
@cowtowncoder
Copy link
Member

Excellent, thank you for reporting this, providing fix! Will be in next release (5.1.1 or 5.2.0, depending on if bump in minor version needed for other fixes)

@cowtowncoder cowtowncoder added this to the 5.1.1 milestone Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants