code: public static DocumentFragment readXMLFragment(InputStream stream, boolean skipRoot) throws IOException,
  			SAXException, ParserConfigurationException {
  		assert stream != null : AssertMessages.notNullParameter();
  		try {
  			final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  			final DocumentBuilder builder = factory.newDocumentBuilder();
  			final Document doc = builder.parse(stream);
  
  			final DocumentFragment fragment = doc.createDocumentFragment();
  			if (skipRoot) {
  				final NodeList root = doc.getChildNodes();
  				if (root.getLength() == 0) {
  					return fragment;
  				}
  				final NodeList children = root.item(0).getChildNodes();
  				final int len = children.getLength();
  				for (int i = 0; i < len; ++i) {
  					fragment.appendChild(children.item(0));
  				}
  			} else {
  				final NodeList children = doc.getChildNodes();
  				final int len = children.getLength();
  				for (int i = 0; i < len; ++i) {
  					fragment.appendChild(children.item(i));
  				}
  			}
  			return fragment;
  		} finally {
  			stream.close();
  		}
  	}
docs: Read an XML fragment from an XML file.
  The XML file is well-formed. It means that the fragment will contains a single element: the root element
  within the input stream.
  
  @param stream is the stream to read
  @param skipRoot if {@code true} the root element itself is not part of the fragment, and the children
  of the root element are directly added within the fragment.
  @return the fragment from the {@code stream}.
  @throws IOException if the stream cannot be read.
  @throws SAXException if the stream does not contains valid XML data.
  @throws ParserConfigurationException if the parser cannot  be configured.