Results 1 to 1 of 1

Thread: "Invalid at the top level of the document" xml and vb6

  1. #1
    Senior Member
    Join Date
    Sep 2007
    Posts
    409
    Thanks
    7
    Thanked
    32 times in 12 posts
    • icanhazburger's system
      • Motherboard:
      • Foxconn 946GZ7MA/946PL7MA Series
      • CPU:
      • DualCore Intel Core 2 Duo E6400
      • Memory:
      • 2 gig DDR2-667
      • Storage:
      • 320gig Baracuda II
      • Graphics card(s):
      • 7900 GS vc3600 cooler
      • PSU:
      • 600w
      • Case:
      • Something with a 25cm fan
      • Monitor(s):
      • 1 x 22"w 1 x 19"
      • Internet:
      • Pipex Max :(

    Unhappy "Invalid at the top level of the document" xml and vb6

    edit : I'm amazingly dumb today, to save anyone the effort of reading this plea for help, I was using loadxml instead of just load

    Hi all, firstly "zomg why you still using vb6" is not an answer, feel free to say it if you provide an answer aswell though or mock my shoddy work in an amusing manner.

    Basically, I've two app's written in vb6, one is using MSXML2.XMLHTTP60 to get xml from the server, it parses it fine and then uses MSXML2.DOMDocument60 save method to save it as an xml file on the computer.

    My 2nd application uses MSXML2.DOMDocument60 to load this xml file, but then gets a parser error "Invalid at the top level of the document".

    If I try to open the xml file in question in ie or xml notepad, its fine. Just my vb6 code does not seem to like it.

    All its doing when opening is this....

    Code:
        objXML.loadXML (sFile)
        If objXML.parseError.errorCode <> 0 Then
            txtProgress.Text = txtProgress.Text + vbCrLf + "Error : " + objXML.parseError.reason
       end if
    and this is the code that saved the file previously....

    Code:
            objXMLHTTP.open "GET", strURL, False
            objXMLHTTP.send
            objXML.loadXML (objXMLHTTP.responseText)
            WriteHistoryFile (Date$ + " " + Time$ + " Getting xml from " + sURL)
            If objXML.parseError.errorCode <> 0 Then
                txtStatus.Text = txtStatus.Text + vbCrLf + Date$ + " " + Time$ + " " + objXML.parseError.reason
                WriteHistoryFile (Date$ + " " + Time$ + "Error " + objXML.parseError.reason)
            Else
                txtStatus.Text = txtStatus.Text + vbCrLf + Date$ + " " + Time$ + " Saving update file to " + sPath
                mydate = Replace(Date, "/", "_")
                myTime = Replace(Time, ":", "_")
                sFilename = sPath + sAppName + mydate + "_" + myTime + ".xml"
                objXML.save (sFilename)
                
                WriteHistoryFile (Date$ + " " + Time$ + " Saving update file to " + sFilename)
            End If
    What the hell, may aswell stick my .xml file in aswell...

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <register><user><forename>David</forename><surname>James</surname><title>A</title><address>6 Park Lane, Birmingham</address><smoker>No</smoker><noemail>No</noemail><pcode>BH1 43R</pcode><phone>0153 54345345</phone><mobile>5345345345</mobile><email>davidjames@crapola.com</email><dob>04/09/1865</dob></user></register>
    edit : I put this line in

    MsgBox objXML.xml

    The message dialog is blank though, the file deffo exists.
    Last edited by icanhazburger; 02-05-2008 at 04:24 PM. Reason: in the internets, no one can hear my dumbness
    In the internets, no one can hear you sarcasm.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •