<NodeName xmlns="MyNameSpace" ID="10000"> NodeValue <NewNode xmlns=""> NewNodeValue1 <NewSubNode> NewSubNodeValue1 </NewSubNode> </NewNode> <NewNode xmlns=""> NewNodeValue2 </NewNode> <NewNode xmlns=""> NewNodeValue3 </NewNode> </NodeName>
IF ISCLEAR(XMLDOMDocument) THEN CREATE(XMLDOMDocument); XMLDOMDocument.load('c:\MyXML.xml'); XMLDOMMgmt.SetNormalCase(); CurrNode := XMLDOMDocument.documentElement; //------------------------------------- // message a single node... IF XMLDOMMgmt.FindNode(CurrNode, 'NewNode', CurrNode2) THEN BEGIN MESSAGE(FORMAT(CurrNode2.text)); // *** this is the code to print from NodeValue //EVALUATE(TempStr, CurrNode2.NodeValue); //MESSAGE(TempStr); END ELSE MESSAGE('Node not found!');
XML: <names> <name>Alice</name> <name>Bert</name> <name>Charlie</name> <name>Diane</name> <name>Eric</name> </names>
Code (VBScript): Set objXMLDoc = CreateObject("Microsoft.XMLDOM") objXMLDoc.async = False objXMLDoc.load("names.xml") Set objNode = objXMLDoc.documentElement.lastChild document.write(objNode.nodeValue) Set objNode = objNode.firstChild document.write("<br>" & objNode.nodeValue) Output: null Eric
Comments
Epimatic Corp.
http://www.epimatic.com