RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
>>Doesnt XPath.selectNodes(myxml, "pathtocontent/text()"); return the text >>value as well? Sure, but I don't think that works on attribute values (as in my example in my post). Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Mike Boutin wrote: Doesnt XPath.selectNodes(myxml, "pathtocontent/text()"); return the text value as well? The documentation says, that selectNodes *always* returns an array of XMLNode-objects - and it does. Always. The "text()"-syntax is only used to get the XMLNode representing a text node - that has no nodeName and thus cannot be accessed otherwise. -- Morten Barklund - Information Architect - Shockwaved ApS Larsbjoernsstraede 8 - DK-1454 Copenhagen K, Denmark Phone: +45 7027 2227 - Fax: +45 3369 1174 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Doesnt XPath.selectNodes(myxml, "pathtocontent/text()"); return the text value as well? Doug Coning wrote: Could it be because the Xpath may return either a string or an array depending on how you structure your query? I agree that if there was a selectText type method where you pass in an xpath where you expect only one (or the first) resulting text value would be great. Doug Coning Software Developer FORUM Solutions, LLC -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, December 20, 2005 2:55 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity That's using Flash's XML object with XPath to grab the node value - sure that works, and is good for nodes with CDATA, but overly complex - wrapping String() around it is easier. I was wondering just about the XPath implementation and why it doesn't return a native string, thanks though. Jason Merrill | E-Learning Solutions | icfconsulting.com -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mike Boutin Sent: Tuesday, December 20, 2005 1:43 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity Maybe something like this may help? myText=XMLNode((XPath.selectNodes(myxml,"myNodePath/mynode()")[0])).no de Value; Mike Boutin Merrill, Jason wrote: AFAIK, XPath.selectNodes() returns an Array. How do you use Xpath to return node values then? Jason Merrill | E-Learning Solutions | icfconsulting.com -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Johan Lopes Sent: Tuesday, December 20, 2005 1:07 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity Hi Jason, AFAIK, XPath.selectNodes() returns an Array. /** 10 *selectNodes 11 * 12 *returns an array of nodes that match the given XPath 13 *expression using the the XMLNode (context) as the 14 *starting context for the expression. 15 * 16 *This is the description 17 *@param (XMLNode)context 18 *@param (String)XPath expression 19 *@return (Array) matching nodes 20 */ 21 static function selectNodes(context,path:String):Array{ 22 return XPathParser.parseQuery(context,path) 23 } 24 HTH, /Johan On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: I'm asking this more out of curiosity than necessity, but the responses to this thread may help be avoid some headaches in the future. Been using xfactorstudio's Xpath classes with great success. However, I have found an odd thing - sometimes I have to cast what I thought was already string, to a String in order for a V2 component to accept the value. For example, **This does not work: var thisVideo:String = XPath.selectNodes("content_xml", "thecontentpath/@videoUrl"); video_mc.mediaPlayer.setMedia(thisVideo);//does not work Even though no compiler errors and a trace on the var "thisVideo" traces the proper "string" (media/video/Welcome.flv) - or what I thought was a string, the video in the MediaPlayback component does not play.--- **So instead, when casting to String first, this works: var thisVideo:String = String(XPath.selectNodes("content_xml", "thecontentpath/@videoUrl")); video_mc.mediaPlayer.setMedia(thisVideo);.//works Why? What type of object was the Xpath value before I cast it to a string? This makes sense for numbers in an XML file, but for Strings??? The kicker is I can send other XPath values I don't cast to strings first to text fields, textAreas, and they show up fine. So is it something quirky with V2 components as well? Thanks. Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Could it be because the Xpath may return either a string or an array depending on how you structure your query? I agree that if there was a selectText type method where you pass in an xpath where you expect only one (or the first) resulting text value would be great. Doug Coning Software Developer FORUM Solutions, LLC > -Original Message- > From: [EMAIL PROTECTED] [mailto:flashcoders- > [EMAIL PROTECTED] On Behalf Of Merrill, Jason > Sent: Tuesday, December 20, 2005 2:55 PM > To: Flashcoders mailing list > Subject: RE: [Flashcoders] Out of curiosity, XPath and String Datatype > Oddity > > That's using Flash's XML object with XPath to grab the node value - sure > that works, and is good for nodes with CDATA, but overly complex - > wrapping String() around it is easier. I was wondering just about the > XPath implementation and why it doesn't return a native string, thanks > though. > > Jason Merrill | E-Learning Solutions | icfconsulting.com > > > > > > > > > > >>-Original Message- > >>From: [EMAIL PROTECTED] [mailto:flashcoders- > >>[EMAIL PROTECTED] On Behalf Of Mike Boutin > >>Sent: Tuesday, December 20, 2005 1:43 PM > >>To: Flashcoders mailing list > >>Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype > Oddity > >> > >>Maybe something like this may help? > >> > >>myText=XMLNode((XPath.selectNodes(myxml,"myNodePath/mynode()")[0])).no > de > >>Value; > >> > >> > >> > >>Mike Boutin > >> > >> > >>Merrill, Jason wrote: > >> > >>>>>AFAIK, XPath.selectNodes() returns an Array. > >>>>> > >>>>> > >>> > >>>How do you use Xpath to return node values then? > >>> > >>>Jason Merrill | E-Learning Solutions | icfconsulting.com > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>>>>-Original Message- > >>>>>From: [EMAIL PROTECTED] > [mailto:flashcoders- > >>>>>[EMAIL PROTECTED] On Behalf Of Johan Lopes > >>>>>Sent: Tuesday, December 20, 2005 1:07 PM > >>>>>To: Flashcoders mailing list > >>>>>Subject: Re: [Flashcoders] Out of curiosity, XPath and String > Datatype > >>>>> > >>>>> > >>>Oddity > >>> > >>> > >>>>>Hi Jason, > >>>>> > >>>>>AFAIK, XPath.selectNodes() returns an Array. > >>>>> > >>>>> > >>>>> > >>>>> /** > >>>>>10 *selectNodes > >>>>>11 * > >>>>>12 *returns an array of nodes that match the given XPath > >>>>>13 *expression using the the XMLNode (context) as the > >>>>>14 *starting context for the expression. > >>>>>15 * > >>>>>16 *This is the description > >>>>>17 *@param (XMLNode)context > >>>>>18 *@param (String)XPath expression > >>>>>19 *@return (Array) matching nodes > >>>>>20 */ > >>>>>21 static function selectNodes(context,path:String):Array{ > >>>>>22 return XPathParser.parseQuery(context,path) > >>>>>23 } > >>>>>24 > >>>>> > >>>>> > >>>>> > >>>>>HTH, > >>>>> > >>>>>/Johan > >>>>> > >>>>>On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: > >>>>> > >>>>> > >>>>>>I'm asking this more out of curiosity than necessity, but the > >>>>>> > >>>>>> > >>>responses > >>> > >>> > >>>>>>to this thread may help be avoid some headaches in the future. > >>>>>> > >>>>>>Been using xfactorstudio's Xpath classes with great success. > >>>>>> > >>>>>> > >>>However, I > >>> > >>> > >>>>>>have found an odd thing - sometimes I have
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
That's using Flash's XML object with XPath to grab the node value - sure that works, and is good for nodes with CDATA, but overly complex - wrapping String() around it is easier. I was wondering just about the XPath implementation and why it doesn't return a native string, thanks though. Jason Merrill | E-Learning Solutions | icfconsulting.com >>-Original Message- >>From: [EMAIL PROTECTED] [mailto:flashcoders- >>[EMAIL PROTECTED] On Behalf Of Mike Boutin >>Sent: Tuesday, December 20, 2005 1:43 PM >>To: Flashcoders mailing list >>Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity >> >>Maybe something like this may help? >> >>myText=XMLNode((XPath.selectNodes(myxml,"myNodePath/mynode()")[0])).no de >>Value; >> >> >> >>Mike Boutin >> >> >>Merrill, Jason wrote: >> >>>>>AFAIK, XPath.selectNodes() returns an Array. >>>>> >>>>> >>> >>>How do you use Xpath to return node values then? >>> >>>Jason Merrill | E-Learning Solutions | icfconsulting.com >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>>>-Original Message- >>>>>From: [EMAIL PROTECTED] [mailto:flashcoders- >>>>>[EMAIL PROTECTED] On Behalf Of Johan Lopes >>>>>Sent: Tuesday, December 20, 2005 1:07 PM >>>>>To: Flashcoders mailing list >>>>>Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype >>>>> >>>>> >>>Oddity >>> >>> >>>>>Hi Jason, >>>>> >>>>>AFAIK, XPath.selectNodes() returns an Array. >>>>> >>>>> >>>>> >>>>> /** >>>>>10 *selectNodes >>>>>11 * >>>>>12 *returns an array of nodes that match the given XPath >>>>>13 *expression using the the XMLNode (context) as the >>>>>14 *starting context for the expression. >>>>>15 * >>>>>16 *This is the description >>>>>17 *@param (XMLNode)context >>>>>18 *@param (String)XPath expression >>>>>19 *@return (Array) matching nodes >>>>>20 */ >>>>>21 static function selectNodes(context,path:String):Array{ >>>>>22 return XPathParser.parseQuery(context,path) >>>>>23 } >>>>>24 >>>>> >>>>> >>>>> >>>>>HTH, >>>>> >>>>>/Johan >>>>> >>>>>On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: >>>>> >>>>> >>>>>>I'm asking this more out of curiosity than necessity, but the >>>>>> >>>>>> >>>responses >>> >>> >>>>>>to this thread may help be avoid some headaches in the future. >>>>>> >>>>>>Been using xfactorstudio's Xpath classes with great success. >>>>>> >>>>>> >>>However, I >>> >>> >>>>>>have found an odd thing - sometimes I have to cast what I thought >>>>>> >>>>>> >>>was >>> >>> >>>>>>already string, to a String in order for a V2 component to accept >>>>>> >>>>>> >>>the >>> >>> >>>>>>value. For example, >>>>>> >>>>>>**This does not work: >>>>>> >>>>>>var thisVideo:String = XPath.selectNodes("content_xml", >>>>>>"thecontentpath/@videoUrl"); >>>>>>video_mc.mediaPlayer.setMedia(thisVideo);//does not work >>>>>> >>>>>>Even though no compiler errors and a trace on the var >>>>>> >>>>>> >>>"thisVideo" >>> >>> >>>>>>traces the proper "string" (media/video/Welcome.flv) - or what I >>>>>> >>>>>> >>>thought >>> >>> >>>>>>was a string, the video in the MediaPlayback component does not >>>>>> >>>>>> >>>play.--- >>> >>> >>>>>>**
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Yes, I have come across this as well and always use: String(XPath.selectNodes(temp_xml,"myPath/text()")[0]) Doug Coning Software Developer FORUM Solutions, LLC > -Original Message- > From: [EMAIL PROTECTED] [mailto:flashcoders- > [EMAIL PROTECTED] On Behalf Of Mike Boutin > Sent: Tuesday, December 20, 2005 1:43 PM > To: Flashcoders mailing list > Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype > Oddity > > Maybe something like this may help? > > myText=XMLNode((XPath.selectNodes(myxml,"myNodePath/mynode()")[0])).node Va > lue; > > > > Mike Boutin > > > Merrill, Jason wrote: > > >>>AFAIK, XPath.selectNodes() returns an Array. > >>> > >>> > > > >How do you use Xpath to return node values then? > > > >Jason Merrill | E-Learning Solutions | icfconsulting.com > > > > > > > > > > > > > > > > > > > > > > > > > >>>-Original Message- > >>>From: [EMAIL PROTECTED] [mailto:flashcoders- > >>>[EMAIL PROTECTED] On Behalf Of Johan Lopes > >>>Sent: Tuesday, December 20, 2005 1:07 PM > >>>To: Flashcoders mailing list > >>>Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype > >>> > >>> > >Oddity > > > > > >>>Hi Jason, > >>> > >>>AFAIK, XPath.selectNodes() returns an Array. > >>> > >>> > >>> > >>> /** > >>>10 *selectNodes > >>>11 * > >>>12 *returns an array of nodes that match the given XPath > >>>13 *expression using the the XMLNode (context) as the > >>>14 *starting context for the expression. > >>>15 * > >>>16 *This is the description > >>>17 *@param (XMLNode)context > >>>18 *@param (String)XPath expression > >>>19 *@return (Array) matching nodes > >>>20 */ > >>>21 static function selectNodes(context,path:String):Array{ > >>>22 return XPathParser.parseQuery(context,path) > >>>23 } > >>>24 > >>> > >>> > >>> > >>>HTH, > >>> > >>>/Johan > >>> > >>>On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: > >>> > >>> > >>>>I'm asking this more out of curiosity than necessity, but the > >>>> > >>>> > >responses > > > > > >>>>to this thread may help be avoid some headaches in the future. > >>>> > >>>>Been using xfactorstudio's Xpath classes with great success. > >>>> > >>>> > >However, I > > > > > >>>>have found an odd thing - sometimes I have to cast what I thought > >>>> > >>>> > >was > > > > > >>>>already string, to a String in order for a V2 component to accept > >>>> > >>>> > >the > > > > > >>>>value. For example, > >>>> > >>>>**This does not work: > >>>> > >>>>var thisVideo:String = XPath.selectNodes("content_xml", > >>>>"thecontentpath/@videoUrl"); > >>>>video_mc.mediaPlayer.setMedia(thisVideo);//does not work > >>>> > >>>>Even though no compiler errors and a trace on the var > >>>> > >>>> > >"thisVideo" > > > > > >>>>traces the proper "string" (media/video/Welcome.flv) - or what I > >>>> > >>>> > >thought > > > > > >>>>was a string, the video in the MediaPlayback component does not > >>>> > >>>> > >play.--- > > > > > >>>>**So instead, when casting to String first, this works: > >>>>var thisVideo:String = String(XPath.selectNodes("content_xml", > >>>>"thecontentpath/@videoUrl")); > >>>>video_mc.mediaPlayer.setMedia(thisVideo);.//works > >>>> > >>>>Why? What type of object was the Xpath value before I cast it to a > >>>>string? This makes sense for numbers in an XML file, but for > >>>> > >>>> > >Strings??? > > > > > >>>>The kicker is I can send other XP
Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Maybe something like this may help? myText=XMLNode((XPath.selectNodes(myxml,"myNodePath/mynode()")[0])).nodeValue; Mike Boutin Merrill, Jason wrote: AFAIK, XPath.selectNodes() returns an Array. How do you use Xpath to return node values then? Jason Merrill | E-Learning Solutions | icfconsulting.com -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Johan Lopes Sent: Tuesday, December 20, 2005 1:07 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity Hi Jason, AFAIK, XPath.selectNodes() returns an Array. /** 10 *selectNodes 11 * 12 *returns an array of nodes that match the given XPath 13 *expression using the the XMLNode (context) as the 14 *starting context for the expression. 15 * 16 *This is the description 17 *@param (XMLNode)context 18 *@param (String)XPath expression 19 *@return (Array) matching nodes 20 */ 21 static function selectNodes(context,path:String):Array{ 22 return XPathParser.parseQuery(context,path) 23 } 24 HTH, /Johan On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: I'm asking this more out of curiosity than necessity, but the responses to this thread may help be avoid some headaches in the future. Been using xfactorstudio's Xpath classes with great success. However, I have found an odd thing - sometimes I have to cast what I thought was already string, to a String in order for a V2 component to accept the value. For example, **This does not work: var thisVideo:String = XPath.selectNodes("content_xml", "thecontentpath/@videoUrl"); video_mc.mediaPlayer.setMedia(thisVideo);//does not work Even though no compiler errors and a trace on the var "thisVideo" traces the proper "string" (media/video/Welcome.flv) - or what I thought was a string, the video in the MediaPlayback component does not play.--- **So instead, when casting to String first, this works: var thisVideo:String = String(XPath.selectNodes("content_xml", "thecontentpath/@videoUrl")); video_mc.mediaPlayer.setMedia(thisVideo);.//works Why? What type of object was the Xpath value before I cast it to a string? This makes sense for numbers in an XML file, but for Strings??? The kicker is I can send other XPath values I don't cast to strings first to text fields, textAreas, and they show up fine. So is it something quirky with V2 components as well? Thanks. Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. ___ 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 ___ 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
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Ralph, FYI - As per your suggestion, selectNodesAsString does not work. If I use that, I still have to cast it to String first. Jason Merrill | E-Learning Solutions | icfconsulting.com >>-Original Message- >>From: [EMAIL PROTECTED] [mailto:flashcoders- >>[EMAIL PROTECTED] On Behalf Of Ralph Caraveo >>Sent: Tuesday, December 20, 2005 1:00 PM >>To: Flashcoders mailing list >>Subject: RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity >> >>Hi Jason, >> >>I've noticed simliar behavior but I think it's just in how you are using >>it. Generally I think Xpath will return an array of XMLNode types >>unless you grab a small enough piece of information. If you look in the >>class files you can also use selectNodesAsString. This will force all >>your returned data to be strings. >> >>Unfortunately I myself just started using Xpath and I love it...so I >>help this helps or points you in the right direction maybe someone else >>can shed more light. >> >>Regards, >> >>-Ralph >> >>-Original Message- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On Behalf Of Merrill, >>Jason >>Sent: Tuesday, December 20, 2005 9:21 AM >>To: Flashcoders mailing list >>Subject: [Flashcoders] Out of curiosity, XPath and String Datatype >>Oddity >> >>I'm asking this more out of curiosity than necessity, but the responses >>to this thread may help be avoid some headaches in the future. >> >>Been using xfactorstudio's Xpath classes with great success. However, I >>have found an odd thing - sometimes I have to cast what I thought was >>already string, to a String in order for a V2 component to accept the >>value. For example, >> >>**This does not work: >> >>var thisVideo:String = XPath.selectNodes("content_xml", >>"thecontentpath/@videoUrl"); >>video_mc.mediaPlayer.setMedia(thisVideo);//does not work >> >>Even though no compiler errors and a trace on the var "thisVideo" >>traces the proper "string" (media/video/Welcome.flv) - or what I thought >>was a string, the video in the MediaPlayback component does not play.--- >> >>**So instead, when casting to String first, this works: >>var thisVideo:String = String(XPath.selectNodes("content_xml", >>"thecontentpath/@videoUrl")); >>video_mc.mediaPlayer.setMedia(thisVideo);.//works >> >>Why? What type of object was the Xpath value before I cast it to a >>string? This makes sense for numbers in an XML file, but for Strings??? >>The kicker is I can send other XPath values I don't cast to strings >>first to text fields, textAreas, and they show up fine. So is it >>something quirky with V2 components as well? >> >>Thanks. >> >>Jason Merrill | E-Learning Solutions | icfconsulting.com >> >> >> >>NOTICE: >>This message is for the designated recipient only and may contain >>privileged or confidential information. If you have received it in >>error, please notify the sender immediately and delete the original. Any >>other use of this e-mail by you is prohibited. >>___ >>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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
>>AFAIK, XPath.selectNodes() returns an Array. How do you use Xpath to return node values then? Jason Merrill | E-Learning Solutions | icfconsulting.com >>-Original Message- >>From: [EMAIL PROTECTED] [mailto:flashcoders- >>[EMAIL PROTECTED] On Behalf Of Johan Lopes >>Sent: Tuesday, December 20, 2005 1:07 PM >>To: Flashcoders mailing list >>Subject: Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity >> >>Hi Jason, >> >>AFAIK, XPath.selectNodes() returns an Array. >> >> >> >> /** >>10*selectNodes >>11* >>12*returns an array of nodes that match the given XPath >>13*expression using the the XMLNode (context) as the >>14*starting context for the expression. >>15* >>16*This is the description >>17*@param (XMLNode)context >>18*@param (String)XPath expression >>19*@return (Array) matching nodes >>20*/ >>21static function selectNodes(context,path:String):Array{ >>22return XPathParser.parseQuery(context,path) >>23} >>24 >> >> >> >>HTH, >> >>/Johan >> >>On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: >>> I'm asking this more out of curiosity than necessity, but the responses >>> to this thread may help be avoid some headaches in the future. >>> >>> Been using xfactorstudio's Xpath classes with great success. However, I >>> have found an odd thing - sometimes I have to cast what I thought was >>> already string, to a String in order for a V2 component to accept the >>> value. For example, >>> >>> **This does not work: >>> >>> var thisVideo:String = XPath.selectNodes("content_xml", >>> "thecontentpath/@videoUrl"); >>> video_mc.mediaPlayer.setMedia(thisVideo);//does not work >>> >>> Even though no compiler errors and a trace on the var "thisVideo" >>> traces the proper "string" (media/video/Welcome.flv) - or what I thought >>> was a string, the video in the MediaPlayback component does not play.--- >>> >>> **So instead, when casting to String first, this works: >>> var thisVideo:String = String(XPath.selectNodes("content_xml", >>> "thecontentpath/@videoUrl")); >>> video_mc.mediaPlayer.setMedia(thisVideo);.//works >>> >>> Why? What type of object was the Xpath value before I cast it to a >>> string? This makes sense for numbers in an XML file, but for Strings??? >>> The kicker is I can send other XPath values I don't cast to strings >>> first to text fields, textAreas, and they show up fine. So is it >>> something quirky with V2 components as well? >>> >>> Thanks. >>> >>> Jason Merrill | E-Learning Solutions | icfconsulting.com >>> >>> >>> >>> NOTICE: >>> This message is for the designated recipient only and may contain privileged or >>confidential information. If you have received it in error, please notify the sender >>immediately and delete the original. Any other use of this e-mail by you is >>prohibited. >>> ___ >>> 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Very Interesting - thank you. I've had a hard time finding this kind of documentation. At least some that is readable. The w3c pages are pretty over-spec'd and impossible to me for the most part. Interesting to have to open the class files to find out what you can do. Thanks again! Jason Merrill | E-Learning Solutions | icfconsulting.com >>-Original Message- >>From: [EMAIL PROTECTED] [mailto:flashcoders- >>[EMAIL PROTECTED] On Behalf Of Ralph Caraveo >>Sent: Tuesday, December 20, 2005 1:00 PM >>To: Flashcoders mailing list >>Subject: RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity >> >>Hi Jason, >> >>I've noticed simliar behavior but I think it's just in how you are using >>it. Generally I think Xpath will return an array of XMLNode types >>unless you grab a small enough piece of information. If you look in the >>class files you can also use selectNodesAsString. This will force all >>your returned data to be strings. >> >>Unfortunately I myself just started using Xpath and I love it...so I >>help this helps or points you in the right direction maybe someone else >>can shed more light. >> >>Regards, >> >>-Ralph NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Hmm. I now see what you mean. Maybe when you pass the value without casting it in the "raw", some V2 components such as textArea etc, does an auto cast toString and therefore can deal with it but the MediaPlayback component is expecting a proper String and doesn't no what to grab it if you pass MyVar[0]. As always I need to warn ya I might be talking out of my ass here :) /Johan On 12/20/05, Johan Lopes <[EMAIL PROTECTED]> wrote: > Hi Jason, > > AFAIK, XPath.selectNodes() returns an Array. > > > > /** > 10 *selectNodes > 11 * > 12 *returns an array of nodes that match the given XPath > 13 *expression using the the XMLNode (context) as the > 14 *starting context for the expression. > 15 * > 16 *This is the description > 17 *@param (XMLNode)context > 18 *@param (String)XPath expression > 19 *@return (Array) matching nodes > 20 */ > 21 static function selectNodes(context,path:String):Array{ > 22 return XPathParser.parseQuery(context,path) > 23 } > 24 > > > > HTH, > > /Johan > > On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: > > I'm asking this more out of curiosity than necessity, but the responses > > to this thread may help be avoid some headaches in the future. > > > > Been using xfactorstudio's Xpath classes with great success. However, I > > have found an odd thing - sometimes I have to cast what I thought was > > already string, to a String in order for a V2 component to accept the > > value. For example, > > > > **This does not work: > > > > var thisVideo:String = XPath.selectNodes("content_xml", > > "thecontentpath/@videoUrl"); > > video_mc.mediaPlayer.setMedia(thisVideo);//does not work > > > > Even though no compiler errors and a trace on the var "thisVideo" > > traces the proper "string" (media/video/Welcome.flv) - or what I thought > > was a string, the video in the MediaPlayback component does not play.--- > > > > **So instead, when casting to String first, this works: > > var thisVideo:String = String(XPath.selectNodes("content_xml", > > "thecontentpath/@videoUrl")); > > video_mc.mediaPlayer.setMedia(thisVideo);.//works > > > > Why? What type of object was the Xpath value before I cast it to a > > string? This makes sense for numbers in an XML file, but for Strings??? > > The kicker is I can send other XPath values I don't cast to strings > > first to text fields, textAreas, and they show up fine. So is it > > something quirky with V2 components as well? > > > > Thanks. > > > > Jason Merrill | E-Learning Solutions | icfconsulting.com > > > > > > > > NOTICE: > > This message is for the designated recipient only and may contain > > privileged or confidential information. If you have received it in error, > > please notify the sender immediately and delete the original. Any other use > > of this e-mail by you is prohibited. > > ___ > > 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
Re: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Hi Jason, AFAIK, XPath.selectNodes() returns an Array. /** 10 *selectNodes 11 * 12 *returns an array of nodes that match the given XPath 13 *expression using the the XMLNode (context) as the 14 *starting context for the expression. 15 * 16 *This is the description 17 *@param (XMLNode)context 18 *@param (String)XPath expression 19 *@return (Array) matching nodes 20 */ 21 static function selectNodes(context,path:String):Array{ 22 return XPathParser.parseQuery(context,path) 23 } 24 HTH, /Johan On 12/20/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: > I'm asking this more out of curiosity than necessity, but the responses > to this thread may help be avoid some headaches in the future. > > Been using xfactorstudio's Xpath classes with great success. However, I > have found an odd thing - sometimes I have to cast what I thought was > already string, to a String in order for a V2 component to accept the > value. For example, > > **This does not work: > > var thisVideo:String = XPath.selectNodes("content_xml", > "thecontentpath/@videoUrl"); > video_mc.mediaPlayer.setMedia(thisVideo);//does not work > > Even though no compiler errors and a trace on the var "thisVideo" > traces the proper "string" (media/video/Welcome.flv) - or what I thought > was a string, the video in the MediaPlayback component does not play.--- > > **So instead, when casting to String first, this works: > var thisVideo:String = String(XPath.selectNodes("content_xml", > "thecontentpath/@videoUrl")); > video_mc.mediaPlayer.setMedia(thisVideo);.//works > > Why? What type of object was the Xpath value before I cast it to a > string? This makes sense for numbers in an XML file, but for Strings??? > The kicker is I can send other XPath values I don't cast to strings > first to text fields, textAreas, and they show up fine. So is it > something quirky with V2 components as well? > > Thanks. > > Jason Merrill | E-Learning Solutions | icfconsulting.com > > > > NOTICE: > This message is for the designated recipient only and may contain privileged > or confidential information. If you have received it in error, please notify > the sender immediately and delete the original. Any other use of this e-mail > by you is prohibited. > ___ > 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
RE: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity
Hi Jason, I've noticed simliar behavior but I think it's just in how you are using it. Generally I think Xpath will return an array of XMLNode types unless you grab a small enough piece of information. If you look in the class files you can also use selectNodesAsString. This will force all your returned data to be strings. Unfortunately I myself just started using Xpath and I love it...so I help this helps or points you in the right direction maybe someone else can shed more light. Regards, -Ralph -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, December 20, 2005 9:21 AM To: Flashcoders mailing list Subject: [Flashcoders] Out of curiosity, XPath and String Datatype Oddity I'm asking this more out of curiosity than necessity, but the responses to this thread may help be avoid some headaches in the future. Been using xfactorstudio's Xpath classes with great success. However, I have found an odd thing - sometimes I have to cast what I thought was already string, to a String in order for a V2 component to accept the value. For example, **This does not work: var thisVideo:String = XPath.selectNodes("content_xml", "thecontentpath/@videoUrl"); video_mc.mediaPlayer.setMedia(thisVideo);//does not work Even though no compiler errors and a trace on the var "thisVideo" traces the proper "string" (media/video/Welcome.flv) - or what I thought was a string, the video in the MediaPlayback component does not play.--- **So instead, when casting to String first, this works: var thisVideo:String = String(XPath.selectNodes("content_xml", "thecontentpath/@videoUrl")); video_mc.mediaPlayer.setMedia(thisVideo);.//works Why? What type of object was the Xpath value before I cast it to a string? This makes sense for numbers in an XML file, but for Strings??? The kicker is I can send other XPath values I don't cast to strings first to text fields, textAreas, and they show up fine. So is it something quirky with V2 components as well? Thanks. Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. ___ 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