Archived Forum Post

Index of archived forum posts

Question:

XML parsing, cannot find child

Sep 03 '16 at 10:03

Hello, I try to parse the attached XML, al fine, only the tag "Application" is invisible for all kinds of parsing. Any idea ? regards Rudolf

<application version="3" designtool="3.5.2" url="https://111.111.111.195/test" prepop="false" hwrenabled="true"> <name>Test name</name> <description>Test description</description> </application>

My code (xBase++ like VPF)


nNumChildren := oXML:NumChildren // 2 nAppChilds := oXML:NumChildrenHavingTag("Application") // 0

oFirst := oXML:FirstChild() nFirstChildren := oFirst:NumChildren // 0 cTag := oFirst:tag // name, is ok

oApp := oXml:FindChild("Application") // NULL ???

oRoot := oXML:GetRoot() nRootChildren := oRoot:NumChildren // 0 children ???


Accepted Answer

that xml you posted, has application as the root. the version, designtool, etc... are attributes. You can get the attribute from using the oXML:GetAttrValue(), there are other methods you can call too.


Answer

Hello, many thanks ! now it is clear and working regards Rudolf