private Document parseBytesToDocument ( String pid , byte [ ] bytes ) throws InvalidContentModelException { try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( new ByteArrayInputStream ( bytes ) ) ; } catch ( ParserConfigurationException e ) { throw new InvalidContentModelException ( pid , "Failed to parse " + DS_COMPOSITE_MODEL , e ) ; } catch ( SAXException e ) { throw new InvalidContentModelException ( pid , "Failed to parse " + DS_COMPOSITE_MODEL , e ) ; } catch ( IOException e ) { throw new InvalidContentModelException ( pid , "Failed to parse " + DS_COMPOSITE_MODEL , e ) ; } }
Create a DOM document from the original XML .