|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xwiki.xml.internal.XMLScriptService
@Component @Named(value="xml") @Singleton public class XMLScriptService
Provides Scripting APIs for handling XML.
| Constructor Summary | |
|---|---|
XMLScriptService()
Default component constructor. |
|
| Method Summary | |
|---|---|
Document |
createDOMDocument()
Construct a new (empty) DOM Document and return it. |
static String |
escape(Object content)
Escapes all the XML special characters in a String using numerical XML entities. |
static String |
escapeForAttributeValue(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 String |
escapeForElementContent(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. |
Document |
parse(byte[] content)
Parse a byte[] into a DOM Document. |
Document |
parse(InputStream stream)
Parse an InputStream into a DOM Document. |
Document |
parse(LSInput source)
Parse a DOM Document from a source. |
Document |
parse(String content)
Parse a String into a DOM Document. |
String |
serialize(Node node)
Serialize a DOM Node into a string, including the XML declaration at the start. |
String |
serialize(Node node,
boolean withXmlDeclaration)
Serialize a DOM Node into a string, with an optional XML declaration at the start. |
String |
transform(byte[] xml,
byte[] xslt)
Apply an XSLT transformation to a Document, both given as byte arrays. |
String |
transform(Document xml,
Document xslt)
Apply an XSLT transformation to a Document, both given as DOM Documents. |
String |
transform(Source xml,
Source xslt)
Apply an XSLT transformation to a Document. |
String |
transform(String xml,
String xslt)
Apply an XSLT transformation to a Document, both given as strings. |
static String |
unescape(Object content)
Unescape encoded special XML characters. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLScriptService()
| Method Detail |
|---|
public static String escape(Object content)
String using numerical XML entities. Specifically,
escapes <, >, ", ' and &.
content - the text to escape, may be null
String, null if null inputpublic static String escapeForAttributeValue(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 String escapeForElementContent(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 String unescape(Object content)
content - the text to decode, may be null
null if null inputpublic Document createDOMDocument()
public Document parse(LSInput source)
source - the source input to parse
null if the parsing failed.public Document parse(byte[] content)
byte[] into a DOM Document.
content - the content to parse
null if the content can't be parsed successfullypublic Document parse(String content)
String into a DOM Document.
content - the content to parse
null if the content can't be parsed successfullypublic Document parse(InputStream stream)
InputStream into a DOM Document.
stream - the content input to parse
null if the content can't be parsed successfullypublic String serialize(Node node)
node - the node to export
public String serialize(Node node,
boolean withXmlDeclaration)
node - the node to exportwithXmlDeclaration - whether to output the XML declaration or not
null
public String transform(Source xml,
Source xslt)
xml - the document to transformxslt - the stylesheet to apply
null if an error occurs or null xml or xslt input
public String transform(Document xml,
Document xslt)
xml - the document to transformxslt - the stylesheet to apply
null if an error occurs or null xml or xslt input
public String transform(byte[] xml,
byte[] xslt)
xml - the document to transformxslt - the stylesheet to apply
null if an error occurs or null xml or xslt input
public String transform(String xml,
String 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 | ||||||||