I have a XmlString which contains multiple elements with their nodes.
ie
<Element>
<AccountName>My Account Name</AccountName>
<FullName>Edward Jones</FullName>
</Element>
I can access the Node names ie AccountName, FullName, but I can’t access the values or they return blank. Here is my code.
Doc : IXMLDocument;
begin
Doc := XMlDoc.LoadXMLData(XmlString);
Doc.DOMDocument.getElementsByTagName('Element').length; // = 11
Doc.DOMDocument.getElementsByTagName('Element').item[2].childNodes[0].nodeName; // = AccountName
Doc.DOMDocument.getElementsByTagName('Element').item[2].childNodes[0].nodeValue;
end;
There are 11 instances of the ‘Element’ in my XmlString so this checks out, the nodeName = AccountName which is what I expect. But the nodeValue is blank. Is there another way to pull the values? Does anyone know why the node values are blank?
A guess: It looks like standard DOM API, so you could have a Text-node below the element nodes.