Package com.ibm.commons.xml.xpath

Examples of com.ibm.commons.xml.xpath.XPathExpression


   
    XmlDataHandler dataHandler = new XmlDataHandler(doc, nameSpaceCtx);
    List<Node> nodeEntries = dataHandler.getEntries(ConnectionsFeedXpath.Entry);
    List<Activity> activities = new ArrayList<Activity>();
    for (Node node : nodeEntries) {
      XPathExpression xpath = (node instanceof Document) ? (XPathExpression)AtomXPath.singleEntry.getPath() : null;
      activities.add(new Activity(activityService, node, nameSpaceCtx, xpath));
    }

    for (Activity activity : activities) {
      Assert.assertNotNull(activity.getActivityUuid());
View Full Code Here


   * @param data
   * @param namespaceCtx
   * @param xpathExpression
   */
  public AtomEntry(Node node) {
    XPathExpression xpath = (node instanceof Document) ? (XPathExpression)AtomXPath.singleEntry.getPath() : null;
    dataHandler = new XmlDataHandler(node, nameSpaceCtx, xpath);
  }
View Full Code Here

    }
  }

  protected Activity updateActivityEntityData(Activity activity, Response response) {
    Node node = (Node) response.getData();
    XPathExpression xpath = (node instanceof Document) ? (XPathExpression) AtomXPath.singleEntry.getPath() : null;
    activity.clearFieldsMap();
    activity.setData(node, nameSpaceCtx, xpath);
    activity.setService(this);
    return activity;
  }
View Full Code Here

    }
  }

  protected ActivityNode updateActivityNodeEntityData(ActivityNode activityNode, Response response) {
    Node node = (Node) response.getData();
    XPathExpression xpath = (node instanceof Document) ? (XPathExpression) AtomXPath.singleEntry.getPath() : null;
    activityNode.setData(node, nameSpaceCtx, xpath);
    activityNode.setService(this);
    return activityNode;
  }
View Full Code Here

    // Response does not contain a valid member entry
    Node node = null;
    Object data = response.getData();
    if (data instanceof Node) {
      node = (Node) data;
      XPathExpression xpath = (node instanceof Document) ? (XPathExpression) AtomXPath.singleEntry.getPath() : null;
      member.setData(node, nameSpaceCtx, xpath);
    }
    member.setService(this);
    return member;
  }
View Full Code Here

  protected IFeedHandler<Tag> getTagFeedHandler() {
    return new CategoryFeedHandler<Tag>(this) {
      @Override
      protected Tag newEntity(BaseService service, Node node) {
        XPathExpression xpath = (node instanceof Document) ? (XPathExpression) AtomXPath.singleCategory.getPath() : null;
        return new Tag(service, node, nameSpaceCtx, xpath);
      }
    };
  }
View Full Code Here

  protected IFeedHandler<Category> getCategoryFeedHandler() {
    return new CategoryFeedHandler<Category>(this) {
      @Override
      protected Category newEntity(BaseService service, Node node) {
        XPathExpression xpath = (node instanceof Document) ? (XPathExpression) AtomXPath.singleCategory.getPath() : null;
        return new Category(service, node, nameSpaceCtx, xpath);
      }
    };
  }
View Full Code Here

     * @param useCache indicate if the xpath should be cached
     * @return the result of the XPath evaluation
     * @throws XMLException
     */
    public static XResult evaluateXPath(Node node, String xpathExpr, NamespaceContext nsContext, boolean useCache) throws XMLException {
        XPathExpression expr = createXPath(xpathExpr,useCache);
        return expr.eval(node,nsContext);
    }
View Full Code Here

     * @param useCache indicate if the xpath should be cached
     * @return the XPath expression
     * @throws XMLException
     */
    public static Object createNodes(Node node, String xpathExpr, boolean useCache) throws XMLException {
        XPathExpression xp = createXPath(xpathExpr);
        // If we start from the document, we should take care of the XPath context
        if(!xp.isFromRoot() && (node instanceof Document)) {
            Document doc = (Document)node;
            XPathContext ctx = s_parserDriver.getXPathContext(doc);
            if(ctx!=null) {
                // Ensure that the intermediate context are created
                ctx.createNodes();
                // And evaluate from this context
                return xp.createNodes(ctx.getUniqueContextNode(),null);
            }
        }
        // Else, start from the current node
        return xp.createNodes(node,null);
    }
View Full Code Here

     * @param value the value to set
     * @param selectionNS the NamespacContext used to resolve namespaces during XPath evaluation
     * @throws XMLException if an error occurred
     */
    public static void setValue(Node node, String path, String value, NamespaceContext selectionNS) throws XMLException {
        XPathExpression xp = createXPath(path);
        // If we start from the document, we should take care of the XPath context
        if(!xp.isFromRoot() && (node instanceof Document)) {
            Document doc = (Document)node;
            XPathContext ctx = s_parserDriver.getXPathContext(doc);
            if(ctx!=null) {
                // Ensure that the intermediate context are created
                ctx.createNodes();
                // And evaluate from this context
                xp.setValue(ctx.getUniqueContextNode(),value,selectionNS,true);
                return;
            }
        }
        // Else, start from the current node
        xp.setValue(node,value,selectionNS,true);
    }
View Full Code Here

TOP

Related Classes of com.ibm.commons.xml.xpath.XPathExpression

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.