I have this routine (copied from another post on this mailing list)

  String name(Element e) {
    XPath nameXPath = DocumentHelper.createXPath("/*/name/text()");
    return nameXPath.valueOf(e); // valueInside() would have been a nicer name
  }

  main(Document doc) {
    List people = doc.getRootElement().selectNodes("/*/person");

    out.println("name1 = " + name((Element) people.get(0));
    out.println("name2 = " + name((Element) people.get(1));
  }

Document is created from this file

  <db>
    <person><name>Jack</name><age>23</age></person>
    <person><name>Barbara</name><age>28</age></person>
  </db>

The probles is that instead of
  name1 = Jack
  name2 = Barbara
I get
  name1 = 
  name2 = 

If I use "//name/text()" as xpath I get
  name1 = Jack
  name2 = Jack

What I did wrong?

-- 
Gioele Barabucci <[EMAIL PROTECTED]>
) http://cs.unibo.it/~barabucc


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to