Element_node.getValue()

Abhishek Srivastava abisheks at india.hp.com
Thu Dec 30 17:08:36 GMT 1999


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 at one2one.co.uk>
To: <xml-dev at ic.ac.uk>
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 at one2one.co.uk
>  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 at ic.ac.uk
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on
CD-ROM/ISBN 981-02-3594-1
> To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
> unsubscribe xml-dev
> To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
>
>


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





More information about the Xml-dev mailing list