|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.json.xml.XMLToJSONTransformer
This class is a static helper for various ways of converting an XML document/InputStream into a JSON stream or String.
For example, the XML document:
Constructor Summary | |
---|---|
XMLToJSONTransformer()
|
Method Summary | |
---|---|
static java.lang.String |
transform(java.io.File xmlFile)
Method to take an XML file and return a String of the JSON format. |
static java.lang.String |
transform(java.io.File xmlFile,
boolean verbose)
Method to take an XML file and return a String of the JSON format. |
static java.lang.String |
transform(java.io.InputStream xmlStream)
Method to take an input stream to an XML document and return a String of the JSON format. |
static java.lang.String |
transform(java.io.InputStream xmlStream,
boolean verbose)
Method to take an input stream to an XML document and return a String of the JSON format. |
static void |
transform(java.io.InputStream XMLStream,
java.io.OutputStream JSONStream)
Method to do the transform from an XML input stream to a JSON stream. |
static void |
transform(java.io.InputStream XMLStream,
java.io.OutputStream JSONStream,
boolean verbose)
Method to do the transform from an XML input stream to a JSON stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLToJSONTransformer()
Method Detail |
public static void transform(java.io.InputStream XMLStream, java.io.OutputStream JSONStream) throws org.xml.sax.SAXException, java.io.IOException
XMLStream
- The XML stream to convert to JSONJSONStream
- The stream to write out JSON to. The contents written to this stream are always in UTF-8 format.
org.xml.sax.SAXException
- Thrown is a parse error occurs.
java.io.IOException
- Thrown if an IO error occurs.public static void transform(java.io.InputStream XMLStream, java.io.OutputStream JSONStream, boolean verbose) throws org.xml.sax.SAXException, java.io.IOException
XMLStream
- The XML stream to convert to JSONJSONStream
- The stream to write out JSON to. The contents written to this stream are always in UTF-8 format.verbose
- Flag to denote whether or not to render the JSON text in verbose (indented easy to read), or compact (not so easy to read, but smaller), format.
org.xml.sax.SAXException
- Thrown if a parse error occurs.
java.io.IOException
- Thrown if an IO error occurs.public static java.lang.String transform(java.io.InputStream xmlStream) throws org.xml.sax.SAXException, java.io.IOException
xmlStream
- The InputStream to an XML document to transform to JSON.
org.xml.sax.SAXException
- Thrown if an error occurs during parse.
java.io.IOException
- Thrown if an IOError occurs.public static java.lang.String transform(java.io.InputStream xmlStream, boolean verbose) throws org.xml.sax.SAXException, java.io.IOException
xmlStream
- The InputStream to an XML document to transform to JSON.verbose
- Boolean flag denoting whther or not to write the JSON in verbose (formatted), or compact form (no whitespace)
org.xml.sax.SAXException
- Thrown if an error occurs during parse.
java.io.IOException
- Thrown if an IOError occurs.public static java.lang.String transform(java.io.File xmlFile, boolean verbose) throws org.xml.sax.SAXException, java.io.IOException
xmlFile
- The XML file to transform to JSON.verbose
- Boolean flag denoting whther or not to write the JSON in verbose (formatted), or compact form (no whitespace)
org.xml.sax.SAXException
- Thrown if an error occurs during parse.
java.io.IOException
- Thrown if an IOError occurs.public static java.lang.String transform(java.io.File xmlFile) throws org.xml.sax.SAXException, java.io.IOException
xmlFile
- The XML file to convert to JSON.
org.xml.sax.SAXException
- Thrown if an error occurs during parse.
java.io.IOException
- Thrown if an IOError occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |