From: Martin Honnen on
p byers wrote:

> Dim xmlDoc
> ''set xmlDoc = createObject("MSXML2.DOMDocument")
> Set xmlDoc = CreateObject("MSXML2.DOMDocument.3.0")
>
> xmlDoc.async = False
> xmlDoc.setProperty "ServerHTTPRequest", true
> xmlDoc.setProperty "SelectionLanguage", "XPath"
>
>
> xmlDoc.load("URL_TO_XML_DOCUMENT")
>
> ''response.write
> xmlDoc.selectNodes("\\EMRSV4.0Response\MerchandiseReturnLabel")
> Response.Write
> xmlDoc.selectSingleNode("EMRSV4.0Response/MerchandiseReturnLabel").text
>
>
> %>
>
>
>
>
>
> . . . and was rewarded with
>
>
> Error Type:
> Microsoft VBScript runtime (0x800A01A8)
> Object required: 'selectSingleNode(...)'
> /test/getXMLelementTEXT.asp, line 15

Well how exactly does the XML look?
Check xmlDoc.parseError.errorCode/reason after the load call, maybe the
XML does not get loaded at all.

--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/
From: p byers on


Martin Honnen wrote:

>
>
> Well how exactly does the XML look?
> Check xmlDoc.parseError.errorCode/reason after the load call, maybe the
> XML does not get loaded at all.
>
> --
>
> Martin Honnen --- MVP XML
> http://msmvps.com/blogs/martin_honnen/

Just for your information, I switched my brain on and employed some of my
exisiting knowledge rather than just blindly "Copying and Pasting"

Sorry to have wasted your time !!

The two working files are shown below (watch out for wrap)

Thank you for your patience with a daft old fart !!

Pete (Northolt UK)


==================================================================
== getXMLelementTEXT.asp ==
==================================================================

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim xmlDoc
''set xmlDoc = createObject("MSXML2.DOMDocument")
''Set xmlDoc = CreateObject("MSXML2.DOMDocument.3.0")

xmlFileName = "http://pb-big-tosh3/test/URL_TO_XML_DOCUMENT.xml"

set xmlDoc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
if xmlDoc is nothing then
Response.Write "objDocument object not created<br>"
else
If Err Then
Response.Write "XML DomDocument Object Creation Error - <BR>"
Response.write Err.Description
else
xmlDoc.async = False
bLoaded = xmlDoc.Load(xmlFileName)
if (bLoaded = False) then
Response.Write (xmlFileName & " - Load Failed<P>")
Response.Write("Error code: " & xmlDoc.parseError.errorCode)
Response.Write("<br />Error reason: " & xmlDoc.parseError.reason)
Response.Write("<br />Error line: " & xmlDoc.parseError.line)
Response.Write("<br />Error linepos: " & xmlDoc.parseError.linepos)
Response.Write("<br />Error srcText: " & xmlDoc.parseError.srcText)
Response.Write("<br />Error url: " & xmlDoc.parseError.url)
Response.Write("<br />Error filepos: " & xmlDoc.parseError.filepos)
Response.End
else
xmlDoc.setProperty "SelectionLanguage", "XPath"
set createXMLDocFromFileAbs = xmlDoc

xmlDoc.async = False
xmlDoc.setProperty "ServerHTTPRequest", true
xmlDoc.setProperty "SelectionLanguage", "XPath"

''response.write
xmlDoc.selectNodes("\\EMRSV4.0Response\MerchandiseReturnLabel")
Response.Write
xmlDoc.selectSingleNode("EMRSV4.0Response/MerchandiseReturnLabel").text
end if
end if
end if


%>




==================================================================
== URL_TO_XML_DOCUMENT.xml ==
==================================================================

<?xml version="1.0" encoding="UTF-8"?>
<EMRSV4.0Response>
<Zone>5</Zone>
<MerchandiseReturnLabel>JVBERi0xLjINCjUgMCBvYmoN=</MerchandiseReturnLabel>

<DeliveryConfirmationNumber>420327139183805213907147133548</DeliveryConfirmationNumber>

<InsuranceCost>1.75</InsuranceCost>
<PDUPOBox>240 SPRINGVIEW COMMERCE DR</PDUPOBox>
<PDUCity>DEBARY</PDUCity>
<PDUState>FL</PDUState>
<PDUZip5>32713</PDUZip5>
<PDUZip4>4834</PDUZip4>
<Postnet>32713483440</Postnet>
<CustomerAddress1 />
<CustomerAddress2>6406 IVY LN</CustomerAddress2>
<CustomerCity>GREENBELT</CustomerCity>
<CustomerState>MD</CustomerState>
<CustomerZip5>20770</CustomerZip5>
<CustomerZip4>1441</CustomerZip4>
<CustomerPostNet>20770144106</CustomerPostNet>
</EMRSV4.0Response>