Package org.jdom.xpath

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


            // Check if metadataUrl in WMS 1.3.0 format
            if (onLineSrc == null) {
                mdUrl     = XPath.newInstance ("./" + dummyNsPrefix + "MetadataURL[@type='ISO19115:2003' and " + dummyNsPrefix + "Format='text/xml']/" + dummyNsPrefix + "OnlineResource");
                if (addNsPrefix) mdUrl.addNamespace("x", layer.getNamespace().getURI());
                onLineSrc   = (Element) mdUrl.selectSingleNode (layer);
            }

      if (onLineSrc != null) {
        org.jdom.Attribute href = onLineSrc.getAttribute ("href", xlink);
View Full Code Here


            XPath pDescription = XPath.newInstance("gmd:CI_OnlineResource/gmd:description/gco:CharacterString");

            Element eLinkage     = (Element) pLinkage.selectSingleNode(curnode);
            Element eProtocol    = (Element) pProtocol.selectSingleNode(curnode);
            Element eName        = (Element) pName.selectSingleNode(curnode);
            Element eDescription = (Element) pDescription.selectSingleNode(curnode);

            if (eLinkage == null)  {
                continue;
            }
            if (eProtocol == null) {
View Full Code Here

   *
   * @return a config element
   */
  static public String getConfigParam(String aName) throws Exception {
    XPath xPath = XPath.newInstance("//param[@name=\"" + aName + "\"]");
    Element paramElm = (Element) xPath.selectSingleNode(getConfigElm());
    if (paramElm == null) {
      throw new IllegalArgumentException("Cannot find config parameter: " + aName);
    }

    return paramElm.getText().trim();
View Full Code Here

     */
  public static Object selectSingle(Element xml, String xpath, List<Namespace> theNSs) throws JDOMException {

    XPath xp = prepareXPath(xml, xpath, theNSs);

    return xp.selectSingleNode(xml);
  }

  //---------------------------------------------------------------------------

    /**
 
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)
                return (Element)result;
            else
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");
    }

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

          try {
            xpathDesc = XPath.newInstance("/atom:entry/oreatom:triples/rdf:Description[@rdf:about=\"" + this.URLencode(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 implements OMDataSource {
        private final Element data;
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

   *   such element exists
   * @throws JDOMException
   */
  public Element getLinkWithRelation(Element elt, String rel) throws JDOMException {
    XPath xpath = getXPath("xhtml", String.format(".//xhtml:a[@rel='%s']", rel));
    return (Element)xpath.selectSingleNode(elt);
  }

  /**
     * Find in the given XML document an &lt;a&gt;
     * tag with the given link relation in its @rel attribute.
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.