Package org.jdom.xpath

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


   */
  public static String parseXml(Document doc, String path)
      throws AppsForYourDomainException {
    try {
      XPath statusXPath = XPath.newInstance(path);
      Object node = statusXPath.selectSingleNode(doc);
      if (node == null) {
        return ""; // Did not find any nodes matching in doc
      }
      Element element;
      if (node instanceof Element) {
View Full Code Here


    }

    private Element getMatch(Object doc, String xpath) {
        try {
            XPath path = XPath.newInstance(xpath);
            return (Element)path.selectSingleNode(doc);
        } catch (JDOMException e) {
            throw new DatabindingException("Error evaluating xpath " + xpath, e);
        }
    }
View Full Code Here

  public Element getMatch(Object doc, String xpath)
    {
        try
        {
            XPath path = XPath.newInstance(xpath);
            return (Element)path.selectSingleNode(doc);
        }
        catch(JDOMException e)
        {
            throw new XFireRuntimeException("Error evaluating xpath " + xpath, e);
        }
View Full Code Here

    {
      XPath xpath           = XPath.newInstance("/descendant::text:index-body[1]");
      xpath.addNamespace(officeNs);
      xpath.addNamespace(textNs);
     
      Object temp            = xpath.selectSingleNode(doc);
     
      if (temp != null)
      {
        Element textIndexBodyElement   = (Element)temp;
        tocElements            = textIndexBodyElement.getChildren();
View Full Code Here

        try
        {
            XPath xpath = XPath.newInstance(path);
            xpath.addNamespace(metsNS);
            xpath.addNamespace(xlinkNS);
            Object result = xpath.selectSingleNode(mets);
            if (result == null && nullOk)
            {
                return null;
            }
            else if (result instanceof Element)
View Full Code Here

      xpathLinks.addNamespace(ATOM_NS);
          aggregatedResources = xpathLinks.selectNodes(doc);
         
          xpathLinks = XPath.newInstance("/atom:entry/atom:link[@rel='alternate']/@href");
          xpathLinks.addNamespace(ATOM_NS);
          entryId = ((Attribute)xpathLinks.selectSingleNode(doc)).getValue();
    } catch (JDOMException e) {
      throw new CrosswalkException("JDOM exception occured while ingesting the ORE", e);
    }

    // Next for each resource, create a bitstream
View Full Code Here

          try {
            xpathDesc = XPath.newInstance("/atom:entry/oreatom:triples/rdf:Description[@rdf:about=\"" + this.encodeForURL(href) + "\"][1]");
            xpathDesc.addNamespace(ATOM_NS);
            xpathDesc.addNamespace(ORE_ATOM);
            xpathDesc.addNamespace(RDF_NS);
            desc = (Element)xpathDesc.selectSingleNode(doc);
          } catch (JDOMException e) {
            e.printStackTrace();
          }
         
          if (desc != null && desc.getChild("type", RDF_NS).getAttributeValue("resource", RDF_NS).equals(DS_NS.getURI() + "DSpaceBitstream"))
View Full Code Here

        OMElement response = stub.getStockQuote(child);

        StAXBuilder builder = new StAXBuilder();
        Document doc = builder.build(response.getXMLStreamReader());
        XPath path = XPath.newInstance("//price");
        Element price = (Element) path.selectSingleNode(doc.getRootElement());
        System.out.println("Price = " + price.getText());
    }

    private static class JDOMDataSource extends AbstractPushOMDataSource {
        private final Element data;
View Full Code Here

        try {
            //Extract the last 4 characters from the codeSystem param
            String tableId = codeSystem.substring(codeSystem.length() - 4);
            //System.out.println(tableId);
            XPath path = XPath.newInstance("/Specification/hl7tables/hl7table[@id='" + tableId + "']");
            table = (Element) path.selectSingleNode(tableDoc);
        } //end try
        catch (Exception e) {
            throw new ProfileException(e.toString(), e);
        } //end catch
        return table;
View Full Code Here

    }

    private Element getMatch(Object doc, String xpath) {
        try {
            XPath path = XPath.newInstance(xpath);
            return (Element)path.selectSingleNode(doc);
        } catch (JDOMException e) {
            throw new DatabindingException("Error evaluating xpath " + xpath, e);
        }
    }
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.