Package org.apache.commons.jxpath

Examples of org.apache.commons.jxpath.JXPathException


                factories[i].createNodePointer(parent, name, bean);
            if (pointer != null) {
                return pointer;
            }
        }
        throw new JXPathException(
            "Could not allocate a NodePointer for object of "
                + bean.getClass());
    }
View Full Code Here


    public NodePointer createChild(
        JXPathContext context,
        QName name,
        int index,
        Object value) {
        throw new JXPathException("Cannot create an object for path "
                + asPath() + "/" + name + "[" + (index + 1) + "]"
                + ", operation is not allowed for this type of node");
    }
View Full Code Here

     * @param name the QName at which a child should be created
     * @param index child index.
     * @return created NodePointer
     */
    public NodePointer createChild(JXPathContext context, QName name, int index) {
        throw new JXPathException("Cannot create an object for path "
                + asPath() + "/" + name + "[" + (index + 1) + "]"
                + ", operation is not allowed for this type of node");
    }
View Full Code Here

     * @param context the owning JXPathCOntext
     * @param name the QName at which an attribute should be created
     * @return created NodePointer
     */
    public NodePointer createAttribute(JXPathContext context, QName name) {
        throw new JXPathException("Cannot create an attribute for path "
                + asPath() + "/@" + name
                + ", operation is not allowed for this type of node");
    }
View Full Code Here

        //henceforth depth1 == depth2:
        if (p1 == p2 || p1 != null && p1.equals(p2)) {
            return 0;
        }
        if (depth1 == 1) {
            throw new JXPathException(
                    "Cannot compare pointers that do not belong to the same tree: '"
                    + p1 + "' and '" + p2 + "'");
        }
        int r = compareNodePointers(p1.parent, depth1 - 1, p2.parent, depth2 - 1);
        return r == 0 ? p1.parent.compareChildNodePointers(p1, p2) : r;
View Full Code Here

     * @return AbstractFactory
     */
    protected AbstractFactory getAbstractFactory(JXPathContext context) {
        AbstractFactory factory = context.getFactory();
        if (factory == null) {
            throw new JXPathException(
                "Factory is not set on the JXPathContext - cannot create path: "
                    + asPath());
        }
        return factory;
    }
View Full Code Here

     *              determines which parser should be used to load the XML.
     */
    public DocumentContainer(URL xmlURL, String model) {
        this.xmlURL = xmlURL;
        if (xmlURL == null) {
            throw new JXPathException("XML URL is null");
        }
        this.model = model;
    }
View Full Code Here

                        stream.close();
                    }
                }
            }
            catch (IOException ex) {
                throw new JXPathException(
                    "Cannot read XML from: " + xmlURL.toString(),
                    ex);
            }
        }
        return document;
View Full Code Here

    private static XMLParser getParser(String model) {
        XMLParser parser = (XMLParser) parsers.get(model);
        if (parser == null) {
            String className = (String) parserClasses.get(model);
            if (className == null) {
                throw new JXPathException("Unsupported XML model: " + model);
            }
            try {
                Class clazz = Class.forName(className);
                parser = (XMLParser) clazz.newInstance();
            }
            catch (Exception ex) {
                throw new JXPathException(
                    "Cannot allocate XMLParser: " + className, ex);
            }
            parsers.put(model, parser);
        }
        return parser;
View Full Code Here

*/
public class JDOMParser extends XMLParser2 {

    public Object parseXML(InputStream stream) {
        if (!isNamespaceAware()) {
            throw new JXPathException("JDOM parser configuration error. JDOM "
                    + "does not support the namespaceAware=false setting.");
        }

        try {
            SAXBuilder builder = new SAXBuilder();
            builder.setExpandEntities(isExpandEntityReferences());
            builder.setIgnoringElementContentWhitespace(
                    isIgnoringElementContentWhitespace());
            builder.setValidation(isValidating());
            return builder.build(stream);
        }
        catch (Exception ex) {
            throw new JXPathException("JDOM parser error", ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.JXPathException

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.