<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>question on how to retrieve text/content</TITLE>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff size=2>You
can't get the "<nl/>" as text, because xml will parse them as Elements,
while "A" "B" and "C" are parsed as text.</FONT></SPAN></DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff size=2>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:</FONT></SPAN></DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff
size=2><competitors>A&lt;nl/&gt;B&lt;nl/&gt;C</competitors></FONT></SPAN></DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff
size=2>Otherwise, the parser will recognize "<nl/>" as an empty element,
and make a JDOM Element object out of it.</FONT></SPAN></DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=455370202-26092002><FONT face=Arial color=#0000ff
size=2>Harry</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> jdom-interest-admin@jdom.org
[mailto:jdom-interest-admin@jdom.org]<B>On Behalf Of </B>Charlie
Wu<BR><B>Sent:</B> Wednesday, September 25, 2002 1:32 PM<BR><B>To:</B>
'jdom-interest@jdom.org'<BR><B>Subject:</B> [jdom-interest] question on how to
retrieve text/content<BR><BR></FONT></DIV>
<P><FONT face=Arial size=2>Hi all:</FONT> </P>
<P><FONT face=Arial size=2>If I have an xml element in the following
format:</FONT> </P>
<P><FONT face=Arial
size=2><competitors>A<nl/>B<nl/>C</competitors></FONT>
</P>
<P><FONT face=Arial size=2>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.. </FONT></P>
<P><FONT face=Arial size=2>Any suggestions out there?</FONT> </P>
<P><FONT face=Arial size=2>Thanks</FONT> </P>
<P><FONT face=Arial size=2>Charlie</FONT> </P></BLOCKQUOTE></BODY></HTML>