Examples of DocumentBuilderFactory


Examples of javax.xml.parsers.DocumentBuilderFactory

        return true;
    }
   
    private Element parse(InputSource source) {
        try {
            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
            builderFactory.setNamespaceAware(true);
            builderFactory.setValidating(false);
            DocumentBuilder builder = builderFactory.newDocumentBuilder();
            builder.setErrorHandler(new ErrorHandler() {
                    public void error(SAXParseException e)
                        throws SAXParseException {
                        throw e;
                    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

    private List<HandlerChainType> chains;

    HandlerChainDocument(InputStream is, boolean doValidate) {
        chains = new ArrayList<HandlerChainType>();
        try {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(false);
            DocumentBuilder builder = dbf.newDocumentBuilder();
            Document srcDoc = builder.parse(is);
            dbf.setNamespaceAware(true);
            Document destDoc = builder.newDocument();
            transform(srcDoc, destDoc);

            NodeList chainNodes = destDoc.getFirstChild().getChildNodes();
            for (int i = 0; i < chainNodes.getLength(); i++) {
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

        // Complete
    }
   
    private DocumentBuilder getDocBuilder() throws ParserConfigurationException {
       
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        return dbf.newDocumentBuilder();
       
    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

    */
   private Document getDocument(String xml) throws XmlBlasterException {
      try {  
         java.io.StringReader reader = new java.io.StringReader(xml);
         InputSource input = new InputSource(reader);
         DocumentBuilderFactory factory = glob.getDocumentBuilderFactory();
         DocumentBuilder builder = factory.newDocumentBuilder ();
         return builder.parse(input)
      } catch (org.xml.sax.SAXException ex) {
         String reason = ex.getMessage();
         if(ex instanceof org.xml.sax.SAXParseException) {
            org.xml.sax.SAXParseException s = (org.xml.sax.SAXParseException)ex;
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

                   "<xmlBlaster></xmlBlaster>";
      java.io.StringReader reader = new java.io.StringReader(xml);
      org.xml.sax.InputSource input = new org.xml.sax.InputSource(reader);

      try {
         DocumentBuilderFactory dbf = requestBroker.getServerScope().getDocumentBuilderFactory();
         //dbf.setNamespaceAware(true);
         //dbf.setCoalescing(true);
         //dbf.setValidating(false);
         //dbf.setIgnoringComments(true);
         DocumentBuilder db = dbf.newDocumentBuilder ();
         xmlKeyDoc = db.parse(input);
      } catch (Exception e) {
         log.severe("Problems when building DOM tree from your XmlKey: " + e.toString());
         throw new XmlBlasterException(serverScope, ErrorCode.INTERNAL_ILLEGALSTATE, ME, "Problems when building DOM tree from your XmlKey: " + e.toString());
      }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

      //input.setEncoding("UTF-8");
      //input.setEncoding("ISO-8859-2");
      //input.setSystemId("9999999999");

      try {
         DocumentBuilderFactory dbf = glob.getDocumentBuilderFactory();
         DocumentBuilder db = dbf.newDocumentBuilder();
         Document xmlDoc = db.parse(input);
        
         ByteArrayOutputStream out = XmlNotPortable.writeNode(xmlDoc.getDocumentElement());
         String response = new String(out.toByteArray());
         log.info(response);
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

        }

        InputStream ins = servletConfig.getServletContext()
            .getResourceAsStream("/WEB-INF/celtix-servlet.xml");
        if (ins != null) {
            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
            builderFactory.setNamespaceAware(true);
            builderFactory.setValidating(false);
           
           
            try {
                Document doc = builderFactory.newDocumentBuilder().parse(ins);
                Node nd = doc.getDocumentElement().getFirstChild();
                while (nd != null) {
                    if ("endpoint".equals(nd.getLocalName())) {
                        loadEndpoint(servletConfig, nd);
                    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

  }

  private static DocumentBuilder createBuilder()
    throws ParserConfigurationException
  {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    return factory.newDocumentBuilder();
  }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

     * @throws SAXException
     */
    private Document urlToDocument(String url)
        throws Exception
    {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        builder.setEntityResolver(new XslTransformerEntityResolver(url));
        return builder.parse(new InputSource(url));
    }
View Full Code Here

Examples of javax.xml.parsers.DocumentBuilderFactory

       
        Document doc = null;
        try {
            WebService ws = serviceImplementation.getClass().getAnnotation(WebService.class);
            if (ws != null) {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                doc = builder.parse(ws.wsdlLocation());
            } else {
                LOG.severe("could not get WebService annotation from " + serviceImplementation);
            }
        } catch (Exception ex) {
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.