Package org.codehaus.stax2

Examples of org.codehaus.stax2.XMLStreamWriter2.writeNamespace()


        final String URI2 = "http://foo2";
        final String URI3 = "http://foo3";

        sw.writeStartDocument();
        sw.writeStartElement(URI1, "root");
        sw.writeNamespace("foo2", URI2);
        sw.writeDefaultNamespace(URI3);
        sw.writeStartElement(URI3, "leaf");
        sw.writeAttribute(URI2, "ns-attr", "1");
        sw.writeAttribute(null, "ns-attr", "2");
        sw.writeAttribute("otherprefix", URI2, "lastAttr", "x");
View Full Code Here


            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, SIMPLE_NS_DTD, true, repairing);
            // prefix, local name, uri (for elems)
            sw.writeStartElement(NS_PREFIX, "root", NS_URI);
            if (!repairing) {
                sw.writeNamespace(NS_PREFIX, NS_URI);
            }
            sw.writeEndElement();
            sw.writeEndDocument();
            sw.close();
View Full Code Here

            // and same with empty elem
            sw = getDTDValidatingWriter(strw, SIMPLE_NS_DTD, true, repairing);
            sw.writeEmptyElement(NS_PREFIX, "root", NS_URI);
            if (!repairing) {
                sw.writeNamespace(NS_PREFIX, NS_URI);
            }
            sw.writeEndDocument();
            sw.close();
        }
    }
View Full Code Here

             * output namespace declaration, in non-repairing mode.
             */
            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, IMPLIED_NS_DTD_STR, true, repairing);
            sw.writeStartElement("root");
            if (!repairing) {
                sw.writeNamespace(NS_PREFIX, NS_URI);
            }
            // prefix, uri, localname (for attrs!)
            sw.writeAttribute(NS_PREFIX, NS_URI, "attr", "value");
            sw.writeEndElement();
            sw.writeEndDocument();
View Full Code Here

            StringWriter strw = new StringWriter();
            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, IMPLIED_NS_DTD_STR, true, repairing);
            sw.writeStartElement("root");
            if (!repairing) {
                sw.writeNamespace(NS_PREFIX, NS_URI);
            }
            // prefix, uri, localname (for attrs!)
            try {
                sw.writeAttribute(NS_PREFIX2, NS_URI, "attr", "value");
                fail(modeDesc+" Expected a validation exception when trying to add an attribute with wrong ns prefix");
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.