Package org.w3c.dom

Examples of org.w3c.dom.Comment


        }
        Element propNode = doc.createElement("property");
        conf.appendChild(propNode);

        if (updatingResource != null) {
          Comment commentNode = doc.createComment(
            "Loaded from " + updatingResource.get(name));
          propNode.appendChild(commentNode);
        }
        Element nameNode = doc.createElement("name");
        nameNode.appendChild(doc.createTextNode(name));
View Full Code Here


                        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);
                        String valueString = null;
                        if (labelValue != null) {
                            valueString = labelValue.getLabelValue();
                        }
                        if (UtilValidate.isNotEmpty(valueString)) {
                            valueString = StringEscapeUtils.unescapeHtml(valueString);
                            Element valueElem = UtilXml.addChildElementValue(propertyElem, "value", valueString, resourceDocument);
                            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

        if( includeTime )
        {
            if( created > 0 )
            {
                String message = "Create time is " + (new Date(created));
                Comment comment = doc.createComment(message);
                systemElement.appendChild(comment);
            }
     
      Element timeElement = null;
      if(!USE_NS)
      {
        timeElement = doc.createElement(E_ATTR);
      }
      else
      {
        timeElement = doc.createElementNS(NS_URI, E_ATTR);
      }
            timeElement.setAttribute(A_NAME, E_CREATED);
            timeElement.setAttribute(A_VALUE, Long.toString(created));
            systemElement.appendChild(timeElement);

            if( modified > 0 )
            {
                String message = "Modified time is " + (new Date(modified));
                Comment comment = doc.createComment(message);
                systemElement.appendChild(comment);
            }
      if(!USE_NS)
      {
        timeElement = doc.createElement(E_ATTR);
View Full Code Here

                    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);
                      break;
                    default:
                        break;
                }
View Full Code Here

            break;
        }

        case Node.COMMENT_NODE: {
            Comment comment = newCommentNode(document, original.getNodeValue());

            node = comment;

            break;
        }
View Full Code Here

    /**
     * Lexical Handler method to create comment node in DOM tree.
     */
    public void comment(char[] ch, int start, int length) {
  final Node last = (Node)_nodeStk.peek();
  Comment comment = _document.createComment(new String(ch,start,length));
  if (comment != null){
          if (last == _root && _nextSibling != null)
              last.insertBefore(comment, _nextSibling);
          else
              last.appendChild(comment);
View Full Code Here

    /**
     * Lexical Handler method to create comment node in DOM tree.
     */
    public void comment(char[] ch, int start, int length) {
        final Node last = nodeStk.peek();
        Comment comment = document.createComment(new String(ch, start, length));
        if (comment != null) {
            if (last == root && nextSibling != null) {
                last.insertBefore(comment, nextSibling);
            } else {
                last.appendChild(comment);
View Full Code Here

      }
    }
  }

  protected static void addComment(String text, org.w3c.dom.Element parent, Document document) {
    Comment comment = document.createComment(text);
    parent.appendChild(comment);
  }
View Full Code Here

        systemElement.setAttribute(A_TYPE, getTypeString(type));
        root.appendChild(systemElement);
        if (includeTime) {
            if (created > 0) {
                String message = "Create time is " + (new Date(created));
                Comment comment = doc.createComment(message);
                systemElement.appendChild(comment);
            }

            Element timeElement = null;
            if (!USE_NS) {
                timeElement = doc.createElement(E_ATTR);
            } else {
                timeElement = doc.createElementNS(NS_URI, E_ATTR);
            }
            timeElement.setAttribute(A_NAME, E_CREATED);
            timeElement.setAttribute(A_VALUE, Long.toString(created));
            systemElement.appendChild(timeElement);

            if (modified > 0) {
                String message = "Modified time is " + (new Date(modified));
                Comment comment = doc.createComment(message);
                systemElement.appendChild(comment);
            }
            if (!USE_NS) {
                timeElement = doc.createElement(E_ATTR);
            } else {
View Full Code Here

     *
     * @throws SAXException Thrown by application to signal an error.
     */
    public void comment(XMLString text) throws SAXException {

        Comment comment = fDocument.createComment(text.toString());
        fCurrentNode.appendChild(comment);

    } // comment(XMLString)
View Full Code Here

TOP

Related Classes of org.w3c.dom.Comment

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.