static NodeList getNodes(InputStream stream) throws IOException {

		if (!documentBuilderFactorySet) { // it's really stupid, but we have to do this
			System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
					"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
			documentBuilderFactorySet = true;
		}
		DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = null;
		Document document = null;
		try {
			builder = builderFactory.newDocumentBuilder();
		} catch (ParserConfigurationException e) {
			logger.warn("Couldn't configure parser", e);
			stream.close();
			throw new IOException(e);
		}
		try {
			document = builder.parse(stream);
		} catch (SAXException e) {
			stream.close();
			throw new IOException(e);
		}
		Node root = document.getDocumentElement();
		return root.getChildNodes();
	}
static NodeList getNodes ( InputStream stream ) throws IOException { if ( ! documentBuilderFactorySet ) { System . setProperty ( "javax.xml.parsers.DocumentBuilderFactory" , "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl" ) ; documentBuilderFactorySet = true ; } DocumentBuilderFactory builderFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = null ; Document document = null ; try { builder = builderFactory . newDocumentBuilder ( ) ; } catch ( ParserConfigurationException e ) { logger . warn ( "Couldn't configure parser" , e ) ; stream . close ( ) ; throw new IOException ( e ) ; } try { document = builder . parse ( stream ) ; } catch ( SAXException e ) { stream . close ( ) ; throw new IOException ( e ) ; } Node root = document . getDocumentElement ( ) ; return root . getChildNodes ( ) ; }
@param stream
@return A {@link NodeList} of top-level {@link Node Nodes} in {@code stream}.
@throws IOException