I believe we may have stumbled across another bug or issue of the Xpath
application (Unless I'm doing something wrong).  The code below shows a
sample product xml document where I am trying to return nodes based upon
a value in a child node.  In the sample if the user wanted to return all
products that are red, the Xpath doesn't return it properly.  I have
tested and retested the xpath that I'm using in an XML editor and it
works.

Thank you ahead of time for you help...  If someone knows how to get
around this, I'd appreciate your help!

Thanks, 

Doug Coning
Software Developer
FORUM Solutions, LLC

---------------------------------------------------------------------
import com.xfactorstudio.xml.xpath.*;
_global.XPath = XPath;

// XML
var myStr:String =
"<products><product><flag>0</flag><colors><clr>green</clr></colors><colo
rs><clr>red</clr></colors><name>Item
1</name><price>19.95</price></product><product><flag>1</flag><colors><cl
r>blue</clr><clr>red</clr></colors><name>Plate</name><price>12.95</price
></product><product><colors><clr>silver</clr></colors><flag>0</flag><nam
e>Spoon</name><price>4.95</price></product></products>";
var myXML:XML = new XML(myStr);
trace("myXML: " + myXML);

// Query 1
var result1_array:Array = XPath.selectNodes(myXML,"//product[colors/clr
= 'green']");
trace("\nGreen Results:\t" +  result1_array);
trace("Result Length:\t\t" +  result1_array.length);

// Query 2
var result2_array:Array = XPath.selectNodes(myXML,"//product[colors/clr
= 'red']");
trace("\nRed Results:\t" +  result2_array);//  Doesn't work!
trace("Result Length:\t\t" +  result2_array.length);//  Doesn't work!
 
This e-mail and any attachment(s) are intended for the specified recipient(s) 
only and are legally protected.  If you have received this communication in 
error, please "reply to" sender's e-mail address with notification of the error 
and then destroy this message in all electronic and physical forms.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to