Ruby libraries like hpricot are showing how efficient one can work without thousands of libraries to deal with. I would say there must be something about usability of libraries for developer out there...
That is why I glued some libraries (JDom, TagSoup and Jaxen) together to serve you a lightweight facade, named Japricot, for simple XML, HTML and XSL processing.
Here are three examples, which shows how clean you can even work with Java on this topic (using the libraries directly would cause serveral hundreds of lines of code)
public static void printHTML() { Japricot japricot=new Japricot(); JapEntity ent=japricot.openURL("http://www.neotos.de"); } public static void useXpath() { Japricot japricot=new Japricot(); JapEntity e= japricot.openURL("http://www.flickr.com/people/22056204@N06/"); List<JapEntity> e2= e.doXPathQuery("//span[@class='nickname']"); } public static void useXSL() { String xsl= "<xsl:stylesheet version=\"1.0\" "+ "xmlns:def=\"http://www.w3.org/1999/xhtml\" "+ "xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" > "+ "<xsl:template match=\"/html/body\">"+ "<xsl:value-of select=\"descendant::*/.\"></xsl:value-of>"+ "</xsl:template>"+ "</xsl:stylesheet>"; Japricot japricot=new Japricot(); JapEntity ent=japricot.openURL("http://www.neotos.de").doXSLTransformation(xsl); //if result is not a parsable xml output, it will be stick into a cdata block }
Note that you can always grab the jdom-Objects (Element/Node) directly from the JapEntity, this class is just for comfort.
License
This project is available under GPL
History
[Version 0.2]
Initial Alpha-Version
[Version 0.3]
Some bugfixes
| Attachment | Date | Size |
|---|---|---|
| 18/04/09 3:34 pm | 809.23 KB |