<tt>Document.getElementById()</tt> gives me a null <tt>Element</tt>, Why??
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sergio_Ramos
Posted On:   Tuesday, March 26, 2002 08:53 PM

El Gourmet de Microondas Hi, Im using Document.getElementById() from DOM . My problem is that I only recieve null Elements . My code is more or less: DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse( new File(argv[0]) ); Element el = document.getElementById("id1"); Im using an XML file like this: <?xml version='1.0' encoding='utf-8'?> <!ELEMENT book (#PCDATA)> <!ATTLIST book at ID #REQUIRED> ]> Haqui    More>>
El Gourmet de Microondas

Hi, Im using Document.getElementById() from DOM . My problem is that I only recieve null Elements . My code is more or less:


			

DocumentBuilder builder = factory.newDocumentBuilder();

document = builder.parse( new File(argv[0]) );

Element el = document.getElementById("id1");



Im using an XML file like this:


			

<?xml version='1.0' encoding='utf-8'?>



<!ELEMENT book (#PCDATA)>

<!ATTLIST book at ID #REQUIRED>

]>









Haqui






Alguien quiere Sushi?

Addison Wesley







can someone help me??, Thanks in advance

   <<Less

Re: <tt>Document.getElementById()</tt> gives me a null <tt>Element</tt>, Why??

Posted By:   devaki_perumal  
Posted On:   Tuesday, March 26, 2002 09:49 PM

there is no book element with id id1.so null is returned .try this with
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse( new File(argv[0]) );
Element el = document.getElementById("rrr");
the first Book element will be returned.
About | Sitemap | Contact