Package org.jdom.xpath

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


            Element onLineSrc   = (Element) mdUrl.selectSingleNode (layer);

            // 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


        for (Element declaredRule : declaredRules) {
            String context = declaredRule.getAttributeValue("context");

            final XPath xPath = XPath.newInstance(context);
            for (Namespace namespace : NAMESPACES) {
                xPath.addNamespace(namespace);
            }


            List<Element> nodes = (List<Element>) xPath.selectNodes(validMetadata);
            String titleOfRule = createRuleTitle(declaredRule);
View Full Code Here

     */
  private static XPath prepareXPath(Element xml, String xpath, List<Namespace> theNSs) throws JDOMException
  {
    XPath xp = XPath.newInstance (xpath);
    for (Namespace ns : theNSs ) {
      xp.addNamespace(ns);
    }

    return xp;
  }

View Full Code Here

     * @throws JDOMException
     */
  public static List<?> selectDocumentNodes(Element xml, String xpath, List<Namespace> theNSs) throws JDOMException {
    XPath xp = XPath.newInstance (xpath);
    for (Namespace ns : theNSs ) {
      xp.addNamespace(ns);
    }
        xml = (Element)xml.clone();
        Document document = new Document(xml);
        return xp.selectNodes(document);   
 
View Full Code Here

            try
            {
                // Use a special namespace with known prefix
                // so we get the right prefix.
                XPath xpath = XPath.newInstance("descendant::mets:mdRef");
                xpath.addNamespace(metsNS);
                mdFiles = xpath.selectNodes(mets);
            }
            catch (JDOMException je)
            {
                throw new MetadataValidationException("Failed while searching for mdRef elements in manifest: ", je);
View Full Code Here

        try
        {
            XPath xpath = XPath.newInstance(
"mets:fileSec/mets:fileGrp[@USE=\"CONTENT\"]/mets:file[@GROUPID=\""+groupID+"\"]");
            xpath.addNamespace(metsNS);
            List oFiles = xpath.selectNodes(mets);
            if (oFiles.size() > 0)
            {
                log.debug("Got ORIGINAL file for derived="+file.toString());
                return (Element)oFiles.get(0);
View Full Code Here

        throws MetadataValidationException
    {
        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

    {
        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;
View Full Code Here

        XPath xpathLinks;
        List<Element> aggregatedResources;
        String entryId;
    try {
      xpathLinks = XPath.newInstance("/atom:entry/atom:link[@rel=\"" + ORE_NS.getURI()+"aggregates" + "\"]");
      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();
View Full Code Here

      xpathLinks = XPath.newInstance("/atom:entry/atom:link[@rel=\"" + ORE_NS.getURI()+"aggregates" + "\"]");
      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");
    }
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.