Package org.codehaus.stax2

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


            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
            sw.writeStartElement("root");
            sw.writeAttribute("attr", "value");
            sw.writeStartElement("leaf");
            sw.writeEndElement();
            sw.writeEndElement();
            sw.writeEndDocument();
            sw.close();
        }
    }
View Full Code Here


            StringWriter strw = new StringWriter();
            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, SIMPLE_DTD, nsAware, repairing);
            sw.writeStartElement("root");
            sw.writeCharacters("  "); // imitating indentation
            sw.writeStartElement("branch");
            sw.writeEndElement();
            sw.writeStartElement("branch");
            sw.writeCharacters("test");
            sw.writeComment("comment");
            sw.writeEndElement();
            sw.writeEmptyElement("branch");
View Full Code Here

            sw.writeStartElement("branch");
            sw.writeEndElement();
            sw.writeStartElement("branch");
            sw.writeCharacters("test");
            sw.writeComment("comment");
            sw.writeEndElement();
            sw.writeEmptyElement("branch");
            sw.writeEmptyElement("end");
            sw.writeAttribute("endAttr", "value");
            sw.writeCharacters("\n"); // imitating indentation
            sw.writeEndElement(); // for root
View Full Code Here

            sw.writeEndElement();
            sw.writeEmptyElement("branch");
            sw.writeEmptyElement("end");
            sw.writeAttribute("endAttr", "value");
            sw.writeCharacters("\n"); // imitating indentation
            sw.writeEndElement(); // for root
        }
    }

    public void testInvalidStructure()
        throws XMLStreamException
View Full Code Here

            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, SIMPLE_DTD, nsAware, repairing);
            sw.writeStartElement("root");
            sw.writeCharacters("  "); // imitating indentation
            sw.writeStartElement("branch");
            sw.writeEndElement();
            sw.writeStartElement("branch");
            sw.writeCharacters("test");
            sw.writeComment("comment");
            sw.writeEndElement();
            sw.writeEmptyElement("branch");
View Full Code Here

            sw.writeStartElement("branch");
            sw.writeEndElement();
            sw.writeStartElement("branch");
            sw.writeCharacters("test");
            sw.writeComment("comment");
            sw.writeEndElement();
            sw.writeEmptyElement("branch");
            sw.writeCharacters("\n"); // imitating indentation
            try {
                sw.writeEndElement(); // for root
                fail(modeDesc+" Expected a validation exception when omitting non-optional <end> element");
View Full Code Here

            sw.writeComment("comment");
            sw.writeEndElement();
            sw.writeEmptyElement("branch");
            sw.writeCharacters("\n"); // imitating indentation
            try {
                sw.writeEndElement(); // for root
                fail(modeDesc+" Expected a validation exception when omitting non-optional <end> element");
            } catch (XMLValidationException vex) {
                // expected...
            }
            // should not continue after exception; state may not be valid
View Full Code Here

            // 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();

            // and same with empty elem
            sw = getDTDValidatingWriter(strw, SIMPLE_NS_DTD, true, repairing);
View Full Code Here

            StringWriter strw = new StringWriter();

            // Ok either without being added:
            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, FIXED_DTD_STR, nsAware, repairing);
            sw.writeStartElement("root");
            sw.writeEndElement();
            sw.writeEndDocument();
            sw.close();

            sw = getDTDValidatingWriter(strw, FIXED_DTD_STR, nsAware, repairing);
            sw.writeEmptyElement("root");
View Full Code Here

            // or by using the exact same value
            sw = getDTDValidatingWriter(strw, FIXED_DTD_STR, nsAware, repairing);
            sw.writeStartElement("root");
            sw.writeAttribute("fixAttr", "fixedValue");
            sw.writeEndElement();
            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.