473,473 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Display XML Element in ASP

Hi,

I'm trying to write a piece of ASP that will allow me to display only one
element of a XML file. I am new to XML and wanted to find out what I am
doing wrong. I think it may be to do with the nodes ? When this is currently
run it comes up with the error "Overflow" ('800a0006').

Any pointers or solutions ?

Thanks

J.

This is the XML (page.xml) :

<stocklist>
<stock tidm="VOD">
<exchange>LSE</exchange>
<symbol>VOD</symbol>
<fullname>VODAFONE GRP.</fullname>
<currency>GBX</currency>
<midprice>143.5 (28OCT)</midprice>
<bidprice>143.5</bidprice>
<offerprice>143.75</offerprice>
<valuechange>+2.5</valuechange>
<percentchange>+1.77</percentchange>
<yearhigh>156.5</yearhigh>
<yearlow>132.75</yearlow>
<dayhighmid>0</dayhighmid>
<daylowmid>0</daylowmid>
<volume>0</volume>
<tradecount>0</tradecount>
<previouscloseprice>141</previouscloseprice>
<timestamp>Sun Oct 30 13:46:01 2005</timestamp>
</stock>
</stocklist>

And this is the code that should output the "midprice" :

<%
Option Explicit
Response.Buffer = True

Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("page.xml"))

Dim midprice,stocklist
Set midprice = xml.documentElement.selectNodes(stocklist/midprice).text
%>
<%= midprice %>
Oct 30 '05 #1
3 2594
"John Smith" <jo**@smith.com> wrote in message
news:_4********************@pipex.net...
Hi,

I'm trying to write a piece of ASP that will allow me to display only one
element of a XML file. I am new to XML and wanted to find out what I am
doing wrong. I think it may be to do with the nodes ? When this is currently run it comes up with the error "Overflow" ('800a0006').

Any pointers or solutions ?

Thanks

J.

This is the XML (page.xml) :

<stocklist>
<stock tidm="VOD">
<exchange>LSE</exchange>
<symbol>VOD</symbol>
<fullname>VODAFONE GRP.</fullname>
<currency>GBX</currency>
<midprice>143.5 (28OCT)</midprice>
<bidprice>143.5</bidprice>
<offerprice>143.75</offerprice>
<valuechange>+2.5</valuechange>
<percentchange>+1.77</percentchange>
<yearhigh>156.5</yearhigh>
<yearlow>132.75</yearlow>
<dayhighmid>0</dayhighmid>
<daylowmid>0</daylowmid>
<volume>0</volume>
<tradecount>0</tradecount>
<previouscloseprice>141</previouscloseprice>
<timestamp>Sun Oct 30 13:46:01 2005</timestamp>
</stock>
</stocklist>

And this is the code that should output the "midprice" :

<%
Option Explicit
Response.Buffer = True

Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("page.xml"))

Dim midprice,stocklist
Set midprice = xml.documentElement.selectNodes(stocklist/midprice).text
%>
<%= midprice %>

http://www.devguru.com/Technologies/...lectNodes.html
<%
Option Explicit
Response.Buffer = True
Dim midprice

Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("page.xml"))

Dim NodeList
Set NodeList = xml.documentElement.selectNodes("stock/midprice")
Dim Node
For Each Node In NodeList
midprice = Node.text
Next
%>
<%= midprice %>
Oct 31 '05 #2
Thanks for that, I'm still not quite getting this though ! If I wanted to
expand on this and have several of the nodes in the output is it just a
question of adding them to the nodelist ?

Thanks,

J.
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:y4********************@comcast.com...
"John Smith" <jo**@smith.com> wrote in message
news:_4********************@pipex.net...
Hi,

I'm trying to write a piece of ASP that will allow me to display only one
element of a XML file. I am new to XML and wanted to find out what I am
doing wrong. I think it may be to do with the nodes ? When this is

currently
run it comes up with the error "Overflow" ('800a0006').

Any pointers or solutions ?

Thanks

J.

This is the XML (page.xml) :

<stocklist>
<stock tidm="VOD">
<exchange>LSE</exchange>
<symbol>VOD</symbol>
<fullname>VODAFONE GRP.</fullname>
<currency>GBX</currency>
<midprice>143.5 (28OCT)</midprice>
<bidprice>143.5</bidprice>
<offerprice>143.75</offerprice>
<valuechange>+2.5</valuechange>
<percentchange>+1.77</percentchange>
<yearhigh>156.5</yearhigh>
<yearlow>132.75</yearlow>
<dayhighmid>0</dayhighmid>
<daylowmid>0</daylowmid>
<volume>0</volume>
<tradecount>0</tradecount>
<previouscloseprice>141</previouscloseprice>
<timestamp>Sun Oct 30 13:46:01 2005</timestamp>
</stock>
</stocklist>

And this is the code that should output the "midprice" :

<%
Option Explicit
Response.Buffer = True

Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("page.xml"))

Dim midprice,stocklist
Set midprice = xml.documentElement.selectNodes(stocklist/midprice).text
%>
<%= midprice %>

http://www.devguru.com/Technologies/...lectNodes.html
<%
Option Explicit
Response.Buffer = True
Dim midprice

Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("page.xml"))

Dim NodeList
Set NodeList = xml.documentElement.selectNodes("stock/midprice")
Dim Node
For Each Node In NodeList
midprice = Node.text
Next
%>
<%= midprice %>

Oct 31 '05 #3
"John Smith" <jo**@smith.com> wrote in message
news:Ld******************************@pipex.net...
Thanks for that, I'm still not quite getting this though ! If I wanted to
expand on this and have several of the nodes in the output is it just a
question of adding them to the nodelist ?


[snip]

I'm not sure...
Also, if you have more than one <stock> you should use "selectSingleNode".

http://www.devguru.com/Technologies/...tSingleNode.ht
ml

Oct 31 '05 #4

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

Similar topics

7
by: Jeff Thies | last post by:
I'm trying to do a nav list using list items. Roughly this is putting links styled display: block and with a background color. In IE5 (windows, haven't tried Mac yet), adding the display:...
1
by: Jon W | last post by:
This is a small table with hover on the table cells. The first cell is setup to switch from div element to input element by use of display:block/none. In IE, onclick the input element is displayed...
4
by: Lachlan Hunt | last post by:
Hi, I was wondering if ::before and ::after pseudo-elements can apply to elements styled with the display: table-* properties. None of my tests worked in either Firefox or Opera, yet I could not...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
15
by: Markus Ernst | last post by:
Hi When toggling an element on and off by setting its display property via DOM access, display:none is valid for all kinds of elements, but I can't find anything about a generic value for...
5
by: libsfan01 | last post by:
function switch_display(switchme) { var el = document.getElementById(switchme); el.style.display = (el.style.display == 'none')? '' : 'none'; } im using this function to switch the display on...
7
by: khinester | last post by:
Hello, I have the following template that basically does the following: User select Country, then a sub-list is generated with Regions and then this returns the Counties ############### ...
8
by: Haines Brown | last post by:
I want a hot text string to display an image only when hovered. In the body: .... <a id="link-a" href="#nogo"> <img id="photo" src="..." />hot text </a> ....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.