You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/04/22 22:15:00 UTC
DO NOT REPLY [Bug 19231] New: -
JXPathContext.iterate(String) returns duplicate children
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19231>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19231
JXPathContext.iterate(String) returns duplicate children
Summary: JXPathContext.iterate(String) returns duplicate children
Product: Commons
Version: 1.0 Alpha
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: Other
Component: JXPath
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: jpfield@adelphia.net
i have a bean hierarchy as follows
Collection Listing.getProperties() // returns collection of Property objects
Collection Property.getStructures() // returns collection of Structure objects
Collection Structure.getRooms() // returns collection of Room objects
Collection Room.getRooms() // also returns collection of Room objects
the following code:
public void testCreate() throws Exception {
JXPathContext context = JXPathContext.newContext(this.listing);
for (Iterator i =
(Iterator)context.iterate("properties/structures/levels//rooms[name='Bathroom']");
i.hasNext();) {
Room bathroom = (Room) i.next();
System.out.println(bathroom.getName() +" "+ bathroom.getValue());
}
}
run against the following pseudo structure:
Listing = (null)
+-Property = (10116 St. Paul's Lane)
+-+-Structure = (Townhouse)
+-+-+-Level = (First Floor)
+-+-+-+-Kitchen = (Kitchen)
+-+-+-+-Room = (Living Room)
+-+-+-+-Bathroom = (Powder Room)
+-+-+-Level = (Second Floor)
+-+-+-+-Bedroom = (Master Bedroom)
+-+-+-+-+-Bathroom = (Master Bath)
+-+-+-+-Bedroom = (Guest Bedroom)
+-+-+-+-+-Bathroom = (Guest Bath)
generates the following output:
Bathroom Powder Room
Bathroom Master Bath
Bathroom Guest Bath
Bathroom Master Bath
Bathroom Guest Bath
the last four should only have been two. the direct xpath would be
'properties/structures/levels/rooms[name='Bedroom']'
and
'properties/structures/levels/rooms/rooms[name='Bedroom']'.
but when i use the 'properties/structures/levels//rooms[name='Bedroom']' style
query, the rooms/rooms children get listed twice.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org