|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.util.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 org.w3c.dom.Node |
cloneNode(org.w3c.dom.Node node,
org.w3c.dom.Document target,
boolean deep)
Clone given Node into target Document. |
static int |
getCacheSize()
Accessor for the internal XSL transformer cache |
static String |
getElementText(org.w3c.dom.Element element)
Return the contained text within an Element. |
static org.w3c.dom.Document |
newDocument()
Create blank Document. |
static org.w3c.dom.Document |
newDocument(String rootElementName)
Create blank Document, and insert root element with given name. |
static org.w3c.dom.Document |
parse(File file)
Parse a File of XML into Document. |
static org.w3c.dom.Document |
parse(org.xml.sax.InputSource in)
Parse an InputSource of XML into Document. |
static org.w3c.dom.Document |
parse(InputStream in)
Parse an InputStream of XML into Document. |
static org.w3c.dom.Document |
parse(Reader in)
Parse a Reader of XML into Document. |
static org.w3c.dom.Document |
parse(String xml)
Parse a String containing XML data into a Document. |
static org.w3c.dom.Document |
parse(URL url)
Parse the contents of a URL's XML into Document. |
static String |
print(org.w3c.dom.Document document)
Pretty-print a Document back to String of XML. |
static void |
print(org.w3c.dom.Document document,
File file)
Pretty-print a Document to File. |
static void |
print(org.w3c.dom.Document document,
OutputStream out)
Pretty-print a Document to OutputStream. |
static void |
print(org.w3c.dom.Document document,
Writer out)
Pretty-print a Document to Writer. |
static void |
setCacheSize(int newCacheSize)
Sets the internal cache size for XSL sheets |
static org.w3c.dom.Document |
transform(org.w3c.dom.Document xml,
org.w3c.dom.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 org.w3c.dom.Node |
xpath(org.w3c.dom.Node base,
String xpath)
Return single Node from base Node using X-Path expression. |
static org.w3c.dom.NodeList |
xpathList(org.w3c.dom.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(org.w3c.dom.Element element)
public static final org.w3c.dom.Node cloneNode(org.w3c.dom.Node node, org.w3c.dom.Document target, boolean deep) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
public static final org.w3c.dom.Document newDocument() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static final org.w3c.dom.Document newDocument(String rootElementName) throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static final org.w3c.dom.Document parse(org.xml.sax.InputSource in) throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
public static final org.w3c.dom.Document parse(InputStream in) throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
public static final org.w3c.dom.Document parse(Reader in) throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
public static final org.w3c.dom.Document parse(File file) throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
public static final org.w3c.dom.Document parse(URL url) throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
public static final org.w3c.dom.Document parse(String xml) throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
public static final void print(org.w3c.dom.Document document, Writer out) throws IOException
IOException
public static final void print(org.w3c.dom.Document document, OutputStream out) throws IOException
IOException
public static final void print(org.w3c.dom.Document document, File file) throws IOException
IOException
public static final String print(org.w3c.dom.Document document) throws IOException
IOException
public static final void transform(Reader xml, Reader xsl, Writer result) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public static final org.w3c.dom.Node xpath(org.w3c.dom.Node base, String xpath) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public static final org.w3c.dom.NodeList xpathList(org.w3c.dom.Node base, String xpath) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public 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 javax.xml.transform.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
javax.xml.transform.TransformerException
public static final void transform(Reader xml, Reader xsl, Writer result, Map parameters) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public static final void transform(InputStream xml, InputStream xsl, OutputStream result) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public static final String transform(String xml, String xsl) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public static final org.w3c.dom.Document transform(org.w3c.dom.Document xml, org.w3c.dom.Document xsl) throws javax.xml.parsers.ParserConfigurationException, javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException
|
OSCore Project Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |