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