Package com.ibm.commons.xml

Examples of com.ibm.commons.xml.XPathContext


        return data.xpContext;
    }
   
    public void pushXPathContext(Document doc, String xpath) throws XMLException {
        UserData data = getUserData(doc);
        data.xpContext = new XPathContext(doc,data.xpContext,xpath);
    }
View Full Code Here


        return data.xpContext;
    }
   
    public void pushXPathContext(Document doc, String xpath) throws XMLException {
        UserData data = getUserData(doc);
        data.xpContext = new XPathContext(doc,data.xpContext,xpath);
    }
View Full Code Here

     * @see com.ibm.commons.xml.xpath.XPathExpression#popXPathContext(java.lang.Object)
     */
    public void popXPathContext(Object node) throws XPathException {
        try {
            Document document = getDocument(node);
            XPathContext context = DOMUtil.getXPathContext(document);
            if (context != null && context.getExpression().equals(getExpression())) {
                DOMUtil.popXPathContext(document);
            }
        }
        catch (XMLException xe) {
            throw new XPathException(xe);
View Full Code Here

     * @see com.ibm.commons.xml.xpath.AbstractSimpleExpression#eval(java.lang.Object, com.ibm.commons.xml.NamespaceContext)
     */
    protected XResult doEval(Object node, NamespaceContext namespaceContext) throws XPathException {
        if (!isFromRoot() && node instanceof Document) {
            Document document = (Document)node;
            XPathContext pathContext = DOMUtil.getXPathContext(document);
            if (pathContext != null) {
                node = pathContext.getContextNodes();
                // create the context nodes if they don't exist
                if (node == null) {
                  try {
                    pathContext.createNodes();
                  }
                  catch (XMLException xe) {
                    throw new XPathException(xe);
                  }
                    node = pathContext.getContextNodes();
                }
            }
        }
        if (node == null) {
            throw new XPathException(new NullPointerException("Cannot evaluate an XPath on a null object")); // $NLS-XmlSimpleExpression.CannotevaluateanXPathonanullobjec-1$
View Full Code Here

     * @see com.ibm.commons.xml.xpath.AbstractSimpleExpression#setValue(java.lang.Object, java.lang.Object, com.ibm.commons.xml.NamespaceContext, boolean)
     */
    protected  void doSetValue(Object node, Object value, NamespaceContext namespaceContext, boolean autoCreate) throws XPathException {
        if (node instanceof Document) {
            Document document = (Document)node;
            XPathContext pathContext = DOMUtil.getXPathContext(document);
            if (pathContext != null) {
                node = pathContext.getContextNodes();
               
                // create the nodes if auto creating
                if (node == null && autoCreate) {
                    try {
                        pathContext.createNodes();
                        node = ((NodeList)pathContext.getContextNodes()).item(0);
                    }
                    catch (XMLException xe) {
                        throw new XPathException(xe);
                    }
                }
View Full Code Here

     * @see com.ibm.commons.xml.xpath.XPathExpression#popXPathContext(java.lang.Object)
     */
    public void popXPathContext(Object node) throws XPathException {
        try {
            Document document = getDocument(node);
            XPathContext context = DOMUtil.getXPathContext(document);
            if (context != null && context.getExpression().equals(getExpression())) {
                DOMUtil.popXPathContext(document);
            }
        }
        catch (XMLException xe) {
            throw new XPathException(xe);
View Full Code Here

     * @see com.ibm.xfaces.xpath.XPathExpression#eval(java.lang.Object)
     */
    protected XResult doEval(Object node, NamespaceContext namespaceContext) throws XPathException {
        if (node instanceof Document) {
            Document document = (Document)node;
            XPathContext pathContext = DOMUtil.getXPathContext(document);
            if (pathContext != null) {
                node = pathContext.getContextNodes();
                // create the context nodes if they don't exist
                if (node == null) {
                  try {
                    pathContext.createNodes();
                  }
                  catch (XMLException xe) {
                    throw new XPathException(xe);
                  }
                    node = pathContext.getContextNodes();
                }
            }
        }
        if (node == null) {
            throw new XPathException(new NullPointerException("Cannot evaluate an XPath on a null object")); // $NLS-XmlComplexExpression.CannotevaluateanXPathonanullobjec-1$
View Full Code Here

        return data.xpContext;
    }
   
    public void pushXPathContext(Document doc, String xpath) throws XMLException {
        UserData data = getUserData(doc);
        data.xpContext = new XPathContext(doc,data.xpContext,xpath);
    }
View Full Code Here

TOP

Related Classes of com.ibm.commons.xml.XPathContext

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.