Code example for InputSource

Methods: setSystemId

0
            + "]>\n" 
            + "<foo>&bar;</foo>"); 
        ExpatReader reader = new ExpatReader();
        Handler handler = new Handler();
        reader.setContentHandler(handler);
        reader.setEntityResolver(handler);
        InputSource source = new InputSource(in);
        source.setSystemId(server.getUrl("/systemFoo").toString());
        reader.parse(source);
        assertEquals(Arrays.asList("foo", "bar", "/bar", "/foo"), handler.elementNames);
        } finally { server.shutdown(); }
    } 
 
    /** 
     * Parses the given xml string and fires events on the given SAX handler. 
     */ 
    private static void parse(String xml, ContentHandler contentHandler)
            throws SAXException { 
        try { 
            XMLReader reader = new ExpatReader();
            reader.setContentHandler(contentHandler);