Package org.jdom.xpath

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


        // parse the metadata file
        XPath xPath = XPath.newInstance( "//metadata/versioning" );
        Element rootElement = document.getRootElement();

        Element versioning = (Element) xPath.selectSingleNode( rootElement );
        Element el = (Element) xPath.newInstance( "./latest" ).selectSingleNode( versioning );
        assertEquals( "2.3-SNAPSHOT", el.getValue() );

        el = (Element) xPath.newInstance( "./lastUpdated" ).selectSingleNode( versioning );
        assertTrue( el.getValue().equals( "20070315032817" ) );
View Full Code Here


        // parse the metadata file
        XPath xPath = XPath.newInstance( "//metadata/versioning" );
        Element rootElement = document.getRootElement();

        Element versioning = (Element) xPath.selectSingleNode( rootElement );
        Element el = (Element) xPath.newInstance( "./latest" ).selectSingleNode( versioning );
        assertEquals( "2.3", el.getValue() );

        el = (Element) xPath.newInstance( "./lastUpdated" ).selectSingleNode( versioning );
        assertFalse( el.getValue().equals( "20070315032817" ) );
View Full Code Here

        // parse the metadata file
        XPath xPath = XPath.newInstance( "//metadata/versioning" );
        Element rootElement = document.getRootElement();
              
        Element versioning = (Element) xPath.selectSingleNode( rootElement );
        Element el = (Element) xPath.newInstance( "./latest" ).selectSingleNode( versioning );
        assertEquals( "2.3", el.getValue() );

        el = (Element) xPath.newInstance( "./lastUpdated" ).selectSingleNode( versioning );
        assertFalse( el.getValue().equals( "20070315032817" ) );
View Full Code Here

        // parse the metadata file
        XPath xPath = XPath.newInstance( "//metadata/versioning" );
        Element rootElement = document.getRootElement();

        Element versioning = (Element) xPath.selectSingleNode( rootElement );
        Element el = (Element) xPath.newInstance( "./latest" ).selectSingleNode( versioning );
        assertEquals( "2.0.4-SNAPSHOT", el.getValue() );

        el = (Element) xPath.newInstance( "./lastUpdated" ).selectSingleNode( versioning );
        assertFalse( el.getValue().equals( "20070427033345" ) );
View Full Code Here

        return builder.build(conn.getInputStream());
    }
   
    protected String getString(Element elem, String path) throws Exception {
        XPath xpath = XPath.newInstance(path);
        Element e = (Element)xpath.selectSingleNode(elem);
        return e!=null ? e.getText() : null;
    }
   
    protected int getInt(Element elem, String path) throws Exception {
        XPath xpath = XPath.newInstance(path);
View Full Code Here

        return e!=null ? e.getText() : null;
    }
   
    protected int getInt(Element elem, String path) throws Exception {
        XPath xpath = XPath.newInstance(path);
        Element e = (Element)xpath.selectSingleNode(elem);
        return e!=null ? Integer.parseInt(e.getText()) : 0;
    }
}
View Full Code Here

                Element elem = doc.getRootElement();                         
                String error = getString(elem,"/tapi/document/result/error");
                if ( error != null ) throw new Exception(error);
                if (mWeblog == null) {
                    XPath p = XPath.newInstance("/tapi/document/result/weblog");
                    Element w = (Element) p.selectSingleNode(doc);
                    mWeblog = new Weblog(w);
                }
                int count=0;
                Iterator iter = itemsPath.selectNodes(doc).iterator();
                while (iter.hasNext()) {
View Full Code Here

    try {
      String selectString = "spring:property[@name='"+ name +"']";
     
      XPath xpath = XPath.newInstance(selectString);
      xpath.addNamespace("spring", springBeansNamespace.getURI());
      Object property = xpath.selectSingleNode(beanElem);
     
      if (property != null) {
        return (Element) property;
      }
    } catch (JDOMException e) {
View Full Code Here

    try {
      String selectString = "//spring:bean[@class='"+ className +"']";
     
      XPath xpath = XPath.newInstance(selectString);
      xpath.addNamespace("spring", springBeansNamespace.getURI());
      Object beanNode = xpath.selectSingleNode(doc.getRootElement());
     
      return (Element) beanNode;
    } catch (JDOMException e) {
      throw new ArchMapperException("Error searching in the config file: "+ e.getMessage(), e);
    }
View Full Code Here

            boolean addNsPrefix = !layer.getNamespace().equals(Namespace.NO_NAMESPACE);
            if (addNsPrefix) dummyNsPrefix = "x:";

            XPath mdUrl     = XPath.newInstance ("./" + dummyNsPrefix + "MetadataURL[@type='TC211' and " + dummyNsPrefix + "Format='text/xml']/" + dummyNsPrefix + "OnlineResource");
            if (addNsPrefix) mdUrl.addNamespace("x", layer.getNamespace().getURI());
            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());
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.