473,322 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

ServerXMLHTTP and nodeValue versus nodeTypedValue

All,

Long time since I've done some proper coding in ASP and I've hit a wee snag
that has got me baffled. Well two actually but the other is to do with
running pages under Sun ASP so we'll not go there! Anyway, I digress...

I've cobbled together some code as shown below (removed error checking etc
for simplicity). This uses ServerXMLHTTP to grab an XML file off a remote
server. When querying the result, however, the nodeValue property is null
whereas the nodeTypedValue property isn't.

Can anyone please advise as this I would expect nodeValue to be populated.

Cheers,
Adam M.

===== BEGIN_TESTPAGE.ASP ====
<%
Dim objXMLHTTP

Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

With objXMLHTTP
.open "GET", "http://www.myserver.eu/test.asp", False
.send

Response.Write "Status: " & .status & "<br />"
Response.Write "Parse:" & .responseXML.parseError.errorCode & "<br />"

Response.Write
..responseXML.documentElement.childNodes(0).childN odes(0).nodeTypedValue
Response.Write
..responseXML.documentElement.childNodes(0).childN odes(0).nodeValue
End With

Set objXMLHTTP = Nothing
%>
===== END_TESTPAGE.ASP =====

===== BEGIN_TEST.ASP =====
<% Option Explicit

With Response
.Buffer = True

.AddHeader "Pragma", "no-cache"

.CacheControl = "no-cache"

.Expires = -1

.ContentType = "text/xml"

.Charset = "UTF-8"
End With %><?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<tLRecords>
<tLRecord>
<tL>A</tL>
<tLD>B</tLD>
<tLED>2008-06-24</tLED>
<rL>C</rL>
<rLD>D</rLD>
</tLRecord>
</tLRecords>
===== END_TEST.ASP =====

Jun 27 '08 #1
7 6251
Adam David Moss wrote:
Long time since I've done some proper coding in ASP and I've hit a wee
snag that has got me baffled. Well two actually but the other is to do
with running pages under Sun ASP so we'll not go there! Anyway, I
digress...

I've cobbled together some code as shown below (removed error checking
etc for simplicity). This uses ServerXMLHTTP to grab an XML file off a
remote server. When querying the result, however, the nodeValue
property is null whereas the nodeTypedValue property isn't.

Can anyone please advise as this I would expect nodeValue to be populated.
The nodeValue of element nodes in the DOM model is always null. With
MSXML there is property named 'text' which gives you the text content of
a node so in case of an element
<tL>A</tL>
to text property is "A".

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #2
That's got me confused - I have other bits of code that define objects of
type MSXML.DOMDocument and the nodeValue works as expected?

Regards.

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
Adam David Moss wrote:
>Long time since I've done some proper coding in ASP and I've hit a wee
snag that has got me baffled. Well two actually but the other is to do
with running pages under Sun ASP so we'll not go there! Anyway, I
digress...

I've cobbled together some code as shown below (removed error checking
etc for simplicity). This uses ServerXMLHTTP to grab an XML file off a
remote server. When querying the result, however, the nodeValue property
is null whereas the nodeTypedValue property isn't.

Can anyone please advise as this I would expect nodeValue to be
populated.

The nodeValue of element nodes in the DOM model is always null. With MSXML
there is property named 'text' which gives you the text content of a node
so in case of an element
<tL>A</tL>
to text property is "A".

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #3
"Adam David Moss" <no@email.addresswrote in message
news:uR**************@TK2MSFTNGP03.phx.gbl...
That's got me confused - I have other bits of code that define objects of
type MSXML.DOMDocument and the nodeValue works as expected?
nodeValue and nodeTypedValue despite appearances are very different
properties.
nodeValue is a standard DOM property which returns a nodes value. Node
types such as an attribute or a text node have a value. Elements however do
not have a value they only have child nodes of various types.

Hence in your original code you could include this line:-

Response.Write
..responseXML.documentElement.firstChild.firstChil d.firstChild.nodeValue

