Package org.jaxen.jdom

Examples of org.jaxen.jdom.JDOMXPath.selectNodes()


    // XXX this is expensive for very large documents. In those cases another
    // XXX method (direct processing of SAX events, or XMLPull) should be used.
    XPath path = new JDOMXPath("//text:span | //text:p | //text:tab | //text:tab-stop | //text:a");
    path.addNamespace("text", root.getNamespace("text").getURI());
    Namespace xlink = Namespace.getNamespace("xlink", "http://www.w3.org/1999/xlink");
    List list = path.selectNodes(doc);
    boolean lastp = true;
    for (int i = 0; i < list.size(); i++) {
      Element el = (Element)list.get(i);
      String text = el.getText();
      if (el.getName().equals("p")) {
View Full Code Here


    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(fis);
    XPath path = new JDOMXPath("/office:document-meta/office:meta/*");
    Element root = doc.getRootElement();
    path.addNamespace("office", root.getNamespace("office").getURI());
    List list = path.selectNodes(doc);
    for (int i = 0; i < list.size(); i++) {
      Element n = (Element)list.get(i);
      String text = n.getText();
      if (text.trim().equals("")) continue;
      String name = n.getName();
View Full Code Here

        // extract additional properties
        cclicensefield.setDescription( ((Element)xp_Description.selectSingleNode(field)).getText() );
        cclicensefield.setType( ((Element)xp_FieldType.selectSingleNode(field)).getText() );

        enumOptions = xp_Enum.selectNodes(field);

        for (int j = 0; j < enumOptions.size(); j++) {
          String id = ((Attribute)xp_LicenseID.selectSingleNode(enumOptions.get(j))).getValue();
          String label =((Element)xp_Label.selectSingleNode(enumOptions.get(j))).getText();
View Full Code Here

            Namespace ns = Namespace.getNamespace( "planets", "http://www.planets-project.eu/xml/ns/planets/core/mimetypes" );           
            JDOMXPath xpath = new JDOMXPath("/planets:Document/planets:MIME-mapping");   
            xpath.addNamespace( "planets", "http://www.planets-project.eu/xml/ns/planets/core/mimetypes" );                       
           
            Iterator<?> _mappings = xpath.selectNodes( d ).iterator();
            while ( _mappings.hasNext() ) {           
           
                Element _mapping = (Element)_mappings.next();
                String _extname = ((Element)_mapping.getChild("Extension", ns)).getText().toLowerCase();
View Full Code Here

            Namespace ns = Namespace.getNamespace( "planets", "http://www.planets-project.eu/xml/ns/planets/core/mimetypes" );           
            JDOMXPath xpath = new JDOMXPath("/planets:Document/planets:MIME-mapping");   
            xpath.addNamespace( "planets", "http://www.planets-project.eu/xml/ns/planets/core/mimetypes" );                       
           
            Iterator<?> _mappings = xpath.selectNodes( d ).iterator();
            while ( _mappings.hasNext() ) {           
           
                Element _mapping = (Element)_mappings.next();
                String _extname = ((Element)_mapping.getChild("Extension", ns)).getText().toLowerCase();
View Full Code Here

           
            Document doc = builder.build( args[0] );
           
            XPath xpath = new JDOMXPath( args[1] );
           
            List results = xpath.selectNodes( doc );
           
            Iterator resultIter = results.iterator();

            System.out.println("Document :: " + args[0] );
            System.out.println("   XPath :: " + args[1] );
View Full Code Here

        Namespace my = Namespace.getNamespace("foo", "http://mynamespace.org/");
        Document doc = new Document();
        Element root = new Element("root", my);
        doc.setRootElement(root);
        XPath nullNamespacePath = new JDOMXPath("/root");
        List selectedNodes = nullNamespacePath.selectNodes(doc);
        assertEquals(0, selectedNodes.size());
       
    }
   
}
View Full Code Here

        SAXBuilder builder = new SAXBuilder();

        Document doc = builder.build( BASIC_XML );

        List results = xpath.selectNodes( doc );

        assertEquals( 3,
                      results.size() );

        Iterator iter = results.iterator();
View Full Code Here

        SAXBuilder builder = new SAXBuilder();

        Document doc = builder.build( BASIC_XML );

        Element root = doc.getRootElement();
        List results = xpath.selectNodes( root );

        assertEquals( 1,
                      results.size() );

        Iterator iter = results.iterator();
View Full Code Here

        SAXBuilder builder = new SAXBuilder();

        Document doc = builder.build( new StringReader("<root>\n<data>1</data>\n</root>") );

        List results = xpath.selectNodes( doc );

        assertEquals( 1,
                      results.size() );

        Iterator iter = results.iterator();
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.