Package javax.xml.transform.sax

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


            StringWriter writer = new StringWriter();
            TransformerHandler probe = FACTORY.newTransformerHandler();
            probe.setResult(new StreamResult(writer));
            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) {
View Full Code Here


            handler.getTransformer().setOutputProperties(format);

            // 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();
View Full Code Here

            ((SAXTransformerFactory) tf).newTransformerHandler();
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        StreamResult result = new StreamResult(bOut);
        th.setResult(result);
        th.startDocument();
        th.startElement(
            NAMESPACE,
            COLLECTION_NAME,
            PREFIX + ":" + COLLECTION_NAME,
            new AttributesImpl());
        this.resourcesToSax(resources, th);
View Full Code Here

            StringWriter writer = new StringWriter();
            TransformerHandler probe = factory.newTransformerHandler();
            probe.setResult(new StreamResult(writer));
            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,
View Full Code Here

                ch.startDocument();
                AttributesImpl atts = new AttributesImpl();
                if (this.shareSelf != null) {
                    atts.addAttribute("", "share-self", "share-self", "CDATA", this.shareSelf);
                }
                ch.startElement("", "classloader", "classloader", atts);
                atts.clear();
                ch.startElement("", "classpath", "classpath", atts);
                SortedSet<Artifact> sortedArtifacts = new TreeSet<Artifact>(dependenciesToList);
                Entry entry;
                String entryShare;
View Full Code Here

                if (this.shareSelf != null) {
                    atts.addAttribute("", "share-self", "share-self", "CDATA", this.shareSelf);
                }
                ch.startElement("", "classloader", "classloader", atts);
                atts.clear();
                ch.startElement("", "classpath", "classpath", atts);
                SortedSet<Artifact> sortedArtifacts = new TreeSet<Artifact>(dependenciesToList);
                Entry entry;
                String entryShare;
                String entryVersion;
                for (Artifact artifact : sortedArtifacts) {
View Full Code Here

                            atts.addAttribute("", "", "share", "CDATA", entryShare);
                        }
                    } else {
                        // atts.addAttribute("", "", "share", "CDATA", SHARE_DEFAULT);
                    }
                    ch.startElement("", "artifact", "artifact", atts);
                    ch.endElement("", "artifact", "artifact");
                    atts.clear();
                }
                ch.endElement("", "classpath", "classpath");
                ch.endElement("", "classloader", "classloader");
View Full Code Here

        for(Iterator iter = comments.iterator(); iter.hasNext();) {
            char[] comment = String.valueOf(iter.next()).toCharArray();
            handler.comment(comment, 0, comment.length);
        }
        AttributesImpl attributes = new AttributesImpl();
        handler.startElement(null, "plist", "plist", attributes);
        serializeMap(propertyList, handler);
        handler.endElement(null, "plist", "plist");

        handler.endDocument();
    }
View Full Code Here

        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        StreamResult result = new StreamResult(bOut);
        th.setResult(result);
        th.startDocument();
        th.startPrefixMapping(PREFIX, NAMESPACE);
        th.startElement(NAMESPACE, COLLECTION_NAME, PREFIX + ":" + COLLECTION_NAME, XMLUtils.EMPTY_ATTRIBUTES);
        resourcesToSax(resources, th);
        th.endElement(NAMESPACE, COLLECTION_NAME, PREFIX + ":" + COLLECTION_NAME);
        th.endPrefixMapping(PREFIX);
        th.endDocument();
View Full Code Here

            handler.setResult(new StreamResult(writer));

            // Output a single element
            handler.startDocument();
            handler.startPrefixMapping(prefix, uri);
            handler.startElement(uri, "element", "element", XMLUtils.EMPTY_ATTRIBUTES);
            handler.endElement(uri, "element", "element");
            handler.endPrefixMapping(prefix);
            handler.endDocument();

            String text = writer.toString();
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.