Liquid XML Data Binder 2019
Controlling Validation
Liquid XML Data Binder (C++, Java, VB6) > Using the Code > Controlling Validation

Controlling Validation


Sometimes you may want read or write XML that is not completely valid against the XSD schema. There are a number of rational's behind this, you may want to save a half completed document, then re-load it, or a 3rd party may supply you data that is not quite valid. Whatever your reason, this section describes the control you have over the validation when reading and writing XML.

See links below for full API descriptions.

Reading XML

The following examples show how to ignore Unknown Attributes and Elements when reading in XML from a file. This may be useful if a customer send XML that is not valid against the schema, but you still want the ability to process the document.

Note: When the document is written out (ToXml...), the unknown Attributes and Elements will be omit as these are not stored within the data binding objects.


PriceEnquirySampleLib::CQuoteRequestPtr spElm = PriceEnquirySampleLib::CQuoteRequest::CreateInstance();

LtXmlLib17::CSerializationContext& ctx = LtXmlLib17::CSerializationContext::GetDefaultContext();


elm->FromXmlFile(lpctFilename, ctx);

PriceEnquirySampleLib.QuoteRequest elm = new PriceEnquirySampleLib.QuoteRequest();

LiquidTechnologies.Runtime.Net40.SerializationContext ctx = LiquidTechnologies.Runtime.Net40.SerializationContext.Default;

ctx.IgnoreUnknownAttributes = true;
ctx.IgnoreUnknownElements = true;

elm.FromXmlFile(filename, ctx);


PriceEnquirySampleLib.QuoteRequest elm = new PriceEnquirySampleLib.QuoteRequest();
SerializationContext ctx = SerializationContext.Default;


elm.fromXmlFile(filename, ctx);

  Visual Basic

Dim oElm As PriceEnquiryLib.QuoteRequest
Dim ctx As LtXmlComLib17.XmlSerializationContext

Set oElm = New PriceEnquiryLib.QuoteRequest
Set ctx = LtXmlComLib17.DefaultXmlSerializationContext

ctx.IgnoreUnknownAttributes = True
ctx.IgnoreUnknownElements = True

oElm.FromXmlFile filename, ctx



Description Value
Article Created 28/6/2006
Versions Liquid XML 2005 (5.0.0) and greater
Also See C++ API, C# API, Java API, VB6 API, Controlling the exported XML