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();
}

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 ( ) ; }
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 .
