Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Re: Java and parsing XHTML (luca)

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Hallvard Trætteberg <hal AT idi.ntnu.no>
  • To: "'luca'" <passani AT eunet.no>, <xom-interest AT lists.ibiblio.org>
  • Cc:
  • Subject: [XOM-interest] Re: Java and parsing XHTML (luca)
  • Date: Thu, 9 Sep 2004 19:57:02 +0200

Luca,

> is there any XPath support in XOM so far?

XOM does not support XPath directly, but there is support for XOM
implemented for the Jaxen XPath engine.

> is there a simple way to get a list of "img" elements out
> of my XHTML document? or do I need to traverse
> the whole document myself? What's the most efficient and/or
> less memory intensive way to traverse the document?

If you're only interested in img elements, you needn't build a full
document and traverse it. Using Jaxen/XPath is definitely overkill for
this case. XOM's node factory (don't remember the class name) supports
creating only the nodes you're really interested in, to save space and
time. Implement a custom NodeFactory (?) that only creates and Element
if the name is img.

Hallvard





Archive powered by MHonArc 2.6.24.

Top of Page