FileDocCategorySizeDatePackage
JAXPTest.javaAPI DocAndroid 1.5 API1968Wed May 06 22:41:42 BST 2009org.ccil.cowan.tagsoup.jaxp

JAXPTest

public class JAXPTest extends Object
Trivial non-robust test class, to show that TagSoup can be accessed using JAXP interface.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        new JAXPTest().test(args);
    
private voidtest(java.lang.String[] args)

        if (args.length != 1) {
            System.err.println("Usage: java "+getClass()+" [input-file]");
            System.exit(1);
        }
        File f = new File(args[0]);
        //System.setProperty("javax.xml.parsers.SAXParserFactory", SAXFactoryImpl.class.toString());
        System.setProperty("javax.xml.parsers.SAXParserFactory", "org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl");

        SAXParserFactory spf = SAXParserFactory.newInstance();
        System.out.println("Ok, SAX factory JAXP creates is: "+spf);
        System.out.println("Let's parse...");
        spf.newSAXParser().parse(f, new org.xml.sax.helpers.DefaultHandler());
        System.out.println("Done. And then DOM build:");

        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(f);

        System.out.println("Succesfully built DOM tree from '"+f+"', -> "+doc);