Package org.apache.rat.report.xml.writer

Examples of org.apache.rat.report.xml.writer.OperationNotAllowedException


     * if called after the first element has been written
     * or once a prolog has already been written
     */
    public IXmlWriter startDocument() throws IOException {
        if (elementsWritten) {
            throw new OperationNotAllowedException("Document already started");
        }
        if (prologWritten) {
            throw new OperationNotAllowedException("Only one prolog allowed");
        }
        writer.write("<?xml version='1.0'?>");
        prologWritten = true;
        return this;
    }
View Full Code Here


     * @throws OperationNotAllowedException
     * if called after the first element has been closed
     */
    public IXmlWriter openElement(final CharSequence elementName) throws IOException {
        if (elementsWritten && elementNames.isEmpty()) {
            throw new OperationNotAllowedException("Root element already closed. Cannot open new element.");
        }
        if (!isValidName(elementName)) {
            throw new InvalidXmlException("'" + elementName + "' is not a valid element name");
        }
        elementsWritten = true;
View Full Code Here

     * or {@link #closeElement()} or before any call to {@link #openElement(CharSequence)}
     */
    public IXmlWriter attribute(CharSequence name, CharSequence value) throws IOException {
        if (elementNames.isEmpty()) {
            if (elementsWritten) {
                throw new OperationNotAllowedException("Root element has already been closed.");
            } else {
                throw new OperationNotAllowedException("Close called before an element has been opened.");           
            }
        }
        if (!isValidName(name)) {
            throw new InvalidXmlException("'" + name + "' is not a valid attribute name.");
        }
View Full Code Here

     * or after the first element has been closed
     */
    public IXmlWriter content(CharSequence content) throws IOException {
        if (elementNames.isEmpty()) {
            if (elementsWritten) {
                throw new OperationNotAllowedException("Root element has already been closed.");
            } else {
                throw new OperationNotAllowedException("An element must be opened before content can be written.");           
            }
        }
        if (inElement) {
            writer.write('>');
        }
View Full Code Here

     * or after the first element has been closed
     */
    public IXmlWriter closeElement() throws IOException {
        if (elementNames.isEmpty()) {
            if (elementsWritten) {
                throw new OperationNotAllowedException("Root element has already been closed.");
            } else {
                throw new OperationNotAllowedException("Close called before an element has been opened.");           
            }
        }
        final CharSequence elementName = (CharSequence) elementNames.pop();
        if (inElement) {
            writer.write('/');
View Full Code Here

     * if called before any call to {@link #openElement}
     */
    public IXmlWriter closeDocument() throws IOException {
        if (elementNames.isEmpty()) {
            if (!elementsWritten) {
                throw new OperationNotAllowedException("Close called before an element has been opened.");           
            }
        }
        while(!elementNames.isEmpty()) {
            closeElement();
        }
View Full Code Here

     * if called after the first element has been written
     * or once a prolog has already been written
     */
    public IXmlWriter startDocument() throws IOException {
        if (elementsWritten) {
            throw new OperationNotAllowedException("Document already started");
        }
        if (prologWritten) {
            throw new OperationNotAllowedException("Only one prolog allowed");
        }
        writer.write("<?xml version='1.0'?>");
        prologWritten = true;
        return this;
    }
View Full Code Here

     * @throws OperationNotAllowedException
     * if called after the first element has been closed
     */
    public IXmlWriter openElement(final CharSequence elementName) throws IOException {
        if (elementsWritten && elementNames.isEmpty()) {
            throw new OperationNotAllowedException("Root element already closed. Cannot open new element.");
        }
        if (!isValidName(elementName)) {
            throw new InvalidXmlException("'" + elementName + "' is not a valid element name");
        }
        elementsWritten = true;
View Full Code Here

     * or {@link #closeElement()} or before any call to {@link #openElement(CharSequence)}
     */
    public IXmlWriter attribute(CharSequence name, CharSequence value) throws IOException {
        if (elementNames.isEmpty()) {
            if (elementsWritten) {
                throw new OperationNotAllowedException("Root element has already been closed.");
            } else {
                throw new OperationNotAllowedException("Close called before an element has been opened.");           
            }
        }
        if (!isValidName(name)) {
            throw new InvalidXmlException("'" + name + "' is not a valid attribute name.");
        }
View Full Code Here

     * or after the first element has been closed
     */
    public IXmlWriter content(CharSequence content) throws IOException {
        if (elementNames.isEmpty()) {
            if (elementsWritten) {
                throw new OperationNotAllowedException("Root element has already been closed.");
            } else {
                throw new OperationNotAllowedException("An element must be opened before content can be written.");           
            }
        }
        if (inElement) {
            writer.write('>');
        }
View Full Code Here

TOP

Related Classes of org.apache.rat.report.xml.writer.OperationNotAllowedException

Copyright © 2018 www.massapicom. 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.