Integration Server 10.5 | Built-In Services Reference Guide | XMLData Folder | Summary of Elements in this Folder | pub.xmldata.domNodeToXMLData
 
pub.xmldata.domNodeToXMLData
WmPublic. Converts a DOM node and its child nodes to a document in the XMLData format and optionally validates each node.
This service converts each element and attribute in the DOM node to the XMLData format. Note that XMLData is an IData document arranged in a particular format that is described by an XML document type.
A DOM node tree is a special representation of an XML document that can be consumed by any program that uses standard DOM APIs. For example, the pub.xml:xmlStringtoXMLNode and pub.xmlStringToEnhancedXMLNode services produce a DOM tree. A DOM node tree contains parsed XML content.
Input Parameters
node
org.w3c.dom.Node DOM node that is to be converted to an XMLData (Document). Note that com.wm.lang.xml.Node is a DOM node.
conformsTo
String Optional. Fully-qualified name of the XML document type on Integration Server against which to validate the DOM node. Specify a value for conformsTo only if you want to do the following:
*Validate the DOM node as part of converting it to XMLData. Integration Server validates a DOM node in the tree as part of converting the tree node to and XMLData-formatted Document.
*Use the XML document type to direct the conversion of the DOM node. That is, the structure of the XML document type determines the structure of the resulting XMLData.
Note:
You must specify an XML document type for conformsTo if you intend to modify the generated XMLData using the mapping tools available in the pipeline.
Note:
One or more XML document types are created from a single XML schema definition. To create an XMLData-formatted Document using the XML document types created from an XML Schema definition, you need specify only one of the XML document types or XML fields created from the schema. Integration Server locates the related XML document types, using the complete collection of XML document types and XML fields created from the schema during conversion and validation.
If you do not specify an XML document type for conformsTo, Integration Server does not validate the input nodes as part of the conversion. Additionally, the service formats the resulting XMLData in a generic way instead of in a manner that matches an XML document type.
maxErrors
String Optional. Number of errors to be collected. Default value is 1. When the number of errors found is equal to maxErrors, the validation processor stops validation and returns the result. If maxErrors is set to -1, the validation processor returns all errors.
The service uses the maxErrors input parameter only when a conformsTo value is specified.
ignoreContent
String Optional. Flag that specifies whether the validation processor will validate simple content where simple content is content keys of the type String, String List, or String Table.
Set to:
*true to ignore content (that is, do not validate the content of keys of the type String, String List, or String Table). Integration Server validates the structure and key names of the XML document only.
*false to validate content. This is the default.
The service uses the ignoreContent input parameter only when a conformsTo value is specified.
failIfInvalid
String Optional. Flag that indicates whether the service should fail and throw an exception if the object is invalid. Set to:
*true to indicate that the service should fail if the object is invalid.
*false to indicate that service should signal success and return errors to the pipeline if object is invalid. This is the default.
The service uses the ignoreContent input parameter only when a conformsTo value is specified.
Output Parameters
isValid
String Conditional. Flag that indicates whether or not validation of the DOM node was successful. A value of:
*true indicates that the validation was successful.
*false indicates that the validation was unsuccessful.
The service returns the isValid parameter only if conformsTo specifies an XML document type.
errors
Document List Conditional. Errors encountered during validation. Each document will contain the following information:
Key
Description
pathName
String Location of the error in XQL.
errorCode
String Error code (for example, VV-001).
errorMessage
String Error message (for example, Missing Object).
The service returns the errors parameter only if conformsTo specifies an XML document type.
xmlDataDocument
Document An XMLData-formatted document that represents the elements and attributes in the DOM node.
Usage Notes
If the conformsTo input parameter specifies an XML document type or an XML field, the pub.xmldata:domNodetoXMLData service does the following:
*Uses the XML document type (and any other XML document types and XML fields created from the same XML schema definition) to direct the structure of the XMLData.
*Validates each DOM node in the tree before converting it to XMLData.
You can use the pub.schema:validate service to validate XMLData.
By default, when validating XML, Integration Server uses the Perl5 regular expression compiler. As a result, Integration Server uses Perl5 pattern matching to evaluate element content. The Perl5 pattern matching is not identical to the pattern matching defined by the World Wide Web Consortium (W3C) for the XML Schema standard. When validating XML against an IS schema or IS document type created from an XML Schema definition, an element defined to be of simple type with a pattern constraining facet might be invalid according to the Perl5 pattern matching rules but valid according to the pattern matching rules associated with the XML Schema standard.
You can change how Integration Server performs pattern matching during validation by switching from the Perl5 regular expression compiler to the Java regular expression compiler. To do this, set the server configuration parameter watt.core.datatype.usejavaregex to true. When his parameter is set to true, Integration Server performs pattern matching as described by java.util.regex.pattern.
When validating XML, Integration Server uses the W3C recommendation XML Schema Part 2: Datatypes. If you want to validate XML for illegal values, set ignoreContent to false and the watt.core.validation.w3cConformant configuration parameter to true. For information about setting this configuration parameter, see webMethods Integration Server Administrator’s Guide.