Package javax.xml.parsers

Examples of javax.xml.parsers.DocumentBuilder.newDocument()


          || (event.getResolve() == ResolveType.PASSTHRU)) {
        // no extra processing, 1-1
        resultList.add(event.getResponses().get(0));
      } else if (event.getResolve().equals(ResolveType.CHILDREN)) {
        // NIT: wrap in event name element for now
        Document doc = builder.newDocument();
        Element parent = doc.createElement(event.getEventName());

        doc.appendChild(parent);

        for (Element elem : event.getResponses()) {
View Full Code Here


      dbf.setNamespaceAware(true);

      DocumentBuilder db = dbf.newDocumentBuilder();

      result = db.newDocument();
    } catch (Exception e) {
      throw new TranslationException("Unable to create target document", //$NON-NLS-1$
          e);
    }
View Full Code Here

      dbf.setNamespaceAware(true);

      DocumentBuilder db = dbf.newDocumentBuilder();

      result = db.newDocument();
    } catch (Exception e) {
      throw new TranslationException("Unable to create target document", //$NON-NLS-1$
          e);
    }
View Full Code Here

   * @throws Exception If the test failes.
   */
  public void testSerializeToDOM() throws Exception {
    DocumentBuilder docBuilder =
      DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document doc = docBuilder.newDocument();

    ComplexObj x = new ComplexObj(3);
    trans.serialize(x, new DOMResult(doc));

    ComplexObj y = (ComplexObj) trans.deserialize(new DOMSource(doc));
View Full Code Here

   * @throws Exception If the test failes.
   */
  public void testGenerateSchemaToDOM() throws Exception {
    DocumentBuilder docBuilder =
      DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document doc = docBuilder.newDocument();
    trans.writeXMLSchema(IntObj.class, new DOMResult(doc));
  }

  /**
   * Test schema generation and validation of complex objects.
View Full Code Here

    _isRootElement = true;
    try {
      if (_doc == null) {
        DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = fac.newDocumentBuilder();
        _doc = docBuilder.newDocument();
      }
    }
    catch (ParserConfigurationException e) {
      Log.error(e);
    }
View Full Code Here

    }

    public Document createDocument() throws ParserConfigurationException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder = factory.newDocumentBuilder();
        final Document document = documentBuilder.newDocument();
        document.setXmlVersion("1.0");
        document.setXmlStandalone(true);
        return document;
    }
View Full Code Here

            }

            //Create doc
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder documentBuilder = factory.newDocumentBuilder();
            final Document document = documentBuilder.newDocument();
            document.setXmlVersion("1.0");
            document.setXmlStandalone(true);

            //Write doc
            preset.writeXML(document);
View Full Code Here

                                                                "e1", "Hello"));
        input[1] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo",
                                                                "e1", "World"));

        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document doc            = builder.newDocument();  
        Element cdataElem       = doc.createElementNS("urn:foo", "e3");
        CDATASection cdata      = doc.createCDATASection("Text with\n\tImportant  <b>  whitespace </b> and tags! ");     
        cdataElem.appendChild(cdata);
   
        input[2] = new SOAPBodyElement(cdataElem);
View Full Code Here

      Document doc = null;

      try {
         DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

         doc = builder.newDocument();

         Node elem = doc.createElement("ack");

         doc.appendChild(elem);
      } catch (ParserConfigurationException e) {
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.