Package com.granule.json.utils.internal

Examples of com.granule.json.utils.internal.JSONSAXHandler


                 */
                SAXParserFactory factory = SAXParserFactory.newInstance();
                factory.setNamespaceAware(true);
                SAXParser sParser = factory.newSAXParser();
                XMLReader parser = sParser.getXMLReader();
                JSONSAXHandler jsonHandler = new JSONSAXHandler(JSONStream, verbose);
                parser.setContentHandler(jsonHandler);
                parser.setErrorHandler(jsonHandler);
                InputSource source = new InputSource(new BufferedInputStream(XMLStream));

                if (logger.isLoggable(Level.FINEST)) {
                    logger.logp(Level.FINEST, className, "transform", "Parsing the XML content to JSON");
                }

                /**
                 * Parse it.
                 */
                source.setEncoding("UTF-8");
                parser.parse(source);                
                jsonHandler.flushBuffer();
            } catch (javax.xml.parsers.ParserConfigurationException pce) {
                throw new SAXException("Could not get a parser: " + pce.toString());
            }
        }

View Full Code Here

TOP

Related Classes of com.granule.json.utils.internal.JSONSAXHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.