Internet Products
cancel
Showing results for 
Search instead for 
Did you mean: 

HTML / XML Parsing

 
ANAND_35
Advisor

HTML / XML Parsing

I am not too sure (again) if this is the right place to place this question. Suggestion of proper category will be appreciated.

1. Referring to w3schools' website(
http://www.w3schools.com/dom/tryit.asp?filename=note_parsertest ) This works in this page itself but if i test this exact code saved as .html file in my computer, it deosn't work.

2. Below is a line of code which I have found being used to Parse XML codes.

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("xyz.xml");

My aim is to load HTML file (not the currently being used one) and use it to change/add objects to the loaded html file using DOM properties (document.body.parentnode.childnode.value e.t.c.)The above code line does not work for HTMLs
So, the question is that, why does the exact code saved in my computer wouldn't work?
What should I do to load an html file instead of xml file?

Thanks in advance
Anand
3 REPLIES 3
Jasdev Singh
Esteemed Contributor

Re: HTML / XML Parsing

Hi Anand,

Sorry for anwering this post very late, but as i am the new user of this forum so might help this post...

when you copy the contents and when you look at the code xmlDoc.load("note.xml")
you chnange the code to
xmlDoc.load("http://www.w3schools.com/dom/note.xml") and then save your html file and then you open the page.

it opens...

jasdev

Ganesha Sridhara
Honored Contributor

Re: HTML / XML Parsing

Hello Anand,

The avobe given steps worked perfectly in my machine.

-------------- note.xml ------------------

Ganesha

---------------------------------------

In the browser (IE) following output is displayed:
The first child element in the file contains: Ganesha

The Msxml.dll file is present in your system or not.

Please download the Microsoft.XMLDOM:
http://www.microsoft.com/downloads/details.aspx?FamilyID=3144B72B-B4F2-46DA-B4B6-C5D7485F2B42&displaylang=en

HTH

Regards
Ganesha Sridhara

Jasdev Singh
Esteemed Contributor

Re: HTML / XML Parsing

Hi Ganesha Sridhara,

assigning points to this post be appriciated...

thank you,

jasdev