HI
Im have a problem. the call to XmlNodeList.nextNode not running:
XmlNode : = xmldom.selectSingleNode('namenode');
XmlNode : = XmlNodeList.item(0);
XmlNode.selectSingleNode('namenode/text()');
REPEAT
IF NOT ISNULL(XmlNode) THEN BEGIN
bigTxTem.ADDTEXT(XmlNode.text);
or
rec.fieldVarText := XmlNode.text;
rec.insert;
end;
XmlNodeList.nextNode; /// ERROR NO STEP TO NEXT NODE
UNTIL ISNULL(XmlNode);
--------------------
have alternative to extract the text value of estructure of varios "nodes" of same name:
<nodename0>
<nodename1>
<nodename>Value01</nodename>
</nodename1>
<nodename1>
<nodename>value02</nodename>
</nodename1>
<nodename1>
<nodename>value03</nodename>
</nodename1>
</nodename1>
tanks!!
*This post is locked for comments
Selects THE FIRST XmlNode that matches the XPath expression.
If the XML is what you show here, XmlNode.selectSingleNode('namenode/text()'); is not clear.
If you want to retrieve all nodes values, use something like:
CREATE(XMLDoc);
XMLDoc.load(FileName);
//Gets a list of Items to loop through
XMLNodeList := XMLDoc.selectNodes('//nodename');
FOR Counter := 1 TO XMLNodeList.length DO BEGIN
XMLNode := XMLNodeList.item(Counter-1);
Message('%1',XMLNode.text());
END;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,232 Super User 2024 Season 2
Martin Dráb 230,064 Most Valuable Professional
nmaenpaa 101,156