XML - load contents onto page.

S

SuperMario

Hello,

We have a web site using CLASSIC ASP, and a client with what would appear to
be a non conforming XML document.

Their remote XML document in its entirety looks like so:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://clients.domainname.net">qwerty500</string>


I do not have experience in XML retrieval, but I have been tasked with
taking the "qwerty500" value and displaying it on an ASP page on our clients
site. Getting the XML host to change their file is a no go. The little I
do know about XML suggests to me, the XML document has various requirements
missing such as a document element and a parent / child structure? I have
worked with other XML documents and managed to get them to display,. nut
they all had child nodes etc. This one has me stumped.

Any help or ideas greatly appreciated.

Regards,

Mark.
 
B

Bob Barrows [MVP]

SuperMario said:
Hello,

We have a web site using CLASSIC ASP, and a client with what would
appear to be a non conforming XML document.

Their remote XML document in its entirety looks like so:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://clients.domainname.net">qwerty500</string>


I do not have experience in XML retrieval, but I have been tasked with
taking the "qwerty500" value and displaying it on an ASP page on our
clients site. Getting the XML host to change their file is a no go. The
little I do know about XML suggests to me, the XML document has
various requirements missing such as a document element and a parent
/ child structure? I have worked with other XML documents and
managed to get them to display,. nut they all had child nodes etc. This
one has me stumped.

Seems pretty straightforward to me:

<%
dim xml, xmldoc,node
xml="<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<string xmlns=""http://clients.domainname.net"">qwerty500</string>"
set xmldoc=createobject("msxml2.domdocument")
xmldoc.loadXML xml
set node=xmldoc.selectSingleNode("//string")
Response.Write node.text
%>
 
M

Martin Honnen

SuperMario wrote:

We have a web site using CLASSIC ASP, and a client with what would appear to
be a non conforming XML document.

Their remote XML document in its entirety looks like so:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://clients.domainname.net">qwerty500</string>


I do not have experience in XML retrieval, but I have been tasked with
taking the "qwerty500" value and displaying it on an ASP page on our clients
site. Getting the XML host to change their file is a no go. The little I
do know about XML suggests to me, the XML document has various requirements
missing such as a document element and a parent / child structure?

There is nothing wrong with that XML sample, it has a single element
(document element or root element) with local name |string| in the
namespace with URI http://clients.domainname.net and that element has a
single text node as its only child node. So use any MSXML version you
have on your server and load the XML and access the text property of the
root element e.g.

Set xmlDoc = CreateObject("Msxml2.DOMDocument.3.0");
If xmlDoc.load("http://example.com/file.xml") Then
Response.Write xmlDoc.documentElement.text
Else
' handle parse error here
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top