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.