Examples of newDocumentBuilder()


Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

       
        @Override
        public void run() {
            try {
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                DocumentBuilder db = dbf.newDocumentBuilder();
                FileInputStream fis = new FileInputStream(file);
                Document document = db.parse(fis);
               
                Element eTop = document.getDocumentElement();
               
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

     */
    protected DomMapperBase() throws JiBXException {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        try {
            m_document = dbf.newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException e) {
            throw new JiBXException("Unable to create DOM document", e);
        }
    }
   
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

   */
  public static Document parseInputStream(final InputStream instream)
      throws ParserConfigurationException, SAXException, IOException
  {
    final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    final DocumentBuilder db = dbf.newDocumentBuilder();
    return db.parse(new InputSource(instream));
  }

  /**
   * extracts all text-elements of a particular element and returns an single string containing the contents of all
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

      fout.close();
     
      //修改配置的配置文件,在其中增加sqlMap元素
      DocumentBuilderFactory factory = DocumentBuilderFactory
      .newInstance();
      DocumentBuilder ibatisConfigBuilder = factory.newDocumentBuilder();
      InputStream inputStream = Resources.getResourceAsStream("SqlMapConfig.xml");
      Document doc = ibatisConfigBuilder.parse(inputStream);
     
      NodeList sqlMapElem = doc.getElementsByTagName("sqlMapConfig");
     
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

     * Constructor.
     */
    public DocumentFormatter() {
        try {
            DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
            m_document = fact.newDocumentBuilder().newDocument();
        } catch (Exception e) {
            throw new RuntimeException("Internal error: unable to create DOM builder", e);
        }
    }
   
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

        try {
           
            // create the document used for all schemas
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            m_document = dbf.newDocumentBuilder().newDocument();
           
        } catch (ParserConfigurationException e) {
            throw new IllegalStateException("Parser configuration error " +
                e.getMessage());
        } catch (FactoryConfigurationError e) {
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        dbf.setExpandEntityReferences(true);
        final Document doc;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(is);
        } catch (Exception e) {
            throw new IllegalStateException("buildDocument failed", e);
        }
        return doc;
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

        return fields;
    }   
   
    private Document read(File file) throws Exception {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        FileInputStream bis = new FileInputStream(file);
        return db.parse(bis);
    }
}
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

     * @throws InvalidModuleXmlException
     */
    private void initialize(byte[] xml) throws InvalidModuleXmlException {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            ByteArrayInputStream bis = new ByteArrayInputStream(xml);
            document = db.parse(bis);
            load();
        } catch(Exception e) {
            throw new InvalidModuleXmlException(getName(), e);
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

        dbf.setNamespaceAware(true);
        dbf.setExpandEntityReferences(true);
        String input = "<doc>" + frag + "</doc>";
        final Document doc;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(new ByteArrayInputStream(input.getBytes("UTF-8")));
        } catch (Exception e) {
            throw new IllegalStateException("buildDocument failed", e);
        }
        return doc;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.