Discussion:
LoadXML fails with MSXML4 SP2
(too old to reply)
m***@netexpress.net
2006-03-29 21:16:54 UTC
Permalink
I recently updated my computer to MSXML4 SP2 from MSXML4 SP1 and now my
code that reads an XML string into the parser fails. Here is the code
that nolonger works. The problem seems to be with the external
reference to the schema in the XML string. If I change the location of
the schema to be a local directory it will work fine. The code is
actually in a VB COM object that runs on a web server but this ASP
example shows the same error and is easier to try. If I run the VB COM
object in debug mode then it works fine. This all points to a security
/ permissions problem. I have searched the Internet for any help but
without success.

I do need to use MSXML 4 because we want to do validation against the
schema when the XML string is loaded into the parser.

Any help would be appreciated.

Thanks,
Mike

<%Option Explicit%>
<%Response.Buffer = False%>
<html>
<head>
</head>
<body>

<%
Dim strXML
strXML = "<?xml version=""1.0"" encoding=""UTF-8""?>"
strXML = strXML & "<RestrictedDatesRequest
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xsi:noNamespaceSchemaLocation=""http://www.gotpermits.com/schemas/RestrictedDatesRequest.xsd"">"
strXML = strXML & "<UserName>haulera</UserName>"
strXML = strXML & "<Password>haulera</Password>"
strXML = strXML & "<LicenseKey></LicenseKey>"
strXML = strXML & "<State>XX</State>"
strXML = strXML & "<PermitType>111</PermitType>"
strXML = strXML & "</RestrictedDatesRequest>"

Dim oXML, oXMLError, ReturnValue, x
Set oXML = Server.CreateObject("MSXML2.DOMDocument.4.0")
oXML.async = False
oXML.setProperty "ServerHTTPRequest", true
oXML.validateOnParse = True
oXML.resolveExternals = True

'ReturnValue = oXML.Load("http://mrf/datasync/test.xml")
ReturnValue = oXML.LoadXML(strXML)
Response.write "Result of load method is =" & ReturnValue & "<br>"
If ReturnValue = False Then
Set oXMLError = oXML.ParseError
Response.Write "&#xa0;&#xa0;" & oXMLError.ErrorCode & " - " &
oXMLError.Reason & " URL=" & oXMLError.URL & "<br>"
Set oXMLError = Nothing
End If

Response.Write oxml.parseError.reason

For x = 0 to oxml.childNodes.length
Response.Write "Node " & x & ". "
Next

Set oXML = Nothing
%>
</body>
</html>
Martin Honnen
2006-04-04 13:21:34 UTC
Permalink
Post by m***@netexpress.net
I recently updated my computer to MSXML4 SP2 from MSXML4 SP1 and now my
code that reads an XML string into the parser fails. Here is the code
that nolonger works. The problem seems to be with the external
reference to the schema in the XML string.
See <http://support.microsoft.com/kb/883500/en-us>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
m***@netexpress.net
2006-04-06 15:03:47 UTC
Permalink
The hotfix resolved the problem. Thanks for much for you help.

Loading...