当前位置: 首页>>代码示例>>Java>>正文


Java Comment.getData方法代码示例

本文整理汇总了Java中org.w3c.dom.Comment.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Comment.getData方法的具体用法?Java Comment.getData怎么用?Java Comment.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.Comment的用法示例。


在下文中一共展示了Comment.getData方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serializeComment

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Serializes a Comment Node.
 *
 * @param node The Comment Node to serialize
 */
protected void serializeComment(Comment node) throws SAXException {
    // comments=true
    if ((fFeatures & COMMENTS) != 0) {
        String data = node.getData();

        // well-formed=true
        if ((fFeatures & WELLFORMED) != 0) {
            isCommentWellFormed(data);
        }

        if (fLexicalHandler != null) {
            // apply the LSSerializer filter after the operations requested by the
            // DOMConfiguration parameters have been applied
            if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) {
                return;
            }

            fLexicalHandler.comment(data.toCharArray(), 0, data.length());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:DOM3TreeWalker.java

示例2: serializeComment

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Serializes a Comment Node.
 * 
 * @param node The Comment Node to serialize
 */
protected void serializeComment(Comment node) throws SAXException {
    // comments=true
    if ((fFeatures & COMMENTS) != 0) {
        String data = node.getData();

        // well-formed=true
        if ((fFeatures & WELLFORMED) != 0) {
            isCommentWellFormed(data);
        }

        if (fLexicalHandler != null) {
            // apply the LSSerializer filter after the operations requested by the 
            // DOMConfiguration parameters have been applied 
            if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) {
                return;
            }

            fLexicalHandler.comment(data.toCharArray(), 0, data.length());
        }
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:27,代码来源:DOM3TreeWalker.java

示例3: outputCommentToWriter

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Method outputCommentToWriter
 *
 * @param currentComment
 * @throws IOException
 */
private void outputCommentToWriter(Comment currentComment) throws IOException {

    if (currentComment == null) {
        return;
    }

    this.writer.write("<!--");

    String data = currentComment.getData();
    int length = data.length();

    for (int i = 0; i < length; i++) {
        char c = data.charAt(i);

        switch (c) {

        case 0x0D:
            this.writer.write("&amp;#xD;");
            break;

        case ' ':
            this.writer.write("&middot;");
            break;

        case '\n':
            this.writer.write("&para;\n");
            break;

        default:
            this.writer.write(c);
            break;
        }
    }

    this.writer.write("--&gt;");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:XMLSignatureInputDebugger.java

示例4: outputCommentToWriter

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Method outputCommentToWriter
 *
 * @param currentComment
 * @param writer writer where to write the things
 * @throws IOException
 */
protected void outputCommentToWriter(
    Comment currentComment, OutputStream writer, int position
) throws IOException {
    if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
        writer.write('\n');
    }
    writer.write(BEGIN_COMM.clone());

    final String data = currentComment.getData();
    final int length = data.length();

    for (int i = 0; i < length; i++) {
        char c = data.charAt(i);
        if (c == 0x0D) {
            writer.write(XD.clone());
        } else {
            if (c < 0x80) {
                writer.write(c);
            } else {
                UtfHelpper.writeCharToUtf8(c, writer);
            }
        }
    }

    writer.write(END_COMM.clone());
    if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
        writer.write('\n');
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:CanonicalizerBase.java

示例5: outputCommentToWriter

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Method outputCommentToWriter
 *
 * @param currentComment
 * @param writer writer where to write the things
 * @throws IOException
 */
protected void outputCommentToWriter(
    Comment currentComment, OutputStream writer, int position
) throws IOException {   	
    if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
        writer.write('\n');
    }
    writer.write(BEGIN_COMM.clone());

    final String data = currentComment.getData();
    final int length = data.length();

    for (int i = 0; i < length; ) {
        int c = data.codePointAt(i);
        i += Character.charCount(c);
        if (c == 0x0D) {
            writer.write(XD.clone());
        } else {
            if (c < 0x80) {
                writer.write(c);
            } else {
                UtfHelpper.writeCodePointToUtf8(c, writer);
            }
        }
    }

    writer.write(END_COMM.clone());
    if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
        writer.write('\n');
    }
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:38,代码来源:CanonicalizerBase.java

示例6: outputCommentToWriter

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Method outputCommentToWriter
 *
 * @param currentComment
 * @throws IOException
 */
private void outputCommentToWriter(Comment currentComment)
                throws IOException {

        if (currentComment == null) {
                return;
        }

        this._writer.write("&lt;!--");

        String data = currentComment.getData();
        int length = data.length();

        for (int i = 0; i < length; i++) {
                char c = data.charAt(i);

                switch (c) {

                case 0x0D:
                        this._writer.write("&amp;#xD;");
                        break;

                case ' ':
                        this._writer.write("&middot;");
                        break;

                case '\n':
                        this._writer.write("&para;\n");
                        break;

                default:
                        this._writer.write(c);
                        break;
                }
        }

        this._writer.write("--&gt;");
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:44,代码来源:XMLSignatureInputDebugger.java

示例7: outputCommentToWriter

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Method outputCommentToWriter
 *
 * @param currentComment
 * @param writer writer where to write the things
 * @throws IOException
 */
static final void outputCommentToWriter(Comment currentComment, OutputStream writer,int position) throws IOException {
       if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
             writer.write('\n');
       }
   writer.write(_BEGIN_COMM);

   final String data = currentComment.getData();
   final int length = data.length();

   for (int i = 0; i < length; i++) {
      char c=data.charAt(i);
      if (c==0x0D) {
         writer.write(__XD_);
      } else {
              if (c < 0x80)  {
                     writer.write(c);
             } else {
                     UtfHelpper.writeCharToUtf8(c,writer);
             };
      }
   }

   writer.write(_END_COMM);
   if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
             writer.write('\n');
      }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:35,代码来源:CanonicalizerBase.java

示例8: _writeComment

import org.w3c.dom.Comment; //导入方法依赖的package包/类
private void _writeComment (@Nonnull final XMLEmitter aXMLWriter, @Nonnull final Comment aComment)
{
  if (m_aSettings.getSerializeComments ().isEmit ())
  {
    final String sComment = aComment.getData ();
    aXMLWriter.onComment (sComment);
    if (sComment.indexOf ('\n') >= 0)
    {
      // Newline only after multi-line comments
      aXMLWriter.newLine ();
    }
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:14,代码来源:XMLSerializer.java

示例9: outputCommentToWriter

import org.w3c.dom.Comment; //导入方法依赖的package包/类
/**
 * Method outputCommentToWriter
 *
 * @param currentComment
 * @param writer writer where to write the things
 * @throws IOException
 */
static final void outputCommentToWriter(Comment currentComment, OutputStream writer,int position) throws IOException {
       if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
             writer.write('\n');
       }
   writer.write(_BEGIN_COMM.clone());

   final String data = currentComment.getData();
   final int length = data.length();

   for (int i = 0; i < length; i++) {
      char c=data.charAt(i);
      if (c==0x0D) {
         writer.write(__XD_.clone());
      } else {
              if (c < 0x80)  {
                     writer.write(c);
             } else {
                     UtfHelpper.writeCharToUtf8(c,writer);
             };
      }
   }

   writer.write(_END_COMM.clone());
   if (position == NODE_BEFORE_DOCUMENT_ELEMENT) {
             writer.write('\n');
      }
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:35,代码来源:CanonicalizerBase.java

示例10: isGeneratedNode

import org.w3c.dom.Comment; //导入方法依赖的package包/类
private static boolean isGeneratedNode(Node node) {
    boolean rc = false;

    if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
        Element element = (Element) node;
        String id = element.getAttribute("id"); //$NON-NLS-1$
        if (id != null) {
            for (String prefix : MergeConstants.OLD_XML_ELEMENT_PREFIXES) {
                if (id.startsWith(prefix)) {
                    rc = true;
                    break;
                }
            }
        }

        if (rc == false) {
            // check for new node format - if the first non-whitespace node
            // is an XML comment, and the comment includes
            // one of the old element tags,
            // then it is a generated node
            NodeList children = node.getChildNodes();
            int length = children.getLength();
            for (int i = 0; i < length; i++) {
                Node childNode = children.item(i);
                if (isWhiteSpace(childNode)) {
                    continue;
                } else if (childNode.getNodeType() == Node.COMMENT_NODE) {
                    Comment comment = (Comment) childNode;
                    String commentData = comment.getData();
                    for (String tag : MergeConstants.OLD_ELEMENT_TAGS) {
                        if (commentData.contains(tag)) {
                            rc = true;
                            break;
                        }
                    }
                } else {
                    break;
                }
            }
        }
    }

    return rc;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:45,代码来源:XmlFileMergerJaxp.java


注:本文中的org.w3c.dom.Comment.getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。