XML to BDL serialization options

By default, Genero Web Services XML to BDL serialization will raise errors, if the XML content does not match the BDL variable receiving the data.

To relax the serialization, you can specify the options xml_ignoreunknownelements and xml_ignoreunknownattributes to the xml.Serializer class.

For example, if the BDL variable is defined as follows:
DEFINE data RECORD ATTRIBUTES(XMLName="Demo"),
     val1 INTEGER ATTRIBUTES(XMLName= "Value1"),
     val2 STRING ATTRIBUTES(XMLName= "Value2")
     attr INTEGER ATTRIBUTES(XMLAttribute,XMLName= "MyAttr")
END RECORD
The following XML document will by default raise conversion errors because the "badAttr" attribute and the "Unexpected" node are not defined in the corresponding BDL variable:
<Demo MyAttr="hello" badAttr= "BAD">
  <Value1>128</Value1>
  <Unexpected1>Will be ignored</Unexpected1>
  <Value2>Hello</Value2>
</Demo>
To avoid the conversion error, set the following options:
CALL xml.Serializer.setOption( "xml_ignoreunknownattributes", TRUE )
CALL xml.Serializer.setOption( "xml_ignoreunknownelements", TRUE )
...
CALL xml.Serializer.DomToVariable( doc, data )
Note: The options to relax the serialization cannot apply in complex cases, and the conversion error may still occur.

For more details, see xml.Serializer.SetOption.