Integration Server 10.3 | Built-In Services Reference Guide | XML Folder | Summary of Elements in this Folder | pub.xml:getXMLNodeIterator
 
pub.xml:getXMLNodeIterator
WmPublic. Creates and returns a NodeIterator.
A NodeIterator iterates over the element node descendants of an XML node and returns the element nodes that satisfy the given criteria. The client application or flow service uses the service pub.xml:getNextXMLNode to get each node in turn. NodeIterators can only be created for XML nodes (not for HTML nodes).
getXMLNodeIterator is useful for loading and parsing documents on demand. Large or slow documents need only be loaded as far as needed to get the desired data. NodeIterators are also useful for providing service as the pertinent information in the document arrives rather than first waiting for the entire document to load. This service is primarily intended to deal with large documents or documents that arrive slowly.
NodeIterator provides a moving-window mode, in which the only node that is resident in memory is the last node returned by pub.xml:getNextXMLNode. In this mode, when pub.xml:getNextXMLNode is called, all nodes preceding the newly returned node become invalid, including all nodes previously returned by pub.xml:getNextXMLNode. The client must fully complete processing preceding nodes before advancing the window by calling pub.xml:getNextXMLNode again. In moving-window mode, the document consumes at least enough memory to hold the most recently returned node.
Moving-window mode allows the server to process multi-megabyte XML documents using very little memory. Moving-window mode may only be used on a node that represents an entire XML document and not on any descendant node.
Note:
You can use moving-window mode if the input node is of type com.wm.lang.xml.Node only. Moving-window mode cannot be used with an enhanced XML node.
Input Parameters
node
The XML node or enhanced XML node for which you want to produce a NodeIterator. This parameter supports the following types of input:
*com.wm.lang.xml.Node XML node for which you want to produce a NodeIterator. The node can represent either an XML document or an element of an XML document; however, if the NodeIterator will be used in moving-window mode, a whole XML document must be used. This is because moving window mode is only meaningful for managing the loading process of a document, and to operate on a node is to have already loaded the node
*enhanced XML node An enhanced XML node for which you want to produce a NodeIterator. An enhanced XML node can be produced by pub.xml:loadEnhancedXMLNode, pub.xml:xmlStringToEnhancedXMLNode, or a content handler that receives an XML document in a request for which xmlFormat is set to enhanced.
criteria
String List Optional. Pattern strings identifying the nodes that the iterator is to return. A pattern string may take either the form <localName> or the form <prefix>:<localName>.
When a pattern takes the first form, it identifies an element whose local name is <localName> and that belongs to the default XML namespace. When a pattern takes the second form, it identifies an element whose local name is <localName> and whose XML namespace is given by the prefix <prefix>. If the input parameter nsDecls declares this prefix, the namespace URI of the element must match the URI declared for the prefix. If the prefix is not declared in nsDecls, the prefix is matched against prefixes found in the XML.
<prefix> and <localName> can each optionally take the value "*" (asterisk) to match any namespace or local name. A "*" prefix also matches elements residing in the default namespace.
If you do not specify criteria, all element node children of the root element are returned.
nsDecls
Document Optional. Namespaces associated with any namespace prefixes used in criteria. Each entry in nsDecls represents a namespace prefix/URI pair, where a key name represents a prefix and the value of the key specifies the namespace URI.
For example, to define the URIs associated with two prefixes called GSX and TxMon, you would set nsDecls as follows:
movingWindow
String Optional. Flag indicating whether the NodeIterator is to iterate using a moving window, as described above. In moving-window mode, the entire document preceding the node most recently returned by getXMLNodeIterator is discarded. Subsequent attempts to return preceding portions of the document will return either the repeating text *PURGED* or the proper data, depending on whether the data falls within an area that the server was able to discard. When iterating with a moving window, the current node should be queried and completely examined prior to requesting the next node.
Set to:
*true to use the NodeIterator in moving-window mode.
*false to use the NodeIterator in normal mode. This is the default.
Note:
If node is an enhanced XML node, set movingWindow to false.
Output Parameters
iterator
com.wm.app.b2b.util.NodeIterator NodeIterator for use with the service pub.xml:getNextXMLNode.