[xsd-users] Ignoring unknown elements

Vladimir Zykov vladimir.zykov at ncloudtech.ru
Fri Oct 10 06:00:46 EDT 2014


Hi Boris,

In our problem domain we cannot be sure about validity (in XML sense) of input
XML documents. I.e. input document can contain elements/attributes not present in
XML Schema. Order of elements is preserved as per XML Schema though. While it's
easy to ignore unknown attributes (just providing dont_validate flag) ignoring
unknown elements requires changes in XSD code generation. Currently generated code
stops processing of XML nodes in complex type when unknown element is encountered.
We generate code in cxx-tree mode.

I found the following discussion about this problem:
http://www.codesynthesis.com/pipermail/xsd-users/2008-November/002046.html
It was back in 2008. Does the problem still exist? Looking at the XSD command line
arguments I don't seem to see anything that could fix this problem. I understand
your explanation from the email above, however, if I know that my XML Schema files
don't use any kind of type derivation then bailing out on any unknown element might
be too restrictive for me. Is there anything else that hinders ignoring unknown
elements?

Shallow inspection of generated code shows that the problem can be fixed by mere
removal of 'break' statement at the end of a for-loop that processes child elements
in generated parse() function. Certainly this should be managed by command line option.

I think it can be useful for your users. What do you think?

Thanks,

Vladimir Zykov
Software Engineer
New Cloud Technologies, LLC





More information about the xsd-users mailing list