public class XmlHelper extends Object
| Constructor and Description |
|---|
XmlHelper() |
| Modifier and Type | Method and Description |
|---|---|
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,
org.pentaho.platform.api.engine.IDocumentResourceLoader loader) |
static InputStream |
getLocalizedXsl(String path,
String xslName,
org.pentaho.platform.api.engine.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,
org.pentaho.platform.api.engine.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,
org.pentaho.platform.api.engine.IDocumentResourceLoader loader)
Use the transform specified by xslName and transform the document specified by docInStrm, and return the
resulting document.
|
public static String listToXML(List l) throws UnsupportedOperationException
UnsupportedOperationExceptionpublic static String listToXML(List l, String indent) throws UnsupportedOperationException
UnsupportedOperationExceptionpublic static String mapToXML(Map m) throws UnsupportedOperationException
UnsupportedOperationExceptionpublic static String mapToXML(Map mp, String indent) throws UnsupportedOperationException
UnsupportedOperationExceptionpublic static void decode(String[] strings)
public static void encode(String[] strings)
public static String getEncoding(File f) throws IOException
IOExceptionpublic static String getEncoding(InputStream inStream) throws IOException
IOExceptionpublic static String getEncoding(String xml)
xml - String containing the xmlpublic static String getEncoding(String xml, String defaultEncoding)
xml - String containing the xmldefaultEncoding - Encoding to use if there is no encoding in the xml documentpublic static String readEncodingProcessingInstruction(InputStream inStream) throws IOException
inStream - IOExceptionpublic static final StringBuffer transformXml(String xslName, String xslPath, String strDocument, Map params, org.pentaho.platform.api.engine.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 xslNameuri - 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, org.pentaho.platform.api.engine.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, org.pentaho.platform.api.engine.IDocumentResourceLoader loader)
path - xslName - public static InputStream getLocalizedFile(String fullPath, Locale locale, org.pentaho.platform.api.engine.IDocumentResourceLoader loader)