Package org.w3c.dom

Examples of org.w3c.dom.CDATASection


                String nValue = n.getNodeValue();
                Text t = doc.createTextNode(nValue);
                el.appendChild(t);
            } else if (nodeType == Node.CDATA_SECTION_NODE) {
                String nValue = n.getNodeValue();
                CDATASection s = doc.createCDATASection(nValue);
                el.appendChild(s);
            } else if (nodeType == Node.ELEMENT_NODE) {
                appendElement(doc, el, n, schema);
            }
        }
View Full Code Here


        Element propertyElem = document.createElement(source);
        if (propertyName != null) {
            propertyElem.setAttribute("name", propertyName);
        }
        if (propertyValue != null) {
            CDATASection cdataSection = document.createCDATASection(propertyValue);
            propertyElem.appendChild(cdataSection);
        }
        return propertyElem;       
    }
View Full Code Here

        throws XNIException {

        if (fInCDATASection) {
            Node node = fCurrentNode.getLastChild();
            if (node != null && node.getNodeType() == Node.CDATA_SECTION_NODE) {
                CDATASection cdata = (CDATASection)node;
                cdata.appendData(text.toString());
            }
            else {
                CDATASection cdata = fDocument.createCDATASection(text.toString());
                fCurrentNode.appendChild(cdata);
            }
        }
        else {
            Node node = fCurrentNode.getLastChild();
View Full Code Here

  public XmlDocument getOwnerXmlDocument() {
    return XmlDocument.toXmlDocument(this.getOwnerDocument());
  }

  public CDATASection addCDATASection(final String data) {
    CDATASection cdata = this.getOwnerDocument().createCDATASection(data);
    this.appendChild(cdata);
    return cdata;
  }
View Full Code Here

        throws XNIException {

        if (fInCDATASection) {
            Node node = fCurrentNode.getLastChild();
            if (node != null && node.getNodeType() == Node.CDATA_SECTION_NODE) {
                CDATASection cdata = (CDATASection)node;
                cdata.appendData(text.toString());
            }
            else {
                CDATASection cdata = fDocument.createCDATASection(text.toString());
                fCurrentNode.appendChild(cdata);
            }
        }
        else {
            Node node = fCurrentNode.getLastChild();
View Full Code Here

    if (isOutsideDocElem() && isWhiteSpace(ch, start, length))
      return; // avoid DOM006 Hierarchy request error

    String s = new String(ch, start, length);

    CDATASection section = (CDATASection) this.currentNode.getLastChild();
    section.appendData(s);
  }
View Full Code Here

                                                                "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);
       
        for(int i=0; i<input.length; i++) {
            body.addChildElement(input[i]);
        }
       
        ByteArrayInputStream bais = new ByteArrayInputStream(env.toString().getBytes());
        SOAPEnvelope env2 = new org.apache.axis.message.SOAPEnvelope(bais);
       
        Iterator iterator = env2.getBody().getChildElements();
        Element element = null;
        for(int i=0;iterator.hasNext();i++) {
            MessageElement e = (MessageElement) iterator.next();
            element = e.getAsDOM();
        }
        String xml = element.getFirstChild().getNodeValue();
        assertEquals(xml, cdata.getData());
    }
View Full Code Here

      nested.setAttribute(XMLConstants.ATTR_TYPE, t.getClass().getName());
      String message = t.getMessage();
      if ((message != null) && (message.length() > 0)) {
        nested.setAttribute(XMLConstants.ATTR_MESSAGE, message);
      }
      CDATASection trace= doc.createCDATASection(Utils.stackTrace(t, false)[0]);
      nested.appendChild(trace);
    }
   
    return nested;
  }
View Full Code Here

        if (enabled) {
            NodeList items = ruleNode.getChildNodes();
            for (int i = 0; i < items.getLength(); i++) {
                Node item = items.item(i);
                if (item.getNodeType() == Node.CDATA_SECTION_NODE) {
                    CDATASection cdata = (CDATASection) item;
                    elements += cdata.getNodeValue().trim() + "\n";
                }
            }

            elements = elements.replaceAll("@contextpath@", contextPath);
        }
View Full Code Here

     *
     * @since Ant 1.6.3
     */
    public static void appendCDATA(Element parent, String content) {
        Document doc = parent.getOwnerDocument();
        CDATASection c = doc.createCDATASection(content);
        parent.appendChild(c);
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.CDATASection

Copyright © 2018 www.massapicom. 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.