/** * Parses the instance data provided. This method assumes that the XML document is fully * described using XML Schemas. Failure to be fully described as Schemas will result in errors, * as opposed to a vid parse. * * @param is * @param hints May be null. * @param level * @return Object * @throws SAXException * @see DocumentFactory#getInstance(InputStream, Map, Level, boolean) */ public static Object getInstance(InputStream is, Map<String, Object> hints, Level level) throws SAXException { SAXParser parser = getParser(hints); XMLSAXHandler xmlContentHandler = new XMLSAXHandler(hints); XMLSAXHandler.setLogLevel(level); try { parser.parse(is, xmlContentHandler); } catch (IOException e) { XMLSAXHandler.logger.warning(e.toString()); throw new SAXException(e); } return xmlContentHandler.getDocument(); }
/** * Parses the instance data provided. This method assumes that the XML document is fully * described using XML Schemas. Failure to be fully described as Schemas will result in errors, * as opposed to a vid parse. * * @param desiredDocument * @param hints May be null. * @param level * @return Object * @throws SAXException * @see DocumentFactory#getInstance(URI, Map, Level, boolean) */ public static Object getInstance( URI desiredDocument, @SuppressWarnings("rawtypes") Map hints, Level level) throws SAXException { @SuppressWarnings("unchecked") SAXParser parser = getParser(hints); XMLSAXHandler xmlContentHandler = new XMLSAXHandler(desiredDocument, hints); XMLSAXHandler.setLogLevel(level); try { parser.parse(desiredDocument.toString(), xmlContentHandler); } catch (IOException e) { throw new SAXException(e); } return xmlContentHandler.getDocument(); }