1. I have the following structure:

<envelope>
  <body>
    <field>
      <name>field1</name>
    </field>
    <field>
      <name>field2</name>
    </field>
    <field>
      <name>field3</name>
    </field>
  </body>
</envelope>

2. I get a regular iterator of nodes like this:

  List nodes = doc.selectNodes("//envelope/body/field");
  Iterator it = nodes.iterator();

3. Then I iterate over them like this:

  Node node;
  while(it.hasNext()){
    node = (Node)it.next();
    System.out.println(node.
        selectSingleNode("//field/name").getText());
  }

4. And the results are:

  field1
  field1
  field1

It's finding the correct number of elements (3), it just always retrieves
the value of the first element!  I'm using dom4j1.1.  I must be missing
something simple...

Any help will be greatly appreciated,

Marc


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to