OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Element_node.getValue()

[ Lists Home | Date Index | Thread Index ]
  • From: "Michael Champion" <mike.champion@softwareag-usa.com>
  • To: <xml-dev@ic.ac.uk>
  • Date: Thu, 30 Dec 1999 10:54:00 -0500


----- Original Message -----
From: "Lucio Piccoli" <Lucio.Piccoli@one2one.co.uk>
To: <xml-dev@ic.ac.uk>
Sent: Thursday, December 30, 1999 9:23 AM
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?

Blame the DOM working group (to which I must confess membership), not Sun.
The value() of an Element is always null according to the DOM spec.  The
standard way to get the value of an element is to get the child Text node
and get its value.  Most DOM implementations have some sort of convenience
method to get the text value of a single element ... but sometimes you have
to get the text of the entire subtree under the element (which is apparently
what Sun's toString() method is doing).

In the DOM WG's defense, it is *exactly* this reason for making the value()
of an Element null -- Should it return the value of the entire subtree?
Should the text come back with markup embedded or not?  There was no
consensus as to the best way to do it, so we essentially punted.


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@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@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS