WebLOAD provides an embedded, third-party XML parser object to improve the multi-platform support for XML parsing within the WebLOAD environment. The XML parser object can be used instead of MSXML and Java XML parsing, resulting in lower memory consumption and increased performance during load testing.
The XML parser object can be used to reference any element in an XML document. For example, you can use the XML parser object to generate an Excel file containing the _desired details of a specified element._
__WebLOAD uses the Open Source Xerces XML parser (see__ _http://xml.apache.org/xerces-c/)._________
___The XML parser object is instanced as follows:___
___xmlObject = new XMLParserObject();___
_____The parse() method, not exposed by the original XML parser, is exposed by_____ ______WebLOAD. This method is identical to the parseURI() method, except that it______ _______receives an XML string instead of a URI._______
________The following sections provide lists of exposed methods and properties as well as a________ _________detailed example of the implementation of the XML parser object._________
Example
The following is an example of the use of the XML parser object:
//Create the XML parser object (xerces-c parser) xmlObject = new XMLParserObject();
_
//Parse the xml file from the specified path
xmlDoc = xmlObject.parseURI("C:\\xml_file.xml");_
_
//Retrieve the first node with the “NODE5” tag
domNode = xmlDoc.getElementsByTagName("NODE5").item(0);_
_
//Retrieve the node's type
nodeType = domNode.getNodeType();_
_
//Retrieve the node's parent
nodeParent = domNode.getParentNode().getNodeName();_
_
//Retrieve the number of child nodes
numOfChilds = domNode.getChildNodes().getLength();_
_
//Create a new element
newNode1 = xmlDoc.createElement("NEW_NODE1");_
_
//Insert the new element into DOM
domNode1.insertBefore(newNode1, domNode);_
手机扫一扫
移动阅读更方便
你可能感兴趣的文章