Class XmlTrim
java.lang.Object
org.libxmq.imp.xml.XmlTrim
Whitespace trimming of a DOM loaded from xml or html, exactly like the C
version of xmq does after reading xml/html (xmqTrimWhitespace and
xmq_fixup_comments_after_readin in xmq.c). All whitespace only text nodes
are removed and the incidental indentation is removed from the remaining
text and comment nodes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidRemove the dle escapes from comments, like the C function xmq_fixup_comments_after_readin.static voidPrepare a document for writing as xml or html, like the C function xmq_fixup_html_before_writeout: comments containing -- are escaped with the dle char, cdata sections become text and entity references inside style and script elements are replaced by text.static StringTrim a text value like the C xmq_trim_quote(v, is_xmq=false, is_comment=false).static voidTrim the whitespace of all text and comment nodes in the document, like the C function xmqTrimWhitespace.
-
Method Details
-
trimWhitespace
Trim the whitespace of all text and comment nodes in the document, like the C function xmqTrimWhitespace.- Parameters:
doc- The document to trim.
-
fixupCommentsAfterReadin
Remove the dle escapes from comments, like the C function xmq_fixup_comments_after_readin. An xml comment containing -␐- (a dle escaped double dash) is replaced with --.- Parameters:
doc- The document to fix.
-
fixupHtmlBeforeWriteout
Prepare a document for writing as xml or html, like the C function xmq_fixup_html_before_writeout: comments containing -- are escaped with the dle char, cdata sections become text and entity references inside style and script elements are replaced by text.- Parameters:
doc- The document to fix.
-
trim_xml_text
-