[From nobody Fri Aug 6 17:05:26 2004 X-Mozilla-Status2: 00000000 Message-ID: <3A3E8C26.FF996D6B@collab.net> Date: Mon, 18 Dec 2000 14:13:58 -0800 From: Jason Hunter <jhunter@collab.net> X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Masaki Itagaki <mitagaki@uswest.net> CC: jdom-interest@jdom.org Subject: Re: [jdom-interest] When a text contains HTML-tagged info... References: <DFEDJGONLEEHIKMIALJMCEBACNAA.mitagaki@uswest.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Masaki Itagaki wrote: > > I'm trying to handle an Element that contains HMTL-tagged text as follows: > > <section> > <txt> <A href="a.txt">This is a <B>sample</B> text!</A> </txt> > <loc> Line 5 </loc> > </section> > > If I get a text with getText() for the [txt] element -- like > ((Element)obj).getChild("txt").getText() --, it returns only... > > This is a sample text! I think more likely it returns "This is a text!" If it returns what you claim, then it's a bug. <b> is a child of <a> and doesn't have its text included. (Hey, no one said holding HTML in XML was easy.) > If I wish to get [<A href="a.txt">This is a <B>sample</B> text!</A>] as a > whole, is there any simple approach to do that? In using getMixedContents, > it's extremely clumsy to obtain also attribute information pieces. Look at XMLOutputter outputElementContent(). That's what it's meant to do. You might find a bug tho. I remember Alex Chaffee who wrote the method griped about something not being 100% right. Alex? -jh- ]