Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB - XML - parseError 1

Status
Not open for further replies.

RobHudson

Programmer
Apr 30, 2001
172
GB
Can anybody help?? I keep getting an "Invlaid at the top level of the document." error
Code:
. When I'm trying to read an xml file.

XML:
<?xml version='1.0'?><RecordSet>
<Record><Header_ID>1</Header_ID><Header_Ref>AAAAA</Header_Ref><Header_Low>jasljflaksjflkas</Header_Low><Header_High>asfasfasf</Header_High></Record></RecordSet>

VB:
Dim xmlDoc As MSXML2.DOMDocument26
Dim xmlNode As MSXML2.IXMLDOMNode

    'Create and load the xml document
    Set xmlDoc = New MSXML2.DOMDocument26
    With xmlDoc
        .async = False
        .loadXML (strXMLWebLocation & &quot;upload_q_headers.xml&quot;)
    End With
    
    'Check for a parse error in the xml
    If Not xmlDoc.parseError.reason = &quot;&quot; Then
        'Is xml error
        MsgBox xmlDoc.parseError.errorCode & &quot; : &quot; & xmlDoc.parseError.reason
    Else
        'No xml error
        'Read xml
...

I'm quite new xml with vb so I might be something really idiotic!!

Please help
Rob
 
With xmlDoc
.async = False
'.loadXML (strXMLWebLocation & &quot;upload_q_headers.xml&quot;)
.load (strXMLWebLocation & &quot;upload_q_headers.xml&quot;)
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top