Java XML Namespace createXMLReader(boolean validating, boolean namespaceAware)

Here you can find the source of createXMLReader(boolean validating, boolean namespaceAware)

Description

This method attempts to use JAXP to locate the SAX2 XMLReader implementation.

License

Open Source License

Parameter

Parameter Description
validating DOCUMENT ME!
namespaceAware DOCUMENT ME!

Exception

Parameter Description
Exception DOCUMENT ME!

Return

DOCUMENT ME!

Declaration

public static XMLReader createXMLReader(boolean validating, boolean namespaceAware) throws Exception 

Method Source Code

//package com.java2s;
/*/* ww w . j a  v a  2 s .c o m*/
 * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
 * This software is open source.
 * See the bottom of this file for the licence.
 */

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.XMLReader;

public class Main {
    /**
     * This method attempts to use JAXP to locate the SAX2 XMLReader
     * implementation. This method uses reflection to avoid being dependent
     * directly on the JAXP classes.
     *
     * @param validating DOCUMENT ME!
     * @param namespaceAware DOCUMENT ME!
     * @return DOCUMENT ME!
     * @throws Exception DOCUMENT ME!
     */
    public static XMLReader createXMLReader(boolean validating, boolean namespaceAware) throws Exception {
        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setValidating(validating);
        factory.setNamespaceAware(namespaceAware);

        SAXParser parser = factory.newSAXParser();

        return parser.getXMLReader();
    }
}

Related

  1. compile(String expression, NamespaceContext namespaceContext)
  2. createNamespaceContext(final String nsPrefix, final String nsUri)
  3. createXMLReader(boolean validating, boolean withNamespace)
  4. getBaseNamespace(InputStream owlStream)
  5. getBuilder(boolean ignoreComments, boolean validating, boolean ignoreContentWhitespace, boolean isNamespaceAware)
  6. getCarbonNamespace()