@OpenApiAll
public final class XMLUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
filter(java.lang.CharSequence value)
Filter the specified string for characters that are sensitive to HTML interpreters, returning the string
with these characters replaced by the corresponding character entities.
|
static java.lang.String |
filterExcludeLineBreak(java.lang.String value)
Same as
filter(CharSequence) but exclude line break. |
static org.w3c.dom.NodeList |
getElementsByTagName(org.w3c.dom.Element element,
java.lang.String tagName)
Returns a List over the direct children of the given element with the given tag name.
|
static java.lang.String |
htmlPlainText(java.lang.String xmlContent)
Strip all tag element and convert all special characters to plain text.
|
static void |
skipBOM(java.io.InputStream inputStream)
Skip the BOM character.
|
static void |
skipBOM(java.io.Reader reader)
Skip the BOM character.
|
static java.lang.String |
xmlPlainText(java.lang.String xmlContent)
Strip all tag element and convert all special characters to plain text.
|
public static java.lang.String filter(java.lang.CharSequence value)
value
- The string to be filtered and returnedpublic static java.lang.String filterExcludeLineBreak(java.lang.String value)
filter(CharSequence)
but exclude line break. e.g. \r and \nvalue
- The string to be filtered and returnedpublic static java.lang.String htmlPlainText(java.lang.String xmlContent)
xmlContent
- the xml contentpublic static java.lang.String xmlPlainText(java.lang.String xmlContent)
xmlContent
- the xml contentpublic static org.w3c.dom.NodeList getElementsByTagName(org.w3c.dom.Element element, java.lang.String tagName)
Element.getElementsByTagName(String)
gives the corresponding elements in the whole
descendance. This method return only direct descendance of element.element
- The parent elementtagName
- The name of the desired childpublic static void skipBOM(java.io.Reader reader) throws java.io.IOException
The BOM is the Unicode character at code point U+FEFF ("zero-width no-break space") when that character is used to denote the endianness of a string of UCS/Unicode characters encoded in UTF-16 or UTF-32.
reader
- Readerjava.io.IOException
- If the stream does not support mark(), or reset()public static void skipBOM(java.io.InputStream inputStream) throws java.io.IOException
The BOM is the Unicode character at code point U+FEFF ("zero-width no-break space") when that character is used to denote the endianness of a string of UCS/Unicode characters encoded in UTF-16 or UTF-32.
inputStream
- InputStreamjava.io.IOException
- If the stream does not support mark(), or reset()Copyright © 2010 - No Magic Asia