bundles/org.apache.jasper.glassfish/src/org/apache/jasper/xmlparser/ParserUtils.java
public TreeNode parseXMLDocument(String uri, InputSource is,
                                     boolean validate)
            throws JasperException {

        Document document = null;

        // Perform an XML parse of this document, via JAXP

        // START 6412405
        ClassLoader currentLoader =
            Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(
            getClass().getClassLoader());
        // END 6412405
        try {
            DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            /* See CR 6399139
            factory.setFeature(
                "http://apache.org/xml/features/validation/dynamic",
                true);
            */
            DocumentBuilder builder = factory.newDocumentBuilder();
            builder.setEntityResolver(entityResolver);
            builder.setErrorHandler(errorHandler);
            document = builder.parse(is);
            document.setDocumentURI(uri);
            if (validate) {
                Schema schema = getSchema(document);
                if (schema != null) {
                    // Validate TLD against specified schema
                    schema.newValidator().validate(new DOMSource(document));
                }
                /* See CR 6399139
                else {
                    log.warning(Localizer.getMessage(
                        "jsp.warning.dtdValidationNotSupported"));
                }
                */
            }
	} catch (ParserConfigurationException ex) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), ex);
	} catch (SAXParseException ex) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml.line",
				      uri,
				      Integer.toString(ex.getLineNumber()),
				      Integer.toString(ex.getColumnNumber())),
		 ex);
	} catch (SAXException sx) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), sx);
        } catch (IOException io) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), io);
        // START 6412405
        } finally {
            Thread.currentThread().setContextClassLoader(currentLoader);
        }
        // END 6412405

        // Convert the resulting document to a graph of TreeNodes
        return (convert(null, document.getDocumentElement()));
    }
public TreeNode parseXMLDocument(String uri, InputSource is,
                                     boolean validate)
            throws JasperException {

        Document document = null;

        // Perform an XML parse of this document, via JAXP

        // START 6412405
        ClassLoader currentLoader =
            Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(
            getClass().getClassLoader());
        // END 6412405
        try {
            DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            /* See CR 6399139
            factory.setFeature(
                "http://apache.org/xml/features/validation/dynamic",
                true);
            */
            DocumentBuilder builder = factory.newDocumentBuilder();
            builder.setEntityResolver(entityResolver);
            builder.setErrorHandler(errorHandler);
            document = builder.parse(is);
            document.setDocumentURI(uri);
            if (validate) {
                Schema schema = getSchema(document);
                if (schema != null) {
                    // Validate TLD against specified schema
                    schema.newValidator().validate(new DOMSource(document));
                }
                /* See CR 6399139
                else {
                    log.warning(Localizer.getMessage(
                        "jsp.warning.dtdValidationNotSupported"));
                }
                */
            }
	} catch (ParserConfigurationException ex) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), ex);
	} catch (SAXParseException ex) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml.line",
				      uri,
				      Integer.toString(ex.getLineNumber()),
				      Integer.toString(ex.getColumnNumber())),
		 ex);
	} catch (SAXException sx) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), sx);
        } catch (IOException io) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), io);
        // START 6412405
        } finally {
            Thread.currentThread().setContextClassLoader(currentLoader);
        }
        // END 6412405

        // Convert the resulting document to a graph of TreeNodes
        return (convert(null, document.getDocumentElement()));
    }
public TreeNode parseXMLDocument ( String uri , InputSource is , boolean validate ) throws JasperException { Document document = null ; // Perform an XML parse of this document, via JAXP // START 6412405 ClassLoader currentLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Thread . currentThread ( ) . setContextClassLoader ( getClass ( ) . getClassLoader ( ) ) ; // END 6412405 try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; /* See CR 6399139
            factory.setFeature(
                "http://apache.org/xml/features/validation/dynamic",
                true);
            */ DocumentBuilder builder = factory . newDocumentBuilder ( ) ; builder . setEntityResolver ( entityResolver ) ; builder . setErrorHandler ( errorHandler ) ; document = builder . parse ( is ) ; document . setDocumentURI ( uri ) ; if ( validate ) { Schema schema = getSchema ( document ) ; if ( schema != null ) { // Validate TLD against specified schema schema . newValidator ( ) . validate ( new DOMSource ( document ) ) ; } /* See CR 6399139
                else {
                    log.warning(Localizer.getMessage(
                        "jsp.warning.dtdValidationNotSupported"));
                }
                */ } } catch ( ParserConfigurationException ex ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml" , uri ) , ex ) ; } catch ( SAXParseException ex ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml.line" , uri , Integer . toString ( ex . getLineNumber ( ) ) , Integer . toString ( ex . getColumnNumber ( ) ) ) , ex ) ; } catch ( SAXException sx ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml" , uri ) , sx ) ; } catch ( IOException io ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml" , uri ) , io ) ; // START 6412405 } finally { Thread . currentThread ( ) . setContextClassLoader ( currentLoader ) ; } // END 6412405 // Convert the resulting document to a graph of TreeNodes return ( convert ( null , document . getDocumentElement ( ) ) ) ; }
Parse the specified XML document, and return a <code>TreeNode</code>
that corresponds to the root node of the document tree.

@param uri URI of the XML document being parsed
@param is Input source containing the deployment descriptor
@param validate true if the XML document needs to be validated against
its DTD or schema, false otherwise

@exception JasperException if an I/O or parsing error has occurred
Parse the specified XML document and return a <code > TreeNode< / code > that corresponds to the root node of the document tree .