PDA

Click to See Complete Forum and Search --> : XMLDOM Problem


cgarci60
Oct 24th, 2006, 11:04 AM
Hi People,
i have a problem with the load XML Document
Here is the code :
**************************
If oXMLDoc.Load(strHTTP) Then
Set NodeList = oXMLDoc.getElementsByTagName("root")
For Each Element In NodeList
MsgBox oXMLDoc.documentElement.xml
If (Element.getAttribute("TRX_ERROR")) <> "" Then
LOGON = StringDeError(Element.getAttribute("TRX_ERROR"))
WriteErrorLog LOGON, strHTTP
Exit Function
End If
Next
Else
If (oXMLDoc.parseError.errorCode <> 0) Then
Dim myErr0
Set myErr0 = oXMLDoc.parseError
LOGON = GetSysIni("Errores", "Error1", App.path & "\MsgErrores.ini")
WriteErrorLog LOGON, strHTTP
End If
**********************************
the errorCode : -1072896682
the reason : "Invalid at the top level of the document.
the readyState : 4
the srcText : "<root COD_PERFIL="5" CUIT="***********" ESTADO="A" OPERATION_ID="LOGON" PROVEEDOR="98765" RAZON_SOC_PROV="********************" REQUIREMENT_ID="LOGON_KIOSCO" USER_ID="KIOSCO"></root" IS OK
the url : "http://...." IS OK


Any idea ?

CA Slim
Oct 26th, 2006, 10:14 PM
Funny enough I copy and pasted the srctext into a file (test.xml) and I got that error when I opened it in IE but I had the leading double quote in there:

"<root COD_PERFIL="5" CUIT="***********" ESTADO="A" OPERATION_ID="LOGON" PROVEEDOR="98765"

RAZON_SOC_PROV="********************" REQUIREMENT_ID="LOGON_KIOSCO"

USER_ID="KIOSCO"></root>

When I removed it it did not complain.

However I think some parsers require a top level tag (the tag name doesn't matter) like:

<doc><root COD_PERFIL="5" CUIT="***********" ESTADO="A" OPERATION_ID="LOGON" PROVEEDOR="98765"

RAZON_SOC_PROV="********************" REQUIREMENT_ID="LOGON_KIOSCO"

USER_ID="KIOSCO"></root></doc>

Try that and if it works and if you are not sure that one will always be in there you can add it first.