[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Abhishek Srivastava" <abisheks@i...>
  • To: <xml-dev@i...>
  • Date: Thu, 30 Dec 1999 22:37:35 +0530

Hi,

Let me see if I get your problem correctly...

you have an element called
<NAME> James bond </NAME>
and u want to extract the value of name that is "james bond"

First traverse down the DOM tree till u get a node that has the name NAME
 this can be done using getNodeName( )  ).
If u want to get the text what this node contains, do a getFirstChild ( ) on
this node ... this will give u a node that has the
a name "#text" if u call the getNodeValue( ) on this node you will get the
actual content of the element ( james bond )

Basically, the text value of an element is one node below the node that
contains the name of the element.

all the best,
Abhishek.
----- Original Message -----
From: "Lucio Piccoli" <Lucio.Piccoli@o...>
To: <xml-dev@i...>
Sent: Thursday, December 30, 1999 7:53 PM
Subject: Element_node.getValue()


> hi all,
> I am getting very frustreated with the sun XML java parser. I am using the
> DOM. When i retrieve a ELEMENT_NODE, i call getValue() on the node and it
> returns null. Yet when i call toString() i get all the data.
> The element is defined as
>
> <!ELEMENT body (PCDATA) >
>
> How do i get the value from the element?
>
>
> adios
>
> -lucio
>
> ---------------------------------------------------------------------
>  One2One          LUCIO.PICCOLI@o...
>  Elstree Tower tel : +44 181 214 3847
>  Elstree Way
>  Borehamwood              fax :+44 181 214 2325
>  LONDON WD6 1DT
>  __________ http://www.one2one.co.uk _____________
>
>
>
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on
CD-ROM/ISBN 981-02-3594-1
> To unsubscribe, mailto:majordomo@i... the following message;
> unsubscribe xml-dev
> To subscribe to the digests, mailto:majordomo@i... the following
message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@i...)
>
>


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member