Package org.w3c.dom

Examples of org.w3c.dom.Document.createComment()


                        continue;
                    }
                    Element propertyElem = UtilXml.addChildElement(resourceElem, "property", resourceDocument);
                    propertyElem.setAttribute("key", StringEscapeUtils.unescapeHtml(labelInfo.getLabelKey()));
                    if (UtilValidate.isNotEmpty(labelInfo.getLabelKeyComment())) {
                        Comment labelKeyComment = resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelInfo.getLabelKeyComment()));
                        Node parent = propertyElem.getParentNode();
                        parent.insertBefore(labelKeyComment, propertyElem);
                    }
                    for (String localeFound : localesFound) {
                        LabelValue labelValue = labelInfo.getLabelValue(localeFound);
View Full Code Here


                            valueElem.setAttribute("xml:lang", localeFound);
                            if (valueString.trim().length() == 0) {
                                valueElem.setAttribute("xml:space", "preserve");
                            }
                            if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
                                Comment labelComment = resourceDocument.createComment(StringEscapeUtils.unescapeHtml(labelValue.getLabelComment()));
                                Node parent = valueElem.getParentNode();
                                parent.insertBefore(labelComment, valueElem);
                            }
                        }
                    }
View Full Code Here

                }

                break;
            case XMLStreamConstants.COMMENT:
                if (parent != null) {
                    parent.appendChild(doc.createComment(reader.getText()));
                }

                break;
            case XMLStreamConstants.CDATA:
                parent.appendChild(doc.createCDATASection(reader.getText()));
View Full Code Here

        Document signedDoc = builder.build(doc, crypto, secHeader);
       
        // Add a comment node as the first node element
        org.w3c.dom.Node firstChild = signedDoc.getFirstChild();
        org.w3c.dom.Node newNode = signedDoc.removeChild(firstChild);
        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
        signedDoc.appendChild(commentNode);
        signedDoc.appendChild(newNode);

        if (LOG.isDebugEnabled()) {
            LOG.debug("After Signing....");
View Full Code Here

            case Node.CDATA_SECTION_NODE: {
                node = factory.createCDATASection(place.getNodeValue());
                break;
            }
            case Node.COMMENT_NODE: {
                node = factory.createComment(place.getNodeValue());
                break;
            }
            case Node.ELEMENT_NODE: {
                Element element = factory.createElement(place.getNodeName());
                node = element;
View Full Code Here

        doc = newSVGDoc();
        ((AbstractDocument) doc).setStrictErrorChecking(false);
        conf = ((AbstractDocument) doc).getDomConfig();
        conf.setParameter("error-handler", h);
        e = doc.getDocumentElement();
        e.appendChild(doc.createComment("before -- after"));
        e.appendChild(doc.createComment("ends in a dash -"));
        e.setAttribute("*", "blah");
        e.appendChild(doc.createProcessingInstruction("abc", "def?>"));
        ((AbstractDocument) doc).normalizeDocument();
        if (!(h.get("wf-invalid-character-in-node-name") == 1
View Full Code Here

        ((AbstractDocument) doc).setStrictErrorChecking(false);
        conf = ((AbstractDocument) doc).getDomConfig();
        conf.setParameter("error-handler", h);
        e = doc.getDocumentElement();
        e.appendChild(doc.createComment("before -- after"));
        e.appendChild(doc.createComment("ends in a dash -"));
        e.setAttribute("*", "blah");
        e.appendChild(doc.createProcessingInstruction("abc", "def?>"));
        ((AbstractDocument) doc).normalizeDocument();
        if (!(h.get("wf-invalid-character-in-node-name") == 1
                && h.get("wf-invalid-character") == 3)) {
View Full Code Here

        doc = newSVGDoc();
        conf = ((AbstractDocument) doc).getDomConfig();
        conf.setParameter("comments", Boolean.FALSE);
        e = doc.getDocumentElement();
        e.appendChild(doc.createTextNode("abc"));
        e.appendChild(doc.createComment("def"));
        e.appendChild(doc.createTextNode("ghi"));
        ((AbstractDocument) doc).normalizeDocument();
        if (!(e.getFirstChild().getNodeType() == Node.TEXT_NODE
                && e.getFirstChild().getNodeValue().equals("abcghi")
                && e.getFirstChild() == e.getLastChild())) {
View Full Code Here

    private void writeDefinitions(Result result, PrivilegeDefinition[] definitions, Map<String, String> namespaces) throws IOException {
        try {
            Map<String, String> uriToPrefix = new HashMap<String, String>(namespaces.size());
            DocumentBuilder builder = createDocumentBuilder();
            Document doc = builder.newDocument();
            doc.appendChild(doc.createComment(LICENSE_HEADER));
            Element privileges = (Element) doc.appendChild(doc.createElement(XML_PRIVILEGES));

            for (String prefix : namespaces.keySet()) {
                String uri = namespaces.get(prefix);
                privileges.setAttribute(ATTR_XMLNS + prefix, uri);
View Full Code Here

                }

                break;
            case XMLStreamConstants.COMMENT:
                if (parent != null) {
                    parent.appendChild(doc.createComment(reader.getText()));
                }

                break;
            case XMLStreamConstants.CDATA:
                parent.appendChild(doc.createCDATASection(reader.getText()));
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.