Package javax.xml.parsers

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


    org.w3c.dom.Element ret=null;
   
    try {
      DocumentBuilder builder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
     
      Document doc=builder.newDocument();
     
      ret = doc.createElement(TOP_LEVEL_ELEMENT_NAME);
     
    } catch(Exception e) {
      logger.error("Failed to create message", e);
View Full Code Here


     
      DocumentBuilder builder=fact.newDocumentBuilder();
     
      // Check if XML document, and if not return as text node
      if (text.trim().length() == 0 || text.charAt(0) != '<') {
        org.w3c.dom.Document doc=builder.newDocument();
       
        // Assume is text node
        ret = doc.createTextNode(text);
      } else {
        java.io.InputStream xmlstr=
View Full Code Here

     * @return ...
     */
    public static Document newDocument() {
        DocumentBuilder d = getDocumentBuilder();

        return d.newDocument();
    }

    /**
     *
     *
 
View Full Code Here

  }

  public void run() throws Exception {
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document tml = builder.parse(tmlFile);
    this.tld = builder.newDocument();
   
    Element taglib = createElement("taglib");
    taglib.setAttribute("xmlns", "http://java.sun.com/xml/ns/j2ee");
    taglib.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    taglib.setAttribute("xsi:schemaLocation", "http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd");
View Full Code Here

          throw new RuntimeException(e);
        }
        final Map<String, Object> results = new HashMap<String, Object>();

            // process metadata
            org.w3c.dom.Document processMetadaDoc = builder.newDocument();
            org.w3c.dom.Element processMetadata = processMetadaDoc.createElement("previoustasksowner");
            processMetadaDoc.appendChild(processMetadata);
//            org.w3c.dom.Element procElement = processMetadaDoc.createElement("previoustasksowner");
            processMetadata.setAttribute("primaryname", "my_result");
//            processMetadata.appendChild(procElement);           
View Full Code Here

        NodeList nl = null;
        if (source instanceof org.w3c.dom.Node) {
             nl = (NodeList) exprFrom.evaluate(source, XPathConstants.NODESET);
        } else if (source instanceof String) {
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = builder.newDocument();
            //quirky: create a temporary element, use its nodelist
            Element temp = doc.createElementNS(null, "temp");
            temp.appendChild(doc.createTextNode((String) source));
            nl = temp.getChildNodes();
        } else if (source == null) {
View Full Code Here

                    targetElem = ((Attr) nl.item(i)).getValue();
                } else if (nl.item(i) instanceof Text) {
                    targetElem = ((Text) nl.item(i)).getWholeText();
                } else {
                    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                    Document doc = builder.newDocument();
                    targetElem  = doc.importNode(nl.item(i), true);
                }
                target = targetElem;
            } else {
                org.w3c.dom.Node n  = ((org.w3c.dom.Node) targetElem).getOwnerDocument().importNode(nl.item(i), true);
View Full Code Here

                return context.getVariable(variableName.getLocalPart());
            }
        });

    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        return xpathEvaluator.evaluate(this.expression, builder.newDocument(), XPathConstants.BOOLEAN);
    }

    public String toString() {
        return this.expression;
    }
View Full Code Here

public class XmlUtils {

    public static Document newDocument() {
        try {
            DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            return db.newDocument();
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

        Message = message;
        Code = code;

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

//            Document doc = new DocumentImpl();
        Element root = doc.createElement("ServiceExceptionReport");
        root.setAttribute("version", "1.1.0");
        Element ex = doc.createElement("ServiceException");
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.