Home All Groups Group Topic Archive Search About

XML - load contents onto page.

Author
10 Oct 2006 10:15 AM
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.

Author
10 Oct 2006 10:41 AM
Bob Barrows [MVP]
SuperMario wrote:
Show quoteHide quote
> 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
%>



--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Are all your drivers up to date? click for free checkup

Author
10 Oct 2006 1:05 PM
Martin Honnen
SuperMario wrote:


Show quoteHide quote
> 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
--

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Bookmark and Share