RE: [Flashcoders] XPath Error...
Hmm... it works if you nest the predicate bit to... //product[colors[clr= 'green']] ...apparently (after quick google) this is legal XPath. Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Coning Sent: 03 November 2005 12:13 To: Flashcoders mailing list Subject: [Flashcoders] XPath Error... Has anone encountered the following error that doesn't allow you to query child nodes of a particular node? Here is the sample code. Sorry for the wrapping: --- import com.xfactorstudio.xml.xpath.*; _global.XPath = XPath; // XML var myStr:String = productsproductflag0/flagcolorsclrgreen/clr/colorscolo rsclrred/clr/colorsnameItem 1/nameprice19.95/price/productproductflag1/flagcolorscl rblue/clrclrred/clr/colorsnamePlate/nameprice12.95/price /productproductcolorsclrsilver/clr/colorsflag0/flagnam eSpoon/nameprice4.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); trace(Result Length:\t\t + result2_array.length); Doug Coning Software Developer FORUM Solutions, LLC 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 __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XPath Error...
It allows you to query the 'first' child, but not any other children... Doug Coning Software Developer FORUM Solutions, LLC -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Chris Wilcox Sent: Thursday, November 03, 2005 8:30 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] XPath Error... Hmm... it works if you nest the predicate bit to... //product[colors[clr= 'green']] ...apparently (after quick google) this is legal XPath. Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Coning Sent: 03 November 2005 12:13 To: Flashcoders mailing list Subject: [Flashcoders] XPath Error... Has anone encountered the following error that doesn't allow you to query child nodes of a particular node? Here is the sample code. Sorry for the wrapping: --- import com.xfactorstudio.xml.xpath.*; _global.XPath = XPath; // XML var myStr:String = productsproductflag0/flagcolorsclrgreen/clr/colorscolo rsclrred/clr/colorsnameItem 1/nameprice19.95/price/productproductflag1/flagcolorscl rblue/clrclrred/clr/colorsnamePlate/nameprice12.95/price /productproductcolorsclrsilver/clr/colorsflag0/flagnam eSpoon/nameprice4.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); trace(Result Length:\t\t + result2_array.length); Doug Coning Software Developer FORUM Solutions, LLC 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 __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 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
RE: [Flashcoders] XPath Error...
You are correct. Yes, it allows you to query if you nest the child node. Thank you very much Doug Coning Software Developer FORUM Solutions, LLC -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Chris Wilcox Sent: Thursday, November 03, 2005 8:30 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] XPath Error... Hmm... it works if you nest the predicate bit to... //product[colors[clr= 'green']] ...apparently (after quick google) this is legal XPath. Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Coning Sent: 03 November 2005 12:13 To: Flashcoders mailing list Subject: [Flashcoders] XPath Error... Has anone encountered the following error that doesn't allow you to query child nodes of a particular node? Here is the sample code. Sorry for the wrapping: --- import com.xfactorstudio.xml.xpath.*; _global.XPath = XPath; // XML var myStr:String = productsproductflag0/flagcolorsclrgreen/clr/colorscolo rsclrred/clr/colorsnameItem 1/nameprice19.95/price/productproductflag1/flagcolorscl rblue/clrclrred/clr/colorsnamePlate/nameprice12.95/price /productproductcolorsclrsilver/clr/colorsflag0/flagnam eSpoon/nameprice4.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); trace(Result Length:\t\t + result2_array.length); Doug Coning Software Developer FORUM Solutions, LLC 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 __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 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
Re: [Flashcoders] XPath Error...
But the xml structure is not consistent (unless there was a typo). product colors clr/clr clr/clr /colors /product product colors clr/clr /colors colors clr/clr /colors /product So, if i'm not mistaken, this //product[colors[clr= 'green']] will only work for the second part (multiple 'colors' nodes), not the first one. regards, Muzak - Original Message - From: Chris Wilcox [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Thursday, November 03, 2005 2:30 PM Subject: RE: [Flashcoders] XPath Error... Hmm... it works if you nest the predicate bit to... //product[colors[clr= 'green']] ...apparently (after quick google) this is legal XPath. Chris Wilcox ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XPath Error...
Well spotted hadn't seen the inconsistent xml, which means you're also right about the XPath... Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: 03 November 2005 14:09 To: Flashcoders mailing list Subject: Re: [Flashcoders] XPath Error... But the xml structure is not consistent (unless there was a typo). product colors clr/clr clr/clr /colors /product product colors clr/clr /colors colors clr/clr /colors /product So, if i'm not mistaken, this //product[colors[clr= 'green']] will only work for the second part (multiple 'colors' nodes), not the first one. regards, Muzak - Original Message - From: Chris Wilcox [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Thursday, November 03, 2005 2:30 PM Subject: RE: [Flashcoders] XPath Error... Hmm... it works if you nest the predicate bit to... //product[colors[clr= 'green']] ...apparently (after quick google) this is legal XPath. Chris Wilcox ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XPath Error...
his XML is fine, its either the chattyfig server or our email clients stripping his xml.. //product[colors[clr='red']] will only return results if the first clr child node of the colors tag has a value of red. the correct syntax to return any clr child of colors that matches red would be : //product[colors/clr[.='red']] but neither the xfactor studio xpath parser or the mx.xpath.xpathAPI classes return anything for that xpath query. I tested it in internet explorer and it works fine. grant - Original Message - From: Chris Wilcox [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: 11/3/05 10:00 AM Subject: RE: [Flashcoders] XPath Error... Well spotted hadn't seen the inconsistent xml, which means you're also right about the XPath... Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: 03 November 2005 14:09 To: Flashcoders mailing list Subject: Re: [Flashcoders] XPath Error... But the xml structure is not consistent (unless there was a typo). So, if i'm not mistaken, this //product[colors[clr= 'green']] will only work for the second part (multiple 'colors' nodes), not the first one. regards, Muzak - Original Message - From: Chris Wilcox To: Flashcoders mailing list Sent: Thursday, November 03, 2005 2:30 PM Subject: RE: [Flashcoders] XPath Error... Hmm... it works if you nest the predicate bit to... //product[colors[clr= 'green']] ...apparently (after quick google) this is legal XPath. Chris Wilcox ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders