[Xml-compile] Clarification XML::Schema::Compile validation option for writers

Mark Overmeer mark at overmeer.net
Thu Oct 18 20:37:21 GMT 2012


* Richard Head Jr. (hsomob1999 at yahoo.com) [121018 20:03]:
> Is validation => 0 meant to only turn off checking XSD restrictions,
> and not XSD structural validation via use, minOccurences, etc..?
> Currently a setting of 0 will still check structural constraints.

This should tell it all...  No structural relaxation, because in general
that could make parsing impossible and certainly slower, not faster.

XML::Compile::Schema::compile(validate) is documented as:

  XML message must be validated, to lower the chance on abuse.  However,
  of course, it costs performance which is only partially compensated by
  fewer checks in your code.  This flag overrules the C<check_values>,
  C<check_occurs>, and C<ignore_facets>.

check_values <true>
  Whether code will be produce to check that the XML fields contain
  the expected data format.

  Turning this off will improve the processing speed significantly, but is
  (of course) much less safe.  Do not set it off when you expect data from
  external sources: validation is a crucial requirement for XML.

check_occurs <true>

  Whether code will be produced to do bounds checking on elements and
  blocks which may appear more than once. When the schema says that
  maxOccurs is 1, then that element becomes optional.  When the schema
  says that maxOccurs is larger than 1, then the output is still always
  an ARRAY, but now of unrestricted length.

ignore_facets <false>
  Facets influence the formatting and range of values. This does not
  come cheap, so can be turned off.  It affects the restrictions set for
  a simpleType.  The processing speed will improve, but validation is
  a crucial requirement for XML: please do not turn this off when the
  data comes from external sources.

I have been thinking about an "treat_sequence_as_all", because some
applications are sloppy with their element order.  For instance,
GoogleEarth's KML messages rarely validate against the spec.  Haven't
done that yet.

What do you need?
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list