private Document parseInputSourceWithFilter ( InputSource s , XMLFilter f ) throws JspException { try { XMLReader xr = XmlUtil . newXMLReader ( entityResolver ) ; // (note that we overwrite the filter's parent. this seems // to be expected usage. we could cache and reset the old // parent, but you can't setParent(null), so this wouldn't // be perfect.) f . setParent ( xr ) ; TransformerHandler th = XmlUtil . newTransformerHandler ( ) ; Document o = XmlUtil . newEmptyDocument ( ) ; th . setResult ( new DOMResult ( o ) ) ; f . setContentHandler ( th ) ; f . parse ( s ) ; return o ; } catch ( IOException e ) { throw new JspException ( e ) ; } catch ( SAXException e ) { throw new JspException ( e ) ; } catch ( TransformerConfigurationException e ) { throw new JspException ( e ) ; } catch ( ParserConfigurationException e ) { throw new JspException ( e ) ; } }
Parses the given InputSource after applying the given XMLFilter .