Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: MSXML 3 Replaced By MSXML6 - Help

From: "Don Miller" <nospam@------.--->
To: NULL
Date: 2/13/2009 9:26:00 AM
Sorry to waste your time. It's a frickin' RS/IIS permissions problem (and my 
xml parsing and error checking was not so great). But I would be interested 
in how I could catch this error in the future (after 4 hours focusing on 
XML - now probably another 4+ dealing with permissions

When I got a response back from the RS web services it was an html page (You 
are not authorized to view this page. HTTP Error 401.2 - Unauthorized: 
Access is denied due to server configuration. Internet Information Services 
(IIS)), I was always looking for specific XSLPatterns (e.g. //ErrorCode) in 
code like nodeObject = xmldoc.documentElement.selectSingleNode(xslPattern) 
and expecting to get "nothing" back if the pattern was not found. See code 
again below.

When I put in the code you suggested I get back an error "-2146697209:No 
data is available for the requested resource." I would only get this back 
when I returned "nothing" to trigger error reporting, but when I used the 
"selectSingleNode" method I would get the previous "Object required: 
'xmldoc.documentElement'" VBScript error. So, it appears that 
selectSingleNode throws a vbscript error rather than returning nothing???

Any thoughts? And thanks again.

    Function getNodeObject(theResponse, xslPattern)
        'if using 6.0 HAVE to use XPath instead of XSLPatterns
        'and would HAVE to include namespaces and prefixes in the xpath
        'for nodes associated with namespaces
        Dim xmldoc
        set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldoc.async = False
        xmldoc.load(theResponse)
errorMsg = xmldoc.parseError.errorCode & ":" & xmldoc.parseError.reason
        'set getNodeObject = nothing
        set getNodeObject = 
xmldoc.documentElement.selectSingleNode(xslPattern)
        set xmldoc = nothing
    End Function

    Function getNodeText(theResponse, xslPattern)
        Dim node
        set node = getNodeObject(theResponse, xslPattern)
        if NOT (node is nothing) then
            getNodeText = node.text
            set node = nothing
        else
            getNodeText = errorMsg
        end if
    End Function



"Martin Honnen" <mahotrash@y...> wrote in message 
news:ej8TWQejJHA.504@T......
> Don Miller wrote:
>
>> Function getNodeObject(theResponse, xslPattern)
>>         'if using 6.0 HAVE to use XPath instead of XSLPatterns
>>         'and would HAVE to include namespaces and prefixes in the xpath
>>         'for nodes associated with namespaces
>>         Dim xmldoc
>>         set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
>
> Add an
>           xmldoc.async = False
> here
>>         xmldoc.load(theResponse)
> then check
>           xmldoc.parseError.errorCode
>           xmldoc.parseError.reason
> here
>
>
>
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/ 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent