本文整理汇总了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());
}
}
}
示例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());
}
}
}
示例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("&#xD;");
break;
case ' ':
this.writer.write("·");
break;
case '\n':
this.writer.write("¶\n");
break;
default:
this.writer.write(c);
break;
}
}
this.writer.write("-->");
}
示例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');
}
}
示例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');
}
}
示例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("<!--");
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("&#xD;");
break;
case ' ':
this._writer.write("·");
break;
case '\n':
this._writer.write("¶\n");
break;
default:
this._writer.write(c);
break;
}
}
this._writer.write("-->");
}
示例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');
}
}
示例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 ();
}
}
}
示例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');
}
}
示例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;
}