Package org.dom4j

Examples of org.dom4j.Document.selectSingleNode()


    public List parse(Resource resource) {
        Document doc = getHtmlDocument(resource);

        if (doc != null) {
            Node title = doc.selectSingleNode("//head/title");

            if (title != null && title.getText() != null && title.getText().startsWith("Index of")) {
                List nodes = doc
                        .selectNodes("//pre/img[starts-with(@alt,'[') and ends-with(@alt,']')]/following::a/@href");
                List items = new ArrayList(nodes.size());
View Full Code Here


                addNodes(items, doc.selectNodes("//dir/@name"), true);
                addNodes(items, doc.selectNodes("//file/@name"), false);
            }
        } else if (doc != null && !xml) {
            Node title = doc.selectSingleNode("//head/title");

            if (title != null && title.getText() != null && title.getText().indexOf("Revision") > 0) {
                List nodes = doc.selectNodes("//ul/li/a/@href");

                items = new ArrayList();
View Full Code Here

        super(testName);
    }

    public void testExample1() throws Exception {
        Document document = runScript( "src/test/org/apache/commons/jelly/jsl/example.jelly" );
        Element small = (Element) document.selectSingleNode("/html/body/small");
       
        assertTrue( "<small> starts with 'James Elson'", small.getText().startsWith("James Elson") );
        assertEquals( "I am a title!", small.valueOf( "h2" ).trim() );
        assertEquals( "Twas a dark, rainy night...", small.valueOf( "small" ).trim() );
        assertEquals( "dfjsdfjsdf", small.valueOf( "p" ).trim() );
View Full Code Here

  public static int getCurrentStepNumber() throws Exception{
   
      SAXReader reader = new SAXReader();
        Document document = reader.read(OmFileHelper.getInstallFile());
       
        Node node = document.selectSingleNode( "//install/step/stepnumber" );
       
        return Integer.valueOf(node.getText()).intValue();
       
  }
 
View Full Code Here

  public static int getCurrentStepNumber() throws Exception{
   
      SAXReader reader = new SAXReader();
        Document document = reader.read(OmFileHelper.getInstallFile());
       
        Node node = document.selectSingleNode( "//install/step/stepnumber" );
       
        return Integer.valueOf(node.getText()).intValue();
       
  }
 
View Full Code Here

        contacts.add(contact);

        Document document = writer.createDocument(contacts);


        assertEquals("nom", document.selectSingleNode("//contacts/contact/nom").getText());
        assertEquals("prenom", document.selectSingleNode("//contacts/contact/prenom").getText());
        assertEquals("hikage@hikage.be", document.selectSingleNode("//contacts/contact/email").getText());
        assertEquals("personnelle", document.selectSingleNode("//contacts/contact/email").valueOf("@type"));
    }
}
View Full Code Here

        Document document = writer.createDocument(contacts);


        assertEquals("nom", document.selectSingleNode("//contacts/contact/nom").getText());
        assertEquals("prenom", document.selectSingleNode("//contacts/contact/prenom").getText());
        assertEquals("hikage@hikage.be", document.selectSingleNode("//contacts/contact/email").getText());
        assertEquals("personnelle", document.selectSingleNode("//contacts/contact/email").valueOf("@type"));
    }
}
View Full Code Here

        Document document = writer.createDocument(contacts);


        assertEquals("nom", document.selectSingleNode("//contacts/contact/nom").getText());
        assertEquals("prenom", document.selectSingleNode("//contacts/contact/prenom").getText());
        assertEquals("hikage@hikage.be", document.selectSingleNode("//contacts/contact/email").getText());
        assertEquals("personnelle", document.selectSingleNode("//contacts/contact/email").valueOf("@type"));
    }
}
View Full Code Here


        assertEquals("nom", document.selectSingleNode("//contacts/contact/nom").getText());
        assertEquals("prenom", document.selectSingleNode("//contacts/contact/prenom").getText());
        assertEquals("hikage@hikage.be", document.selectSingleNode("//contacts/contact/email").getText());
        assertEquals("personnelle", document.selectSingleNode("//contacts/contact/email").valueOf("@type"));
    }
}
View Full Code Here

  public IFileInfo getFileInfo( ISolutionFile solutionFile, InputStream in ) {
    try {
      Document doc = XmlDom4JHelper.getDocFromStream( in );

      IFileInfo info = new FileInfo();
      Node node = doc.selectSingleNode( "state-file/documentation/author" ); //$NON-NLS-1$
      if ( node != null ) {
        info.setAuthor( node.getText() );
      } else {
        info.setAuthor( "" ); //$NON-NLS-1$
      }
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.