Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: New serializer option  (Read 6099 times)
Michael L.
Posts: 23


« on: February 21, 2020, 08:59:15 pm »

Hello,

We have been using the 4js Xml.Serializer class more and more recently and what I have been running into are XSD files that do not explicitly specify minOccurs="0" for every element that it should apply to, even though the XML generated may or may not contain the given element.  They do often have a nillable="true" defined for the element, so the author may be thinking that this takes care of both NULL and missing elements, but it doesn't as far as Xml.Serializer class goes.  What I end up having to do is edit the XSD file I was provided and add the minOccurs="0" to almost every element, just so that I can load the XML data ... once loaded, I can do my own validation and so on...

What I would like to request is an additional option flag to the Xml.Serializer class, similar to xml_ignoreunknownelements, where the Serializer will always assume minOccurs="0" for every element, therefore ignoring the element if it is missing.  Perhaps called xml_ignoremissingelements  (TRUE=every element is assumed to have minOccurs="0" defined, FALSE= minOccurs="0" only for elements where it is explicitly defined, default=FALSE)?

I thought I would run this by everyone in the forum to see if this would be considered a valid request?  Any thoughts?

Thanks.

-Michael Laporte
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines