Package com.ibm.commons.xml.xpath

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


    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "get");
    }
    String result = "";
    try {
      XPathExpression xpathQuery = getXPathQuery(fieldName);
      XResult xResult = xpathQuery.eval(data, getNamespaceContext());
      result = xResult.getStringValue() != null ? xResult.getStringValue() : "";
    } catch (XPathException e) {
      logger.throwing(sourceClass, "get", e);
    } catch (XMLException e) {
      logger.throwing(sourceClass, "get", e);
View Full Code Here


  @Override
  public List<Node> getNestedEntities(Node data, String namedQuery) {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "getEntities");
    }
    XPathExpression xpathQuery = getXPathQuery(namedQuery);

    try {
      XResult xResult = xpathQuery.eval(data, getNamespaceContext());
      // forcing erasure, as getNodes returns an array of objects
      List l = Arrays.asList(xResult.getNodes());;
      return l;
    } catch (XPathException e) {
      logger.throwing(sourceClass, "getNestedEntities", e);
View Full Code Here

   * @param fieldName
   * @return value
   */
  @Override
  public String getAsString(String fieldName) {
    XPathExpression xpQuery = null;
    xpQuery = getXPathQuery(fieldName);
    return getFieldUsingXPath(xpQuery);
  }
View Full Code Here

   * @param fieldName
   * @return value as Date
   */
  @Override
  public boolean getAsBoolean(FieldEntry field) {
    XPathExpression xpath = (XPathExpression) field.getPath();
    return getBooleanValue(xpath);
  }
View Full Code Here

   * Connections naming convention
   *
   * @throws XMLException
   */
  protected XPathExpression getXPathQuery(String path) {
    XPathExpression xpath = null;
    try {
      xpath = DOMUtil.createXPath(path);
    } catch (XMLException e) {
    }
    return xpath;
View Full Code Here

   * @param field
   * @return value
   */
  @Override
  public String getAsString(FieldEntry field) {
    XPathExpression xpQuery = (XPathExpression) field.getPath();
    return getFieldUsingXPath(xpQuery);
  }
View Full Code Here

       return null;
    }
  }

  protected T newEntity(BaseService service, Node node){
    XPathExpression xpath = getEntityXPath(node);
    return entityInstance(service, node, xpath);
  }
View Full Code Here

       
    XmlDataHandler dataHandler = new XmlDataHandler(doc, nameSpaceCtx);
    List<Node> nodeFields = dataHandler.getEntries(ActivityXPath.entry_field);
    List<Field> fields = new ArrayList<Field>();
    for (Node node : nodeFields) {
      XPathExpression xpath = (node instanceof Document) ? (XPathExpression)ActivityXPath.field.getPath() : null;
     
      XPathExpression fieldType = ActivityXPath.field_type.getPath();
      XResult result = fieldType.eval(node, nameSpaceCtx);
      String type = result.getStringValue();
      if ("date".equals(type)) {
        fields.add(new DateField(activityService, node, nameSpaceCtx, xpath));
      } else if ("file".equals(type)) {
        fields.add(new FileField(activityService, node, nameSpaceCtx, xpath));
View Full Code Here

public class ActivityTest extends BaseActivityServiceTest {

  @Test
  public void testActivity() throws XMLException, IOException {
    Node node = readXml("activity1.xml");
    XPathExpression xpath = (XPathExpression)AtomXPath.singleEntry.getPath();
    Activity activity = new Activity(activityService, node, nameSpaceCtx, xpath);
   
    Assert.assertEquals("5f89a416-68e5-4666-af8e-72150bf50e22", activity.getActivityUuid());
    Assert.assertEquals("com.ibm.sbt.services.client.connections.activities.ActivityServiceCrudrTest#1615749198 Community - 1396026691896", activity.getTitle());
    Assert.assertEquals(true, activity.isCommunityActivity());
View Full Code Here

  }

  @Test
  public void testActivityEntry() throws XMLException, IOException {
    Node node = readXml("activity1.xml");
    XPathExpression xpath = (XPathExpression)AtomXPath.singleEntry.getPath();
    Activity activity = new Activity(activityService, node, nameSpaceCtx, xpath);
 
    String entryData = activity.createEntryData();
    Assert.assertNotNull(entryData);
  }
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.