Ensemble XML Virtual Document Development Guide
XML-Enabled Objects Compared to XML Virtual Documents
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

When developing a production with XML messages, you can use either of the following structures to contain the XML document:

If you need to access a small number of the elements in the input XML document, you can use XML Virtual Documents, but if you need to access most of the elements in the input XML document, you should choose XML-enabled objects because they are more efficient, especially when an object with many elements is processed by a transformation. The following business services and operations are provided to handle XML-enabled objects:
The XML-enabled object business services read a file containing an XML document and convert it to one or more objects. You specify a property that defines the XML element to convert to objects. If the XML root document contains a single element, then the service converts it to one object, but if the XML root document contains a series of these elements, then the service converts them to separate objects.
To use the XML-enabled object services, you do the following:
  1. Define a class that matches the structure of the input XML documents that you are processing. The class can either match the entire XML document or a repeating element within the root XML document. You can use the XML Schema Wizard to define this class. You can optionally define a NAMESPACE parameter for this class. This parameter specifies the XML namespace.
  2. Specify the classname in the business service Class Name field.
  3. Optionally, specify the element name in the Element Name field. If you specify this field, the service looks for one or more XML elements with this name within the root XML object. Each occurrence of this element is converted to an instance of the specified class. If you do not specify this field, the service matches the root document to the specified class.
  4. Optionally, specify the Format parameter and optionally select Ignore Null. The Format parameter can have a value of "literal", "encoded", or "encoded12". These parameters specify the corresponding parameters for the %XML.Adaptor class.
The XML-enabled object business operations convert an object to an XML document and write the document to a file. In addition to specifying information about the XML class and element, you can specify properties that are used when the operation invokes the %XML.Writer class.
Specify the following properties in the operations: