Hi,

    There is no bug in Xerces.
    In this particular case the Node you are looking for has got  TEXT Node
as it's child . In order to get this value you need to call the
getNodeValue() on the Text Node but not on the current Node it self.
    Pls have a look at the Xerces API documentation for the getNodeValue()
method . 
    i have modified your code slightly so that it will print the Text you
are looking for. hope this will help you..

Regards
Sateesh

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 09, 2001 12:34 AM
To: [EMAIL PROTECTED]
Subject: Problems with Xerces (maybe a bug)


Hello!

I've written a small program to parse xml files. It's for a university
project, every xml file has the same structure so please don't wonder why my
code looks so bad ;-)
The problem is that the following if loop doesn't extract the value:
if (node.getNodeName().equals("rdf:li")) {
   Element element = (Element)node;
   if (element.hasAttribute("xml:lang")) {
     System.out.println(node.getNodeValue());
   }
}

When I say node.getNodeName() it tells me the correct Name, but NodeValue()
just tells null. It shouldn't do that.
The part of the xml file looks like this:
<dc:title>
   <rdf:Alt>
      <rdf:li xml:lang="en">Convergence of some two-level overlapping domain
decomposition preconditioners with smoothed aggregation coarse spaces�
      </rdf:li>
   </rdf:Alt>
</dc:title>

Do you have a clue what's wrong with it? Could it be a Xerces bug?
I've attached the full source and the xml file.
Thanks in advance for your help.

Greetings, 
Christian Meyer


"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this 
communication is strictly Prohibited. 
If you have received this message by error, please notify us 
immediately, return the original mail to the sender and delete the 
message from your system."

  

Attachment: DOMTest.java
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to