Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] need ideas for HTML manipulation

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: Luca Passani <passani AT eunet.no>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] need ideas for HTML manipulation
  • Date: Wed, 4 May 2005 10:41:19 -0700

On May 4, 2005, at 10:28 AM, Luca Passani wrote:


People, I need to do a bit of HTML parsing and manipulation. Originally I was planning to use my old love, Regular Expressions, but TagSoup may, in fact, be a better alternative.
Also, I am not sure which path I should follow.
XOM and XPath? NUX and XQuery?

You could do this in a variety of ways, with XOM or Nux or both. Either way should work fine.


Here are some of the things I would like to do:

<table>
<tr>
<td>A</td>
<td>B</td>
</tr>
</table>

should become:

A
B


XQueryUtil.xquery(doc, "string(/table)").get(0).getValue()

some elements should be removed/detached (possibly depending on the value of some attributes).
Some attributes should be removed for all elements.

Find the attributes/elements to remove with a suitable XPath or XQuery, then do attr.detach() or similar.

Wolfgang.





Archive powered by MHonArc 2.6.24.

Top of Page