Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 7th, 2003, 10:17 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Xml Dcument not loading

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="Javascript">
     var xmlDoc = new ActiveXObject("MICROSOFT.XMLDOM");
Hi folks, I need some helpgetting started.
I have a xml document called test.
I want to load the document and pickoff the node values.
Well, I am having trouble getting started here.
And I don't know if I do not have something a such as a project reference loaded in my project (I am using Visual InteDev Studio)
or just plain missing something. To the best of my knowledge the
document name is test.xml
It is not loading into the xmlDoc variable
when I display it with the alert(xmlDoc), I just have [object]
As I understand it,it should have displayed the document.
So that tells me it isn't loading the document.
The xml document is is using xml verision 1.0
Could someone please tell me what I am doing wrong?

<HTML>
<HEAD><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="Javascript">
     var xmlDoc = new ActiveXObject("MICROSOFT.XMLDOM");
     xmlDoc.async = false;
     xmlDoc.loadXML("Test.xml");
     alert(xmlDoc);
     var EventName = "n/a";
     if (xmlDoc.documentElement !=null && xmlDoc.documentElement.FirstChild !=null)
       {
        var Root = XMLDoc.documentElement;

         oNodeList = xmlDoc.documentElement.firstChild.nodeName;
         alert(oNodeList.item(1).firstchild.nodevalue);
       }
         alert(oNodeList.item(1).firstchild.nodevalue);
       }

Reply With Quote
  #2 (permalink)  
Old November 7th, 2003, 11:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

I think it should display [object]...
If you remove the alert(xmlDoc)-line, then what happens?

Reply With Quote
  #3 (permalink)  
Old November 7th, 2003, 12:02 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Jonax is correct, alert(xmlDoc.xml) is also good. Don't use progid "MICROSOFT.XMLDOM", it's unreliable. Use version 3 or 4 if you can - "Msxml2.DomDocument.3.0" or "Msxml2.DomDocument.4.0".

Joe (MVP - xml)
Reply With Quote
  #4 (permalink)  
Old November 14th, 2003, 01:29 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks got it fixed.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in loading XML. nikhil_vaghela XML 3 May 15th, 2008 08:19 AM
Loading XML files in XSLT newbieboobers XSLT 2 March 12th, 2008 11:42 AM
loading XML Documents in IFrame in IE 5.0 anil_tiwari Javascript 1 February 2nd, 2006 08:01 PM
Loading XML from internet on ASP page Rustam_pascal XML 0 March 2nd, 2005 07:49 AM
Navigate XML when loading with Javascript. awetch XML 1 February 24th, 2005 03:56 AM



All times are GMT -4. The time now is 05:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.