private Document createDocument(String data) throws Exception {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setCoalescing(true);
      factory.setIgnoringComments(true);
      factory.setIgnoringElementContentWhitespace(true);
      factory.setValidating(false);
      DocumentBuilder builder = factory.newDocumentBuilder();
      StringReader reader = new StringReader(data);
      InputSource inputSource = new InputSource(reader);
      Document doc = builder.parse(inputSource);
      return doc;		
   }