|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 String |
createXmlProcessingInstruction(String version,
String encoding)
|
static String |
decode(String string)
|
static void |
decode(String[] strings)
|
static String |
encode(String string)
|
static void |
encode(String[] strings)
|
static String |
getEncoding(File f)
|
static String |
getEncoding(InputStream inStream)
|
static String |
getEncoding(String xml)
Find the character encoding specification in the xml String. |
static String |
getEncoding(String xml,
String defaultEncoding)
Find the character encoding specification in the xml String. |
static InputStream |
getLocalizedFile(String fullPath,
Locale locale,
IDocumentResourceLoader loader)
|
static InputStream |
getLocalizedXsl(String path,
String xslName,
IDocumentResourceLoader loader)
Get the File object corresponding to the path, filename (xslName), and locale. |
static String |
listToXML(List l)
|
static String |
listToXML(List l,
String indent)
|
static String |
mapToXML(Map m)
|
static String |
mapToXML(Map mp,
String indent)
|
static String |
readEncodingProcessingInstruction(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 StringBuffer |
transformXml(InputStream xslInStream,
InputStream docInStrm,
Map params,
URIResolver resolver)
Use the transform specified by xslSrc and transform the document specified by docSrc, and return the resulting document. |
static StringBuffer |
transformXml(String xslName,
String xslPath,
InputStream docInStrm,
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 StringBuffer |
transformXml(String xslName,
String xslPath,
String strDocument,
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 String listToXML(List l) throws UnsupportedOperationException
UnsupportedOperationException
public static String listToXML(List l, String indent) throws UnsupportedOperationException
UnsupportedOperationException
public static String mapToXML(Map m) throws UnsupportedOperationException
UnsupportedOperationException
public static String mapToXML(Map mp, String indent) throws UnsupportedOperationException
UnsupportedOperationException
public static void decode(String[] strings)
public static String decode(String string)
public static void encode(String[] strings)
public static String encode(String string)
public static String getEncoding(File f) throws IOException
IOException
public static String getEncoding(InputStream inStream) throws IOException
IOException
public static String getEncoding(String xml)
xml
- String containing the xml
public static String getEncoding(String xml, String defaultEncoding)
xml
- String containing the xmldefaultEncoding
- Encoding to use if there is no encoding in the xml document
public static String readEncodingProcessingInstruction(InputStream inStream) throws IOException
inStream
-
IOException
public static final StringBuffer transformXml(String xslName, String xslPath, String strDocument, Map params, IDocumentResourceLoader loader) throws 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.
TransformerException
- If attempt to transform the document fails.public static final StringBuffer transformXml(String xslName, String xslPath, InputStream docInStrm, Map params, IDocumentResourceLoader loader) throws 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.
TransformerException
- If attempt to transform the document fails.public static final StringBuffer transformXml(InputStream xslInStream, InputStream docInStrm, Map params, URIResolver resolver) throws TransformerConfigurationException, 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.
TransformerConfigurationException
- if the TransformerFactory fails to create a Transformer.
TransformerException
- if actual transform fails.public static final InputStream getLocalizedXsl(String path, String xslName, IDocumentResourceLoader loader)
path
- xslName
-
public static InputStream getLocalizedFile(String fullPath, Locale locale, IDocumentResourceLoader loader)
public static String createXmlProcessingInstruction(String version, String encoding)
version
- encoding
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |