Package javax.xml.transform.sax

Examples of javax.xml.transform.sax.TransformerHandler.endDocument()


            transformerHandler = FACTORY.newTransformerHandler();
            transformerHandler.getTransformer().setOutputProperties(format);
            transformerHandler.setResult(new StreamResult(writer));
            transformerHandler.startDocument();
            xml.toSAX(new EmbeddedXMLPipe(transformerHandler));
            transformerHandler.endDocument();

            return writer.toString();
        } catch (TransformerException e) {
            throw new ProcessingException("TransformerException: " + e, e);
        } catch (SAXException e) {
View Full Code Here


            probe.startDocument();
            probe.startPrefixMapping("p", "uri");
            probe.startElement("uri", "e", "p:e", new AttributesImpl());
            probe.endElement("uri", "e", "p:e");
            probe.endPrefixMapping("p");
            probe.endDocument();
            return writer.toString().indexOf("xmlns") == -1;
        } catch (Exception e) {
            throw new UnsupportedOperationException("XML serialization fails");
        }
    }
View Full Code Here

            // Output a single element
            handler.startDocument();
            handler.startPrefixMapping(prefix, uri);
            handler.startElement(uri, "element", "", new AttributesImpl());
            handler.endPrefixMapping(prefix);
            handler.endDocument();

            String text = writer.toString();

            // Check if the namespace is there (replace " by ' to be sure of what we search in)
            boolean needsIt = (text.replace('"', '\'').indexOf(check) == -1);
View Full Code Here

        if (getContext() == null) {
            th.startDocument();
        }
        ms.marshal(obj, th);
        if (getContext() == null) {
            th.endDocument();
        }
    }
   
    public void setOutTemplate(String loc) {
        outTemplates = createTemplates(loc);
View Full Code Here

            final StreamResult result = new StreamResult(os);
            handler.setResult(result);
           
      handler.startDocument();
      srcDoc.toSAX(broker, handler, null);
      handler.endDocument();
     
      return os.toByteArray();
        }
    }
   
View Full Code Here

            Transformer transformer = handler.getTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
            handler.setResult(res);
            handler.startDocument();
            object.toSAX(handler);
            handler.endDocument();
        } catch (TransformerConfigurationException e) {
            throw new IOException(e.getMessage());
        } catch (TransformerFactoryConfigurationError e) {
            throw new IOException(e.getMessage());
        } catch (SAXException e) {
View Full Code Here

        this.resourcesToSax(resources, th);
        th.endElement(
            NAMESPACE,
            COLLECTION_NAME,
            PREFIX + ":" + COLLECTION_NAME);
        th.endDocument();
        return new ByteArrayInputStream(bOut.toByteArray());
    }

    private void resourcesToSax(
        WebdavResource[] resources,
View Full Code Here

            probe.startDocument();
            probe.startPrefixMapping("p", "uri");
            probe.startElement("uri", "e", "p:e", new AttributesImpl());
            probe.endElement("uri", "e", "p:e");
            probe.endPrefixMapping("p");
            probe.endDocument();
            if (writer.toString().indexOf("xmlns") == -1) {
                // The serializer does not output xmlns declarations,
                // so we need to do it explicitly with this wrapper
                return new SerializingContentHandler(handler);
            } else {
View Full Code Here

                    ch.endElement("", "artifact", "artifact");
                    atts.clear();
                }
                ch.endElement("", "classpath", "classpath");
                ch.endElement("", "classloader", "classloader");
                ch.endDocument();
                fos.close();
                if(entryMap.size() > 0) {
                    getLog().warn("Classloader template contains entries that could not be resolved.");
                }
            } catch (TransformerConfigurationException ex) {
View Full Code Here

        AttributesImpl attributes = new AttributesImpl();
        handler.startElement(null, "plist", "plist", attributes);
        serializeMap(propertyList, handler);
        handler.endElement(null, "plist", "plist");

        handler.endDocument();
    }

    /**
     * Serialize a map as a dict element.
     * @param map map to serialize.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.