and it would return a value. Whilst a simple XML element that only contains
text may appear that it should have the value of its text it is infact an
element that has a single child node. The child node is a text node and its
the text node that has a value.

OTH nodeTypedValue is an MS enhancement which allows a simple element to
carry a value which may be typed. The element may carry a dt:dt attribute
(where dt is alias for the "urn:schemas-microsoft-com:datatypes" namespace)
that defines a data type. The nodeTypedValue returns a variant with a VT
type corresponding to the dt:dt attribute. If dt:dt is not present string
is assumed. The value of the property is drawn from the text of the
element.
Hope this clarifies things.

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #4
Adam David Moss wrote:
That's got me confused - I have other bits of code that define objects
of type MSXML.DOMDocument and the nodeValue works as expected?
Well nodeValue makes sense for text nodes, cdata section nodes,
attribute nodes, comment nodes, processing instruction nodes. The
"expected" value however for element nodes or document nodes is null
(respectively Nothing in VBScript), see
http://msdn.microsoft.com/en-us/libr...22(VS.85).aspx
which lists what nodeValue gives for the different types of nodes.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #5
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
Adam David Moss wrote:
That's got me confused - I have other bits of code that define objects
of type MSXML.DOMDocument and the nodeValue works as expected?
The "expected" value however for element nodes or document nodes is null
(respectively Nothing in VBScript),
Getting a little .NET parlance mixed in there ;)

Its Null in VBScript also (nodeValue returns a variant).
--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #6
Anthony Jones wrote:
"Martin Honnen" <ma*******@yahoo.dewrote in message
>The "expected" value however for element nodes or document nodes is null
(respectively Nothing in VBScript),

Getting a little .NET parlance mixed in there ;)

Its Null in VBScript also (nodeValue returns a variant).
Thanks for correcting. It seems .NET has spoiled the few VBScript
experiences I ever had.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #7
Thanks guys that makes sense now!

Cheers.


"Martin Honnen" <ma*******@yahoo.dewrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Anthony Jones wrote:
>"Martin Honnen" <ma*******@yahoo.dewrote in message
>>The "expected" value however for element nodes or document nodes is null
(respectively Nothing in VBScript),

Getting a little .NET parlance mixed in there ;)

Its Null in VBScript also (nodeValue returns a variant).

Thanks for correcting. It seems .NET has spoiled the few VBScript
experiences I ever had.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mohn3310 | last post by:
We're having some problems with foreign characters using ServerXMLHTTP. We have an asp page that calls a function in COM through ServerXMLHTTP. The COM component returns xml data. If that data...
2
by: jimmyfishbean | last post by:
Hi, I am using VB6, SAX (implementing IVBSAXContentHandler). I need to extract binary encoded data (images) from large XML files and decode this data and generate the appropriate images onto...
1
by: Raúl Martín | last post by:
I´ve a function in asp that run correctly but If I tried to change it forasp.net in asp: xmlHTTP = CreateObject("Microsoft.XMLHTTP") And I thought to use this sentence for asp.net but the...
2
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking...
8
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the html for the logon user's default page. We've...
7
by: Ed McNierney | last post by:
I'm trying to use ServerXMLHTTP on an ASP (not ASP.NET) page to retrieve large binary data from a remote server. When the request is large (more than a few megabytes), the ServerXMLHTTP page jumps...
10
by: Lambuz | last post by:
Hi all, I'm trying to use a ServerXMLHTTP connection in async mode to request Page2.asp from Page1.asp. Both pages are inside 2 different virtual directories with Windows Integrated...
2
by: Ramya A | last post by:
Hi All: I have a .NET webservice accepting an XML request document as a parameter How do I call this webservice with ServerXMLHTTP object from my VB6.0 client? I have enabled the HttpPost...
7
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/xml.html The first alert() shows the XML that the server is returning. The second alert() shows a particular elements nodeValue and, as you can see,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.