Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2003, 10:17 AM
Registered User
 
Join Date: Nov 2003
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);
       }

 
Old November 7th, 2003, 11:13 AM
Friend of Wrox
 
Join Date: Jun 2003
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?

 
Old November 7th, 2003, 12:02 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old November 14th, 2003, 01:29 PM
Registered User
 
Join Date: Nov 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks got it fixed.







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





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