|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.platform.util.xml.XmlHelper
public class XmlHelper
A set of static methods for performing various operations on DOM Documents and XML text (in the form of streams, Strings, and files). The operations include creating DOM Documents (dom4j) transforming DOM Documents creating XML from Objects, Lists and Maps creating Lists or Maps from XML getting an XML node's text
Constructor Summary | |
---|---|
XmlHelper()
|
Method Summary | |
---|---|
static java.lang.String |
createXmlProcessingInstruction(java.lang.String version,
java.lang.String encoding)
|
static java.lang.String |
decode(java.lang.String string)
|
static void |
decode(java.lang.String[] strings)
|
static java.lang.String |
encode(java.lang.String string)
|
static void |
encode(java.lang.String[] strings)
|
static java.lang.String |
getEncoding(java.io.File f)
|
static java.lang.String |
getEncoding(java.io.InputStream inStream)
|
static java.lang.String |
getEncoding(java.lang.String xml)
Find the character encoding specification in the xml String. |
static java.lang.String |
getEncoding(java.lang.String xml,
java.lang.String defaultEncoding)
Find the character encoding specification in the xml String. |
static java.io.InputStream |
getLocalizedFile(java.lang.String fullPath,
java.util.Locale locale,
IDocumentResourceLoader loader)
|
static java.io.InputStream |
getLocalizedXsl(java.lang.String path,
java.lang.String xslName,
IDocumentResourceLoader loader)
Get the File object corresponding to the path, filename (xslName), and locale. |
static java.lang.String |
listToXML(java.util.List l)
|
static java.lang.String |
listToXML(java.util.List l,
java.lang.String indent)
|
static java.lang.String |
mapToXML(java.util.Map m)
|
static java.lang.String |
mapToXML(java.util.Map mp,
java.lang.String indent)
|
static java.lang.String |
readEncodingProcessingInstruction(java.io.InputStream inStream)
WARNING: if the inStream instance does not support mark/reset, when this method returns, subsequent reads on inStream will be 256 bytes into the stream. |
static java.lang.StringBuffer |
transformXml(java.io.InputStream xslInStream,
java.io.InputStream docInStrm,
java.util.Map params,
javax.xml.transform.URIResolver resolver)
Use the transform specified by xslSrc and transform the document specified by docSrc, and return the resulting document. |
static java.lang.StringBuffer |
transformXml(java.lang.String xslName,
java.lang.String xslPath,
java.io.InputStream docInStrm,
java.util.Map params,
IDocumentResourceLoader loader)
Use the transform specified by xslPath and xslName and transform the document specified by docInStrm, and return the resulting document. |
static java.lang.StringBuffer |
transformXml(java.lang.String xslName,
java.lang.String xslPath,
java.lang.String strDocument,
java.util.Map params,
IDocumentResourceLoader loader)
Use the transform specified by xslName and transform the document specified by docInStrm, and return the resulting document. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlHelper()
Method Detail |
---|
public static java.lang.String listToXML(java.util.List l) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public static java.lang.String listToXML(java.util.List l, java.lang.String indent) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public static java.lang.String mapToXML(java.util.Map m) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public static java.lang.String mapToXML(java.util.Map mp, java.lang.String indent) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public static void decode(java.lang.String[] strings)
public static java.lang.String decode(java.lang.String string)
public static void encode(java.lang.String[] strings)
public static java.lang.String encode(java.lang.String string)
public static java.lang.String getEncoding(java.io.File f) throws java.io.IOException
java.io.IOException
public static java.lang.String getEncoding(java.io.InputStream inStream) throws java.io.IOException
java.io.IOException
public static java.lang.String getEncoding(java.lang.String xml)
xml
- String containing the xml
public static java.lang.String getEncoding(java.lang.String xml, java.lang.String defaultEncoding)
xml
- String containing the xmldefaultEncoding
- Encoding to use if there is no encoding in the xml document
public static java.lang.String readEncodingProcessingInstruction(java.io.InputStream inStream) throws java.io.IOException
inStream
-
java.io.IOException
public static final java.lang.StringBuffer transformXml(java.lang.String xslName, java.lang.String xslPath, java.lang.String strDocument, java.util.Map params, IDocumentResourceLoader loader) throws javax.xml.transform.TransformerException
xslName
- String containing the name of a file in the repository containing the xsl transformxslPath
- String containing the path to the file identifyied by xslName
uri
- String containing the URI of a resource containing the document to be transformedparams
- Map of properties to set on the transformsession
- IPentahoSession containing a URIResolver instance to resolve URI's in the output document.
javax.xml.transform.TransformerException
- If attempt to transform the document fails.public static final java.lang.StringBuffer transformXml(java.lang.String xslName, java.lang.String xslPath, java.io.InputStream docInStrm, java.util.Map params, IDocumentResourceLoader loader) throws javax.xml.transform.TransformerException
xslSrc
- StreamSrc containing the xsl transformdocSrc
- StreamSrc containing the document to be transformedparams
- Map of properties to set on the transformsession
- IPentahoSession containing a URIResolver instance to resolve URI's in the output document.
javax.xml.transform.TransformerException
- If attempt to transform the document fails.public static final java.lang.StringBuffer transformXml(java.io.InputStream xslInStream, java.io.InputStream docInStrm, java.util.Map params, javax.xml.transform.URIResolver resolver) throws javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
xslInStream
- InputStream containing the xsl transformdocInStrm
- InputStream containing the document to be transformedparams
- Map of properties to set on the transformresolver
- URIResolver instance to resolve URI's in the output document.
javax.xml.transform.TransformerConfigurationException
- if the TransformerFactory fails to create a Transformer.
javax.xml.transform.TransformerException
- if actual transform fails.public static final java.io.InputStream getLocalizedXsl(java.lang.String path, java.lang.String xslName, IDocumentResourceLoader loader)
path
- xslName
-
public static java.io.InputStream getLocalizedFile(java.lang.String fullPath, java.util.Locale locale, IDocumentResourceLoader loader)
public static java.lang.String createXmlProcessingInstruction(java.lang.String version, java.lang.String encoding)
version
- encoding
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |