[jdom-interest] question on how to retrieve text/content

Harry Evans harry at moviso.com
Wed Sep 25 19:16:35 PDT 2002

question on how to retrieve text/contentYou can't get the "<nl/>" as text,
because xml will parse them as Elements, while "A" "B" and "C" are parsed as
What you are asking for is the String rendering of the content of an element
as a accessor method, which I don't think is directly supported in JDOM.

To make the "<nl/>" elements just be part of the child text of the element,
the original xml doc would have to look something like:
Otherwise, the parser will recognize "<nl/>" as an empty element, and make a
JDOM Element object out of it.

Also, you can't get "A B C" becuase there are no spaces in the original
document between the "<nl/>" elements, so no spaces are put into the child
text, as this would be an incorrect parsing of the xml.

  -----Original Message-----
  From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of Charlie Wu
  Sent: Wednesday, September 25, 2002 1:32 PM
  To: 'jdom-interest at jdom.org'
  Subject: [jdom-interest] question on how to retrieve text/content

  Hi all:

  If I have an xml element in the following format:


  Which API function can retrieve "A<nl/>B<nl/>C" as a string? I tried
getText(), getTextNormalize() but they always return "ABC".. instead I
wanted "A B C" or "A<nl/>B<nl/>C".. I guess I could do a getContent and then
process every item on the list.. but it seems quite tedious..

  Any suggestions out there?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020925/d59e1700/attachment.htm

More information about the jdom-interest mailing list