I have a document formatted like this:
<TestResult xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<TestName>1234</TestName>
<TestID>P1</TestID>
<Score>70</Score>
<Learner>
<ID>5846</ID>
<Name>Fred Smith</Name>
</Learner>
</TestResult>
I'm loading it as follows:
Set objXMLHttp = CreateObject("MSXML2.Serve
rXMLHTTP.6
.0")
objXMLHttp.Open "GET", strURL, False
objXMLHttp.send
' This works but strReturn is formatted using { and : characters not as xml/soap
strReturn = objXMLHttp.responseText
Set xmlDoc = CreateObject("MSXML2.DOMDo
cument")
xmlDoc.async = False
xmlDoc.LoadXML strReturn
xmldoc as a Parse error, invalid at top level of document
How do I access the score and learner id ?
I had a look at that yesterday , its generic code for traversing a structure rather than specific access to known elements.
I figured it eventually by trial an error though :)
- For top level test data
xmlDoc.getElementsByTagNam
- for data in the Learner record
xmlDoc.getElementsByTagNam