Package org.codehaus.stax2

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


            // and then the same for empty elem
            sw = getDTDValidatingWriter(strw, SIMPLE_NS_DTD, true, repairing);
            // prefix, local name, uri (for elems)
            try {
                sw.writeEmptyElement(NS_PREFIX2, NS_URI, "root");
                fail(modeDesc+" Expected a validation exception when passing wrong (unexpected) ns for element");
            } catch (XMLValidationException vex) {
                // expected...
            }
View Full Code Here


            // Oh, and finally, using non-ns DTD:
            sw = getDTDValidatingWriter(strw, SIMPLE_DTD, true, repairing);
            // prefix, local name, uri (for elems)
            try {
                sw.writeEmptyElement(NS_PREFIX, NS_URI, "root");
                fail(modeDesc+" Expected a validation exception when passing wrong (unexpected) ns for element");
            } catch (XMLValidationException vex) {
                // expected...
            }
        }
View Full Code Here

            sw.writeEndElement();
            sw.writeEndDocument();
            sw.close();

            sw = getDTDValidatingWriter(strw, FIXED_DTD_STR, nsAware, repairing);
            sw.writeEmptyElement("root");
            sw.writeEndDocument();
            sw.close();

            // or by using the exact same value
            sw = getDTDValidatingWriter(strw, FIXED_DTD_STR, nsAware, repairing);
View Full Code Here

            }

            // And finally, same for empty elem in case impl. is different
            strw = new StringWriter();
            sw = getDTDValidatingWriter(strw, FIXED_DTD_STR, nsAware, repairing);
            sw.writeEmptyElement("root");
            try {
                sw.writeAttribute("fixAttr", "foobar");
                fail(modeDesc+" Expected a validation exception when trying to add a #FIXED attribute with an empty value");
            } catch (XMLValidationException vex) {
                // expected...
View Full Code Here

            sw.writeEndDocument();
            sw.close();

            // and ditto for empty element:
            sw = getDTDValidatingWriter(strw, REQUIRED_DTD_STR, nsAware, repairing);
            sw.writeEmptyElement("root");
            sw.writeAttribute("reqAttr", "hii & haa");
            sw.writeEndDocument();
            sw.close();
        }
    }
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.