code: private Document parseText(String text) throws DocumentException {
          Document result;
  
          String encoding = getEncoding(text);
  
          InputSource source = new InputSource(new StringReader(text));
          source.setEncoding(encoding);
  
          result = reader.read(source);
  
          // if the XML parser doesn't provide a way to retrieve the encoding,
          // specify it manually
          if (result.getXMLEncoding() == null) {
              result.setXMLEncoding(encoding);
          }
  
          return result;
      }
docs: 将xml解析为Document
  
  @param text xml文本
  @return Document
  @throws DocumentException DocumentException