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: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Re: Java and parsing XHTML (luca)
  • Date: Fri, 10 Sep 2004 17:06:20 -0700

Hallvard Trætteberg wrote:


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.




Now why didn't I think of that? You wouldn't even have to build most of
the document, and the parse would do the traversal for you. This should
be much faster and more efficient than using XPath.

--
Elliotte


And if one would have the document already in memory (e.g. because it has been given to us from some other library) and wanted to do such node factory filtering, one might want a way to pipe a document through a builder, using the appropriate node factory. BTW, it appears that this is the same underlying mechanism that would also enable in-memory validation in a correct, convenient, effective way, requiring minimum API complexity.





Archive powered by MHonArc 2.6.24.

Top of Page