|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.opensymphony.util.XMLUtils
public class XMLUtils
XMLUtils is a bunch of quick access utility methods to common XML operations.
These include:
This class contains static methods only and is not meant to be instantiated. It also contains only basic (common) functions - for more control access appropriate API directly.
| Constructor Summary | |
|---|---|
XMLUtils()
|
|
| Method Summary | |
|---|---|
static Node |
cloneNode(Node node,
Document target,
boolean deep)
Clone given Node into target Document. |
static int |
getCacheSize()
Accessor for the internal XSL transformer cache |
static String |
getElementText(Element element)
Return the contained text within an Element. |
static Document |
newDocument()
Create blank Document. |
static Document |
newDocument(String rootElementName)
Create blank Document, and insert root element with given name. |
static Document |
parse(File file)
Parse a File of XML into Document. |
static Document |
parse(InputSource in)
Parse an InputSource of XML into Document. |
static Document |
parse(InputStream in)
Parse an InputStream of XML into Document. |
static Document |
parse(Reader in)
Parse a Reader of XML into Document. |
static Document |
parse(String xml)
Parse a String containing XML data into a Document. |
static Document |
parse(URL url)
Parse the contents of a URL's XML into Document. |
static String |
print(Document document)
Pretty-print a Document back to String of XML. |
static void |
print(Document document,
File file)
Pretty-print a Document to File. |
static void |
print(Document document,
OutputStream out)
Pretty-print a Document to OutputStream. |
static void |
print(Document document,
Writer out)
Pretty-print a Document to Writer. |
static void |
setCacheSize(int newCacheSize)
Sets the internal cache size for XSL sheets |
static Document |
transform(Document xml,
Document xsl)
Perform XSL transformations using given Documents and return new Document. |
static void |
transform(InputStream xml,
InputStream xsl,
OutputStream result)
Perform XSL transformation. |
static void |
transform(Reader xml,
Reader xsl,
Writer result)
Perform XSL transformation. |
static void |
transform(Reader xml,
Reader xsl,
Writer result,
Map parameters)
Perform XSL transformation, with params. |
static void |
transform(Reader xml,
Reader xsl,
Writer result,
Map parameters,
String xslkey)
This method applies an XSL sheet to an XML document. |
static String |
transform(String xml,
String xsl)
Perform XSL transformation. |
static Node |
xpath(Node base,
String xpath)
Return single Node from base Node using X-Path expression. |
static NodeList |
xpathList(Node base,
String xpath)
Return multiple Nodes from base Node using X-Path expression. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLUtils()
| Method Detail |
|---|
public static final String getElementText(Element element)
public static final Node cloneNode(Node node,
Document target,
boolean deep)
throws DOMException
DOMException
public static final Document newDocument()
throws ParserConfigurationException
ParserConfigurationException
public static final Document newDocument(String rootElementName)
throws ParserConfigurationException
ParserConfigurationException
public static final Document parse(InputSource in)
throws ParserConfigurationException,
IOException,
SAXException
ParserConfigurationException
IOException
SAXException
public static final Document parse(InputStream in)
throws ParserConfigurationException,
IOException,
SAXException
ParserConfigurationException
IOException
SAXException
public static final Document parse(Reader in)
throws ParserConfigurationException,
IOException,
SAXException
ParserConfigurationException
IOException
SAXException
public static final Document parse(File file)
throws ParserConfigurationException,
IOException,
SAXException
ParserConfigurationException
IOException
SAXException
public static final Document parse(URL url)
throws ParserConfigurationException,
IOException,
SAXException
ParserConfigurationException
IOException
SAXException
public static final Document parse(String xml)
throws ParserConfigurationException,
IOException,
SAXException
ParserConfigurationException
IOException
SAXException
public static final void print(Document document,
Writer out)
throws IOException
IOException
public static final void print(Document document,
OutputStream out)
throws IOException
IOException
public static final void print(Document document,
File file)
throws IOException
IOException
public static final String print(Document document)
throws IOException
IOException
public static final void transform(Reader xml,
Reader xsl,
Writer result)
throws TransformerException
TransformerException
public static final Node xpath(Node base,
String xpath)
throws TransformerException
TransformerException
public static final NodeList xpathList(Node base,
String xpath)
throws TransformerException
TransformerExceptionpublic static void setCacheSize(int newCacheSize)
newCacheSize - public static int getCacheSize()
public static final void transform(Reader xml,
Reader xsl,
Writer result,
Map parameters,
String xslkey)
throws TransformerException
2002/Apr/7, fixed bug 540875, first reported by Erik Weber, and added configurable cache size.
xml - the XML sourcexsl - the XSL sourceresult - where to put the responseparameters - a map consisting of params for the transformerxslkey - a key used to refer to the XSL
TransformerException
public static final void transform(Reader xml,
Reader xsl,
Writer result,
Map parameters)
throws TransformerException
TransformerException
public static final void transform(InputStream xml,
InputStream xsl,
OutputStream result)
throws TransformerException
TransformerException
public static final String transform(String xml,
String xsl)
throws TransformerException
TransformerException
public static final Document transform(Document xml,
Document xsl)
throws ParserConfigurationException,
TransformerException
ParserConfigurationException
TransformerException
|
OSCore Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||