Package org.jdom.xpath

Examples of org.jdom.xpath.XPath.selectSingleNode()


 
  public FitsMetadataElement getMetadataElement(String name) {
    try {     
      XPath xpath = XPath.newInstance("//fits:"+name);
      xpath.addNamespace("fits",Fits.XML_NAMESPACE);
      Element node = (Element)xpath.selectSingleNode(fitsXml);
      if(node != null) {
        FitsMetadataElement element = buildMetdataIElements(node);
        return element;
      }
    } catch (JDOMException e) {
View Full Code Here


      try {
        //only look at non null dom structures
        if(dom != null) {
          XPath xpath = XPath.newInstance(xpath_query);
          xpath.addNamespace("fits",Fits.XML_NAMESPACE);
          Element e = (Element)xpath.selectSingleNode(dom);
          if(e != null && e.getChildren().size() > 0) {
            if(useChildren) {
              e = (Element)e.getChildren().get(0);
            }
            List children = e.getChildren();
View Full Code Here

      }
      ToolInfo toolInfo = result.getTool().getToolInfo();
      try {
        XPath xpath = XPath.newInstance("//fits:"+element.getName());
        xpath.addNamespace("fits",Fits.XML_NAMESPACE);
        Element e = (Element)xpath.selectSingleNode(dom);
        if(e != null) {
          e.setAttribute("toolname",toolInfo.getName());
          e.setAttribute("toolversion",toolInfo.getVersion());
          fitsElements.add(e);
          e.getParent().removeContent(e);
View Full Code Here

            return _minInstances.intValue();
        }
        Number result = null;
        try {
            XPath xpath = XPath.newInstance(_minInstancesQuery);
            result = (Number) xpath.selectSingleNode(_myTask._net.getInternalDataDocument());
        } catch (JDOMException e) {
            e.printStackTrace();
        } catch (ClassCastException e) {
            throw new RuntimeException("The minInstances query at " + _myTask
                    + " didn't produce numerical output as excepted.");
View Full Code Here

            return _maxInstances.intValue();
        }
        Number result = null;
        try {
            XPath xpath = XPath.newInstance(_maxInstancesQuery);
            result = (Number) xpath.selectSingleNode(_myTask._net.getInternalDataDocument());
        } catch (JDOMException e) {
            e.printStackTrace();
        } catch (ClassCastException e) {
            throw new RuntimeException("The maxInstances query at " + _myTask
                    + " didn't produce numerical output as excepted.");
View Full Code Here

            return _threshold.intValue();
        }
        Number result = null;
        try {
            XPath xpath = XPath.newInstance(_thresholdQuery);
            result = (Number) xpath.selectSingleNode(_myTask._net.getInternalDataDocument());
        } catch (JDOMException e) {
            e.printStackTrace();
        } catch (ClassCastException e) {
            throw new RuntimeException("The threshold query at " + _myTask
                    + " didn't produce numerical output as excepted.");
View Full Code Here

                ((YCondition) flow.getNextElement()).add(pmgr, tokenToSend);
                return;
            }
            try {
                XPath xpath = XPath.newInstance("boolean(" + flow.getXpathPredicate() + ")");
                Boolean result = (Boolean) xpath.selectSingleNode(_net.getInternalDataDocument());
                if (result.booleanValue()) {
                    ((YCondition) flow.getNextElement()).add(pmgr, tokenToSend);
                    return;
                }
            } catch (JDOMException e) {
View Full Code Here

        YFlow flow;
        for (int i = 0; i < flows.size(); i++) {
            flow = (YFlow) flows.get(i);
            try {
                XPath xpath = XPath.newInstance("boolean(" + flow.getXpathPredicate() + ")");
                Boolean result = (Boolean) xpath.selectSingleNode(_net.getInternalDataDocument());
                if (result.booleanValue()) {
                    ((YCondition) flow.getNextElement()).add(pmgr, tokenToSend);
                    noTokensOutputted = false;
                }
            } catch (JDOMException e) {
View Full Code Here

   */
  private LoginResult constructLogin(Element root)
      throws APIException {
    try {
      XPath xpa = XPath.newInstance("/api/login");
      Element node = (Element) xpa.selectSingleNode(root);
      if (node != null) {
        XPath xpaResult = XPath.newInstance("./@result");
        String result = xpaResult.valueOf(node);
        if ("Success".equalsIgnoreCase(result)) {
          XPath xpaUserid = XPath.newInstance("./@lguserid");
View Full Code Here

   */
  private QueryResult constructEdit(Element root, String query)
      throws APIException, CaptchaException {
    try {
      XPath xpa = XPath.newInstance(query);
      Element node = (Element) xpa.selectSingleNode(root);
      if (node != null) {
        XPath xpaResult = XPath.newInstance("./@result");
        String result = xpaResult.valueOf(node);
        if ("Success".equalsIgnoreCase(result)) {
          XPath xpaPageId = XPath.newInstance("./@pageid");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.