Package org.w3c.dom

Examples of org.w3c.dom.Node.appendChild()


            // remove old childs
            while (node.hasChildNodes() == true) {
                node.removeChild(node.getFirstChild());
            }

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

    /**
     * Stream the XML directly to the handler. This streams the contents of getXML()
View Full Code Here


                            if (resource != null) {
                                Element resourceNode = (Element)DOMUtil.getSingleNode(coplet, "resource");
                                resourceNode.getParentNode().removeChild(resourceNode);
                                resourceNode = coplet.getOwnerDocument().createElementNS(null, "resource");
                                resourceNode.setAttributeNS(null, "uri", resource);
                                coplet.appendChild(resourceNode);
                            }
                            resource = this.request.getParameter("portaladmin_cust");
                            boolean isCustom = DOMUtil.getValueAsBooleanOf(coplet, "configuration/customizable", false);
                            if (resource != null && isCustom == true) {
                                Element resourceNode = (Element)DOMUtil.getSingleNode(coplet, "customization");
View Full Code Here

                            if (resource != null && isCustom == true) {
                                Element resourceNode = (Element)DOMUtil.getSingleNode(coplet, "customization");
                                if (resourceNode != null) resourceNode.getParentNode().removeChild(resourceNode);
                                resourceNode = coplet.getOwnerDocument().createElementNS(null, "customization");
                                resourceNode.setAttributeNS(null, "uri", resource);
                                coplet.appendChild(resourceNode);
                            }
                            if (isCustom == false) {
                                Element resourceNode = (Element)DOMUtil.getSingleNode(coplet, "customization");
                                if (resourceNode != null) resourceNode.getParentNode().removeChild(resourceNode);
                            }
View Full Code Here

                            }
                        }
                        coplet = copletsFragment.getOwnerDocument().createElementNS(null, "coplet");
                        coplet.setAttributeNS(null, "id", copletID);
                        subNode = coplet.getOwnerDocument().createElementNS(null, "resource");
                        coplet.appendChild(subNode);
                        subNode.setAttributeNS(null, "uri", "uri_in_sitemap");

                        String title = this.request.getParameter("portaladmin_title");
                        if (title == null || title.trim().length() == 0) title = "**NEW COPLET**";
                        DOMUtil.setValueOfNode(DOMUtil.selectSingleNode(coplet, "configuration/mandatory"), "false");
View Full Code Here

                            }
                            childs = currentDelta.getChildNodes();
                            max = childs.getLength();
                            for(index = 0; index < max; index++) {
                                if (childs.item(index).getNodeType() == Node.TEXT_NODE) {
                                    currentProfile.appendChild(currentProfile.getOwnerDocument()
                                     .createTextNode(childs.item(index).getNodeValue()));
                                }
                            }
                        }
                    }
View Full Code Here

                case XMLStreamConstants.START_ELEMENT:
                    QName name = reader.getName();
                    Element child = createElement(document, name);

                    // push the new element and make it the current one
                    current.appendChild(child);
                    current = child;

                    int count = reader.getNamespaceCount();
                    for (int i = 0; i < count; i++) {
                        String prefix = reader.getNamespacePrefix(i);
View Full Code Here

                        }
                    }

                    break;
                case XMLStreamConstants.CDATA:
                    current.appendChild(document.createCDATASection(reader.getText()));
                    break;
                case XMLStreamConstants.CHARACTERS:
                    current.appendChild(document.createTextNode(reader.getText()));
                    break;
                case XMLStreamConstants.END_ELEMENT:
View Full Code Here

                    break;
                case XMLStreamConstants.CDATA:
                    current.appendChild(document.createCDATASection(reader.getText()));
                    break;
                case XMLStreamConstants.CHARACTERS:
                    current.appendChild(document.createTextNode(reader.getText()));
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    // if we are back at the root then we are done
                    if (current == root) {
                        return;
View Full Code Here

      if (node2 != null) {
        String nodes = node2.getNodeName();

        if (nodes.equalsIgnoreCase("h2")) {
          h2Node = node2.appendChild(doc.createElement("h2_section"));
        } else {
          //if first node is not a <p> or a h2 node, create a <p> node and place all succeeding nodes
          //inside this node until a <p> or <h2> node is found
          if (x == 0 && !nodes.equalsIgnoreCase("p")
              && !nodes.equalsIgnoreCase("h2")) {
View Full Code Here

            if (deep) {
                for (Node n = importedNode.getFirstChild();
                     n != null;
                     n = n.getNextSibling()) {
                    result.appendChild(importNode(n, true));
                }
            }

            return result;
        }
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.