Java Tutorial - Java Script :
These three sample applications cover the core features of the main XOM package and are representative of its straightforward approach to XML processing. There also are smaller nu.xom.canonical, nu.xom.converters, nu.xom.xinclude, and nu.xom.xslt packages to support XInclude, XSLT, canonical XML serialization, and conversions between the XOM model for XML and the one used by DOM and SAX.
Listing 19.7 contains an application that works with XML from a dynamic source: RSS feeds of recently updated web content from the producer of the feed. The RssFilter application searches the feed for specified text in headlines, producing a new XML document that contains only the matching items and shorter indentation. It also modifies the feed’s title and adds an RSS 0.91 document type declaration if one is needed in an RSS 0.91 format feed.
One feed that can be used to test the application is the one from the Toronto Star newspaper. The following command searches it for items with titles that mention the word “snow”:
java RssFilter http://www.thestar.com/rss/000-082-672?searchMode=Lineup snow
Comments in the application’s source code describe its functionality.XOM’s design is strongly informed by one overriding principle: enforced simplicity. On the website for the class library, Harold states that XOM “should help inexperienced developers do the right thing and keep them from doing the wrong thing. The learning curve needs to be really shallow, and that includes not relying on best practices that are known in the community but are not obvious at first glance.” The new class library is useful for Java programmers whose Java programs require asteady diet of XML.