Liquid XML Data Binder 2019
Unexpected Elements
Liquid XML Objects (C#, Visual Basic .Net) > Using the Generated Code > Unexpected Elements

If an unknown element or attribute is encountered while De-serializing an XML document, the action taken depends on code the generation settings 'Handle unknown nodes'.

When 'Handle unknown nodes' is true

Classes are generated with the following additional properties

List<XElement> UnprocessedElements { get; }
List<XAttribute> UnprocessedAttributes { get; }

Unexpected elements and attributes will be placed into these collections, and the error handler will be invoked (with a warning). If the resulting object is Serialized as XML the values in the UnprocessedElements and UnprocessedAttributes collections will be written out (UnprocessedElements will output after all known elements, so there order may not be preserved).

When 'Handle unknown nodes' is false

Any unexpected elements and attributes cause the error handler will be invoked (with an error), if the error handler does not throw then processing will continue. 

Attributes

If the property LxReaderSettings.IgnoreSchemaLocationAttributes is true then the attributes xsi:noNamespaceSchemaLocation and xsi:schemaLocation will be ignored they will not be added to the UnprocessedAttributes collection (if generated) and will not cause the error handler to report a warning/error. If LxReaderSettings.IgnoreSchemaLocationAttributes is false then xsi:noNamespaceSchemaLocation and xsi:schemaLocation will be added to the UnprocessedAttributes collection if generated, otherwise they will be handled as any other unknown attribute (see LxReaderSettings.AllowableExternalNamespaces).

If LxReaderSettings.IgnoreXmlnsAttributes is true then xmlns attributes will be ignored and will not be added to the UnprocessedAttributes collection and will not cause the error handler to report a warning/error. If LxReaderSettings.IgnoreSchemaLocationAttributes is false then xmlns attributes will be added to the UnprocessedAttributes collection if generated, otherwise they will be handled as any other unknown attribute (see LxReaderSettings.AllowableExternalNamespaces).

The property LxReaderSettings.AllowableExternalNamespaces contains a collection namespaces. An attribute who's namespace is listed will be ignored if it was not handled (or placed into the UnprocessedAttributes collection). An attribute who's namespace is not listed will cause an error to be raised if it was not handled (or placed into the UnprocessedAttributes collection).

By default it contains the namespaces  

See Also

XmlSchemaHandling