Re: Simple xhtml/entity resolver?
Chris Pratt <[email protected]> Thu, 29 Mar 2012 09:19:00 -0700
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <CAALdY0zs1pBLmAFxCfZHxc0k7bYmKKyAqqPyMvdJW-eWXUrKow@mail.gmail.com> |
Another option I've used in the past is changing the underlying SAX parser that jDOM uses to TagSoup ( http://ccil.org/~cowan/XML/tagsoup/). Their parser is tuned to parsing not fully XML compliant HTML. (*Chris*) On Thu, Mar 29, 2012 at 8:47 AM, Olivier Jaquemet < [email protected]> wrote: > Hi Oliver, > > JDom is a great tool for parsing XML... > > ... but for XHTML fragment (which may not be completely XHTML compliant > ... ?) > and specially for text extraction, I would strongly suggest JSoup > http://jsoup.org/ > > String text = org.jsoup.Jsoup.parse(html).**text(); > > Whatever is your html it will work like a charm (even it is an ugly copy > paste wysiwyg from word or any ugly html export from whatever website) > > Olivier > > > On 29/03/2012 15:23, Oliver Ruebenacker wrote: > >> Hello, >> >> I need a simple way to convert some XHTML fragments, provided as a >> JDOM Element, into plain text. I am willing to ignore most HTML tags >> and consider only the most commonly used predefined entities. >> >> In JDOM, an entity reference has a name, a public id and a system >> id. I think I know what the named means, for named entities. But what >> about numeric entities, how do I get the code point? And what are >> public id and system id? >> >> Thanks! >> >> Take care >> Oliver >> >> > -- > Olivier Jaquemet<olivier.jaquemet@**jalios.com<[email protected]> > > > Ingénieur R&D Jalios S.A. - http://www.jalios.com/ > @OlivierJaquemet +33970461480 > > > > ______________________________**_________________ > To control your jdom-interest membership: > http://www.jdom.org/mailman/**options/jdom-interest/** > [email protected]<http://www.jdom.org/mailman/options/jdom-interest/[email protected]> > _______________________________________________ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/[email protected]