|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.xml.XMLUtils
public final class XMLUtils
XML Utility methods.
| Method Summary | |
|---|---|
static org.w3c.dom.Document |
createDOMDocument()
Construct a new (empty) DOM Document and return it. |
static java.lang.String |
escape(java.lang.Object content)
Escapes all the XML special characters in a String using numerical XML entities. |
static java.lang.String |
escapeAttributeValue(java.lang.Object content)
Escapes all the XML special characters in a String using numerical XML entities, so that the
resulting string can safely be used as an XML attribute value. |
static java.lang.String |
escapeElementContent(java.lang.Object content)
Escapes the XML special characters in a String using numerical XML entities, so that the resulting
string can safely be used as an XML text node. |
static java.lang.String |
escapeXMLComment(java.lang.String content)
XML comment does not support some characters inside its content but there is no official escaping/unescaping for it so we made our own. |
static java.lang.String |
extractXML(org.w3c.dom.Node node,
int start,
int length)
Extracts a well-formed XML fragment from the given DOM tree. |
static org.w3c.dom.Document |
parse(org.w3c.dom.ls.LSInput source)
Parse a DOM Document from a source. |
static java.lang.String |
serialize(org.w3c.dom.Node node)
Serialize a DOM Node into a string, including the XML declaration at the start. |
static java.lang.String |
serialize(org.w3c.dom.Node node,
boolean withXmlDeclaration)
Serialize a DOM Node into a string, with an optional XML declaration at the start. |
static java.lang.String |
transform(javax.xml.transform.Source xml,
javax.xml.transform.Source xslt)
Apply an XSLT transformation to a Document. |
static java.lang.String |
unescape(java.lang.Object content)
Unescape encoded special XML characters. |
static java.lang.String |
unescapeXMLComment(java.lang.String content)
XML comment does not support some characters inside its content but there is no official escaping/unescaping for it so we made our own. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String extractXML(org.w3c.dom.Node node,
int start,
int length)
node - the root of the DOM tree where the extraction takes placestart - the index of the first characterlength - the maximum number of characters in text nodes to include in the returned fragment
public static java.lang.String escapeXMLComment(java.lang.String content)
content - the XML comment content to escape
public static java.lang.String unescapeXMLComment(java.lang.String content)
content - the XML comment content to unescape
escapeXMLComment(String)public static java.lang.String escape(java.lang.Object content)
String using numerical XML entities. Specifically,
escapes <, >, ", ' and &.
content - the text to escape, may be null
String, null if null inputpublic static java.lang.String escapeAttributeValue(java.lang.Object content)
String using numerical XML entities, so that the
resulting string can safely be used as an XML attribute value. Specifically, escapes <, >, ", ' and &.
content - the text to escape, may be null
String, null if null inputpublic static java.lang.String escapeElementContent(java.lang.Object content)
String using numerical XML entities, so that the resulting
string can safely be used as an XML text node. Specifically, escapes <, >, and &.
content - the text to escape, may be null
String, null if null inputpublic static java.lang.String unescape(java.lang.Object content)
content - the text to decode, may be null
null if null inputpublic static org.w3c.dom.Document createDOMDocument()
public static org.w3c.dom.Document parse(org.w3c.dom.ls.LSInput source)
source - the source input to parse
null if the parsing failed.public static java.lang.String serialize(org.w3c.dom.Node node)
node - the node to export
public static java.lang.String serialize(org.w3c.dom.Node node,
boolean withXmlDeclaration)
node - the node to exportwithXmlDeclaration - whether to output the XML declaration or not
null
public static java.lang.String transform(javax.xml.transform.Source xml,
javax.xml.transform.Source xslt)
xml - the document to transformxslt - the stylesheet to apply
null if an error occurs or null xml or xslt input
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||