ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old March 4th, 2003, 06:02 AM
homerdooh homerdooh is offline
php newbie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 512 homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 5 h 15 m 59 sec
Reputation Power: 11
XML getattributes

Hi, i have this simple script i got from the net that is used to parse XML with ASP. It uses the "getattributes" function to get information from xml tags....
xml
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<States> 
<State ref="FL" const="27"> 
<name>Florida</name> 
<capital>Tallahassee</capital> 
</State> 
<State ref="IA" const="29"> 
<name>Iowa</name> 
<capital>Des Moines</capital> 
</State> 
</States>

asp..
Code:
<%
set XMLDoc = Server.CreateObject("Microsoft.XMLDOM")
XMLDoc.async = false
XMLDoc.load("test.xml") 
set states = XMLDoc.getElementsByTagName("State")

n_states = states.length

for i = 0 to n_states-1

Set state = states.item(i)
response.write state.getAttribute("ref")
response.write "<br>"

next
%>

Nothing is printed out in the ASP page even though according to the script i should get "FL IA" printed out. The problem seems to be that its not finding any tages called 'State'. If you print out "response.write n_states", the result is zero. Does anyone know where its going wrong? Thanks.
__________________
"They have the internet on computers now" - Homer

Reply With Quote
  #2  
Old March 8th, 2003, 11:23 PM
moexu moexu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 8 moexu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If your code is exactly as you've written, the problem may be because XML is case-sensitive. Your <state> tag should be all in lower case instead of <State>. XML generally ignores tags it doesn't recognize, so that may be why you're not getting an error message. Hope this helps.
Comments on this post
Gran Roguismo agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > XML getattributes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway