Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMException


        if (lastNode != null) {
            return lastNode.isComplete() ? lastNode.getParent() : (OMContainer)lastNode;
        } else if (document != null) {
            return document;
        } else {
            throw new OMException("Unexpected event. There is no container to add the node to.");
        }
    }
View Full Code Here


                // Ignore
            }
            try {
                reader.parse(source.getInputSource());
            } catch (IOException ex) {
                throw new OMException(ex);
            } catch (SAXException ex) {
                throw new OMException(ex);
            }
        }
        if (document != null && document.isComplete()) {
            return document;
        } else {
            throw new OMException("Tree not complete");
        }
    }
View Full Code Here

     */
    public OMElement getRootElement() {
        if (root != null && root.isComplete()) {
            return root;
        } else {
            throw new OMException("Tree not complete");
        }
    }
View Full Code Here

        }
        removeCalled = true;

        // since this acts on the last child there is no need to mess with the current child
        if (lastChild == null) {
            throw new OMException("cannot remove a child at this stage!");
        }
        lastChild.detach();
    }
View Full Code Here

    public void init(InputStream inputStream, String charSetEncoding, String url,
                     String contentType) throws OMException {
        try {
            this.parser = StAXUtils.createXMLStreamReader(inputStream);
        } catch (XMLStreamException e1) {
            throw new OMException(e1);
        }
        omfactory = (OMFactoryEx)OMAbstractFactory.getOMFactory();
    }
View Full Code Here

                dataHandlerObject = dataHandlerReader.getDataHandlerProvider();
            } else {
                try {
                    dataHandlerObject = dataHandlerReader.getDataHandler();
                } catch (XMLStreamException ex) {
                    throw new OMException(ex);
                }
            }
            OMText text = omfactory.createOMText(target, dataHandlerObject, dataHandlerReader.isOptimized(), true);
            String contentID = dataHandlerReader.getContentID();
            if (contentID != null) {
View Full Code Here

//        }
        try {

            if (container instanceof OMDocument) {
                if (container != document) {
                    throw new OMException("Called discard for a document that is not being built by this builder");
                }
                while (parserNext() != XMLStreamConstants.END_DOCUMENT) {
                    // Just loop
                }
            } else {
                // Calculate the depth of the element to be discarded. This determines how many
                // END_ELEMENT events we need to consume.
                int targetDepth = elementLevel-1;
                OMContainerEx current = target;
                while (current != container) {
                    if (current instanceof OMElement) {
                        targetDepth--;
                        current = (OMContainerEx)((OMElement)current).getParent();
                    } else {
                        throw new OMException("Called discard for an element that is not being built by this builder");
                    }
                }
                while (elementLevel > targetDepth) {
                    parserNext();
                }
            }

            // Mark nodes as discarded
            OMContainerEx current = target;
            while (true) {
                discarded(current);
                if (current == container) {
                    break;
                }
                current = (OMContainerEx)((OMElement)current).getParent();
            }
           
            if (container instanceof OMDocument) {
                target = null;
                done = true;
            } else {
                target = (OMContainerEx)((OMElement)container).getParent();
            }
        } catch (XMLStreamException e) {
            throw new OMException(e);
        }
    }
View Full Code Here

     */
    public int getNamespaceCount() throws OMException {
        try {
            return parser.getNamespaceCount();
        } catch (Exception e) {
            throw new OMException(e);
        }
    }
View Full Code Here

     */
    public String getNamespacePrefix(int index) throws OMException {
        try {
            return parser.getNamespacePrefix(index);
        } catch (Exception e) {
            throw new OMException(e);
        }
    }
View Full Code Here

     */
    public String getNamespaceUri(int index) throws OMException {
        try {
            return parser.getNamespaceURI(index);
        } catch (Exception e) {
            throw new OMException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMException

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.