-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
WstxValidationException: Unknown reason (at end element </nl:nillableIntElement>) when validating a document with nillable elements #179
Comments
…(at end element </nl:nillableIntElement>) when validating a document with nillable elements
…lement </nl:nillableIntElement>) when validating a document with nillable elements (#180)
Failing test merged; interesting that validation works for And apparently only for writer-side. I wonder if typed write methods are missing some callbacks... Oh wait. No, can't be since this is just read/write'ing content, not using typed API. |
Hmmh. Not super easy to figure out. But the difference wrt
where |
Ok, can't quite figure it out, but I assume sequence of validation calls in this case is incorrect for writer side; some call missing (or extra call). At least there is reproduction if I have time to go back digging or (ideally) someone else has itch and does spelunking into code :) |
Thanks for having a look @cowtowncoder!
Something like that would also be my hypothesis: The code perhaps first checks whether the content is an |
All actual validation state handling is done by MSV; Woodstox side just calls various methods to "feed" content. As per my other note one observable difference is that |
I think I figured out, what is the problem. I traced the method calls using AspectJ for both the reader and writer validation - here is the code: https://github.com/ppalaga/woodstox/commits/i179-trace/ To produce the traces you need to do the following:
I am attaching the traces: In those the following parts are interesting: In the reader scenario, reading the
but it is a bit different in the writer scenario:
I was wondering why woodstox/src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java Lines 1280 to 1304 in 8029523
It always returns null, because it is not implemented. |
@cowtowncoder, could you please suggest some way forward? |
Great detective work @ppalaga ! I wish I remembered the context here, but from what you include I think it is what it say: on writer-side, attribute info (wrt currently written element) is not accessible. Likely because it is not being retained. |
Thanks, sounds good. The main questions from my side are: (1) is it worth implementing (2) any chance that somebody from the project does that? |
@ppalaga Right now I can't promise to work on this, but I always try to make time to help with PRs if someone else does. If that helps at all? Fixing this would definitely be useful, for writer-side validation. |
Thanks for the statement, @cowtowncoder. Could you please give some hints about the design of writer validation? Especially, the following topics would be interesting:
|
I see there is TypedStreamWriter, but where under its subclasses Simple/Repairing should the new Validating writer be hanged? |
No, should not need new sub-classes as typed writes and pluggable validation already exist on writer side. Validating reader tests are in packages ending with
but there are also Validating Write tests in:
|
One confusing aspect of naming is that there are, I think, 2 hierarchies of
Validation seems to be mostly (but maybe not completely) handled by StreamWriter implementations; actual validation is So: I do not think new classes are needed; most other validation functionality exists. But I do not remember what my thinking was with missing state keeping for attributes -- or, possibly just wiring access to state that might be kept. |
</nl:nillableIntElement>) when validating a document with nillable elements fix FasterXML#179
</nl:nillableIntElement>) when validating a document with nillable elements fix FasterXML#179 fix FasterXML#190
This issue occurs when CXF is validating an incoming SOAP message against W3CSchema and the message contains a an
xs:dateTime
orxs:int
elements havingxsi:nil="true"
:CXF calls
validateAgainst(schema)
on a writer which gets the events copied from the reader.A plain Woodstox reproducer is available in PR #180 .
It also makes sure that the failing XML documents are accepted by
javax.xml.validation
.The text was updated successfully, but these errors were encountered: