[jdom-interest] JDOM and text outside tags

Dave Bartmess dingodave at edingo.net
Wed Oct 29 09:24:10 PST 2003


Try this:

Element smallelem = getChildElement("SMALL");
java.util.List imgelem = getChildElements("IMG");
for (int i = 0; i < imgelem.size(); i++) {
	String imgtext = ((Element)imgelem.get(i)).getText();
	// Process imgtext
}

On Wed, 2003-10-22 at 19:47, Jacques-Albert De Blasio wrote:
> Hi again,
> 
> I would like to add that I tried to simply use the getText() method on 
> the <SMALL> element and it works... but the text returned becomes 
> "some_textsome_other_text". Is there any way to fetch those two strings 
> one after the other?
> 
> Regards,
> 
> Jack
> 
> Jacques-Albert De Blasio wrote:
> 
> > Hi all,
> >
> > I have a problem with JDOM and I am sure that one of you JDOM guru 
> > could help me out :)
> >
> > In a program I'm writing, I first fetch HTML pages on the web, tidy 
> > them with NekoHTML (JTidy was not sufficient as it could not parse 
> > japanese html pages) and then transform the DOM outputed by NekoHTML 
> > into JDOM documents.
> >
> > My problem is the following: in a given page, I have tags such as
> >
> > <TD>
> > <SMALL>
> > <IMG src = "..." /> some_text <BR />
> > <IMG src =" ..." /> some_other_text <BR />
> > </SMALL>
> > </TD>
> >
> > How can I fetch the "some_text" and "some_other_text" ?
> >
> > Thank you very much for your help,
> >
> > Jack
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> >
> >
> >
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
-- 
David A. Bartmess
Software Configuration Manager / Sr. Software Developer
eDingo Enterprises
http://edingo.net




More information about the jdom-interest mailing list