Java Code Examples for org.w3c.dom.Comment#getData()
The following examples show how to use
org.w3c.dom.Comment#getData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLSignatureInputDebugger.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 2
Source File: CanonicalizerBase.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 3
Source File: CanonicalizerBase.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 4
Source File: XMLSerializer.java From ph-commons with Apache License 2.0 | 5 votes |
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 (); } } }
Example 5
Source File: CanonicalizerBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 6
Source File: CanonicalizerBase.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 7
Source File: XMLSignatureInputDebugger.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 8
Source File: CanonicalizerBase.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 9
Source File: XMLSignatureInputDebugger.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 10
Source File: CanonicalizerBase.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 11
Source File: XMLSignatureInputDebugger.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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("-->"); }
Example 12
Source File: XMLSignatureInputDebugger.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 13
Source File: CanonicalizerBase.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 14
Source File: XMLSignatureInputDebugger.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 15
Source File: CanonicalizerBase.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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'); } }
Example 16
Source File: XMLSignatureInputDebugger.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 17
Source File: XMLSignatureInputDebugger.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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("-->"); }
Example 18
Source File: CanonicalizerBase.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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'); } }
Example 19
Source File: XmlFileMergerJaxp.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
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; }
Example 20
Source File: XmlFileMergerJaxp.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
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; }