logo       

Re: Please help: Would like to query an XML document in Netscape 7.1: msg#00013

Subject: Re: Please help: Would like to query an XML document in Netscape 7.1
I had the same problem, but i still testing on netscape/mozilla.
e.g.

inhoud = document.implementation.createDocument("", "inhoud", null);
inhoud.addEventListener("load", documentLoaded, false);
inhoud.load("index.xml");

function documentLoaded()
{
var berichten = inhoud.getElementsByTagName("pagina")[0];
var  topic = berichten.getElementsByTagName("bericht")[0];
  var zoek = topic.getElementsByTagName("inhoud")[0].firstChild.data;
...

}

(for this xml example)

<?xml version="1.0" encoding="iso-8859-1"?>
<bron>
<pagina>
   <bericht>
    <inhoud>blah</inhoud>
  </bericht>
</pagina>
</bron>

"ptc1" <ptc1@xxxxxxxxxxxxx> schreef in bericht
news:pan.2003.12.09.22.23.25.722329@xxxxxxxxxxxxxxxx
> Could someone provide a very simple example on how
> to do queries on an XML document in Netscape?  I have
> some sample code which allegedly works for IE:
>
> ======================================
>
> <script language = "JavaScript">
> var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
> xmlDoc.async="false";
> xmlDoc.load("periodic-table.xml" );
>
> document.write("<p>root node of the document is: ");
> var root = xmlDoc.documentElement;
> document.write("<em>", root.nodeName, "</em></p>");
>
> document.write("<p>first child of root node is: ");
> var curNode = root.firstChild;
> document.write("<em>", curNode.nodeName, "</em></p>");
>
> document.write("<p>first child of this node is: ");
> curNode = curNode.firstChild;
> document.write("<em>", curNode.nodeName, "</em></p>");
>
> document.write("<p>next sibling of this node is: ");
> var nextSib = curNode.nextSibling;
> document.write("<em>", nextSib.nodeName, "</em></p>");
>
> document.write("<p>parent node of ");
> document.write("<em>", nextSib.nodeName, "</em> is: ");
> document.write("<em>", nextSib.parentNode.nodeName, "</em></p>");
>
> ========================================
>
> But this wont work in Netscape, as I get 'ActiveXObject not defined'
> errors.  I've also tried GeckoActiveXObject, but I get a similar error.
>
> How would I implement the above code so it works in Netscape 7.1.
> All I want to do is query a local XML file.
>
> thanks in advance for any help,
> -ptc1


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe