Here you can find the source of createXMLReader(boolean validating, boolean namespaceAware)
Parameter | Description |
---|---|
validating | DOCUMENT ME! |
namespaceAware | DOCUMENT ME! |
Parameter | Description |
---|---|
Exception | DOCUMENT ME! |
public static XMLReader createXMLReader(boolean validating, boolean namespaceAware) throws Exception
//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(); } }