Package org.w3c.dom

Examples of org.w3c.dom.CDATASection


        Text text = getDocument().createTextNode(value);
        getNode().appendChild(text);
    }
   
    public void cdata(String value) {
        CDATASection cdata = getDocument().createCDATASection(value);
        getNode().appendChild(cdata);
    }
View Full Code Here


                case Node.TEXT_NODE:
                    Text t = doc.createTextNode(n.getNodeValue());
                    documentationEl.appendChild(t);
                    break;
                case Node.CDATA_SECTION_NODE:
                    CDATASection s = doc.createCDATASection(n.getNodeValue());
                    documentationEl.appendChild(s);
                    break;
                case Node.COMMENT_NODE:
                    Comment c = doc.createComment(n.getNodeValue());
                    documentationEl.appendChild(c);
View Full Code Here

                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

            node.appendChild(document.createTextNode(value));
        }
    }

    public void cdata(String value) {
        CDATASection cdata = document.createCDATASection(value);
        node.appendChild(cdata);
    }
View Full Code Here

       return  namespaceResolver.resolveNamespaceURI(namespaceURI);
    }

    private Node addText(XMLField xmlField, Node element, String textValue) {
        if (xmlField.isCDATA()) {
            CDATASection cdata = element.getOwnerDocument().createCDATASection(textValue);
            element.appendChild(cdata);
            return cdata;
        } else {
            Text text = element.getOwnerDocument().createTextNode(textValue);
            element.appendChild(text);
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

                                                                "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);
       
        Vector          elems = (Vector) call.invoke( input );
View Full Code Here

                                    .build();
                        }

                        // Now we've figured out the options, store this
                        // individual command
                        final CDATASection progList = document
                                .createCDATASection(cmdSyntax.toString());
                        final String safeName = cmd.value()[0]
                                .replace("\\", "BCK").replace("/", "FWD")
                                .replace("*", "ASX");
                        final Element element = new XmlElementBuilder(
View Full Code Here

        return sb;
  }     
   
    private static StringBuffer nodeAsText(Node elm,StringBuffer sb,boolean ignoreComments) {
       if(elm.getNodeType() == Node.CDATA_SECTION_NODE) {
         CDATASection cdata = (CDATASection)elm;
         sb.append("<![CDATA[");
         sb.append(cdata.getData());
         sb.append("]]>");
         return sb;
       }
       if(elm.getNodeType() == Node.COMMENT_NODE) {
         if(ignoreComments) {
View Full Code Here

        Document document = parent.getOwnerDocument();
        Element textElement = namespaceURI != null ? document.createElementNS(namespaceURI, tag) : document.createElement(tag);
        parent.appendChild(textElement);

        if (text != null && text.length() > 0) {
            CDATASection cdata = createCDATASection(document, text);
            textElement.appendChild(cdata);
        }
    }
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.