Package mf.org.apache.xml.serialize

Examples of mf.org.apache.xml.serialize.Serializer


                    fSerializerFactory = SerializerFactory.getSerializerFactory(Method.XML);
                }

                // there doesn't seem to be a way to reset a serializer, so we need to make
                // a new one each time.
                Serializer ser;
                if (streamResult.getWriter() != null) {
                    ser = fSerializerFactory.makeSerializer(streamResult.getWriter(), new OutputFormat());
                }
                else if (streamResult.getOutputStream() != null) {
                    ser = fSerializerFactory.makeSerializer(streamResult.getOutputStream(), new OutputFormat());
                }
                else if (streamResult.getSystemId() != null) {
                    String uri = streamResult.getSystemId();
                    OutputStream out = XMLEntityManager.createOutputStream(uri);
                    ser = fSerializerFactory.makeSerializer(out, new OutputFormat());
                }
                else {
                    throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(fComponentManager.getLocale(),
                        "StreamResultNotInitialized", null));
                }

                // we're using the parser only as an XNI-to-SAX converter,
                // so that we can use the SAX-based serializer
                SAXParser parser = (SAXParser) fParser.get();
                if (newConfig || parser == null) {
                    parser = new SAXParser(config);
                    fParser = new SoftReference(parser);
                }
                else {
                    parser.reset();
                }
                config.setDocumentHandler(fSchemaValidator);
                fSchemaValidator.setDocumentHandler(parser);
                parser.setContentHandler(ser.asContentHandler());
            }
            else {
                fSchemaValidator.setDocumentHandler(null);
            }
           
View Full Code Here

TOP

Related Classes of mf.org.apache.xml.serialize.Serializer

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.