Package org.codehaus.stax2

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


        sw.writeEndElement();
        //sw.writeEmptyElement("secondRoot"); // error!
        sw.writeCharacters("\n"); // white space in epilog
        sw.writeProcessingInstruction("target", "some data");
        sw.writeCharacters("\n"); // white space in epilog
        sw.writeEndDocument();

        sw.flush();
        sw.close();

        System.out.println("DOC = ["+w.toString()+"]");
View Full Code Here


            sw.writeStartElement("checksum");
            sw.writeBinaryAttribute("", "", "value", md.digest());
            sw.writeEndElement(); // checksum
        }
        sw.writeEndElement(); // files
        sw.writeEndDocument();
        sw.close();
    }
}
View Full Code Here

        sw.writeEndElement();
        //sw.writeEmptyElement("secondRoot"); // error!
        sw.writeCharacters("\n"); // white space in epilog
        sw.writeProcessingInstruction("target", "some data");
        sw.writeCharacters("\n"); // white space in epilog
        sw.writeEndDocument();

        sw.flush();
        sw.close();

        w.close();
View Full Code Here

        sw.writeAttribute(null, "ns-attr", "2");
        sw.writeAttribute("otherprefix", URI2, "lastAttr", "x");
        sw.writeEndElement();
        sw.writeEndElement();
        sw.writeCharacters("\n"); // to add lf for terminal output
        sw.writeEndDocument();

        sw.flush();
        sw.close();

        w.close();
View Full Code Here

            sw.writeStartElement("branch");
            // Also, all-whitespace is ok in non-mixed too
            sw.writeCharacters("\t \t   \r   \n");
            sw.writeEndElement();
            sw.writeEndElement();
            sw.writeEndDocument();
        }
    }

    public void testInvalidMixedContent()
        throws XMLStreamException
View Full Code Here

            XMLStreamWriter2 sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);

            sw.writeStartElement("root");
            // No content whatsoever is allowed...
            sw.writeEndElement();
            sw.writeEndDocument();
            sw.close();

            // Next; same but with an attribute
            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
View Full Code Here

            sw.writeStartElement("root");
            // no content, but attribute is fine
            sw.writeAttribute("attr", "value");

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

            // And then using empty element write method(s)
            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
            sw.writeEmptyElement("root");
View Full Code Here

            // And then using empty element write method(s)
            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
            sw.writeEmptyElement("root");
            // note: empty element need/can not be closed
            sw.writeEndDocument();
            sw.close();

            // and finally empty with attribute
            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
            sw.writeEmptyElement("root");
View Full Code Here

            // and finally empty with attribute
            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
            sw.writeEmptyElement("root");
            sw.writeAttribute("attr", "otherValue");
            sw.writeEndDocument();
            sw.close();
        }
    }

    public void testInvalidEmptyContent()
View Full Code Here

            sw.writeStartElement("root");
            sw.writeStartElement("leaf");
            sw.writeCharacters("whatever");
            sw.writeEndElement();
            sw.writeEndElement();
            sw.writeEndDocument();
            sw.close();

            // Then one with no content
            sw = getDTDValidatingWriter(strw, dtdStr, nsAware, repairing);
            sw.writeStartElement("root");
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.