· Apr 13, 2016

XMLExport and Validation

I interested on how others feel on this subject.  In general terms when you have a class that extends from %XML.Adaptor and you call XMLExport no validation is automatically done as part of the XMLExport process.  As an example if you do the following


SAMPLES>S tPatient=##Class(Sample.Person).%New()
SAMPLES>Set tPatient.Name="asdfghjklqwrrrrokkfkljbvkfbjflkbjflkbjblkjblkjdblkjblkcn l nn klkjdfkbjdlkbjlkbj"

SAMPLES>w tPatient.XMLExport(,",indent")
  <Name>asdfghjklqwrrrrokkfkljbvkfbjflkbjflkbjblkjblkjdblkjblkcn l nn klkjdfkbjdlkbjlkbj</Name>


where tPatient.Name has a value which is greater than the MAXLEN for %String.  I understand I can declare MAXLEN for the Name property but my point is XMLExport will produce a representation of the Patient object even thought the same representation could not be Correlated via %XML.Reader or Saved.  The similar way of looking at this is suppose in Patient there is

Property Gender As %String(VALUELIST=',M,F');

if a Patient object is created and then the Gender property is set to XYZ when calling XMLExport no validation will be done.


I'm not proposing that XMLExport always force validation but I'm interested in what other feel about this somewhat inconsistency.  From a practical perspective we have run into specific issues with HealthShare Streamlets and Correlation.

Discussion (3)1
Log in or sign up to continue