[Flashcoders] XPathDocument()
Hey All, This is my first time here, but I am a regular at Flashnewbie. The reason I am posting here is because i didnt get a reply at newbie, so thought this might be something only FlashCoders might be able to help me with. :-) I am using XPath for building one of my applications and retrieved 2 version of the Xpath component at this link http://www.xfactorstudio.com/ . And the way my application is built only the older version works and my code runs like this import com.xfactorstudio.xml.xpath.*; var myDoc = new XPathDocument(); myDoc.onLoad = function(success){ if(success == true){ var thisLocale = this.selectNodes(/loc/dnam); location.text = thisLocale[0].stringValue(); } And I realized XPathDocument() is not supported in the new version of XPath. But I really dont understand this. Are there any reasons why the XPathDocument() is not supported anymore and along with that .stringValue(). I think the transition happened over the past 1 year or so. Did anybody know why this was done. It would be a great eye opener for me if somebody who saw the transition would help me out with the decision of sticking to the old or the new version of Xpath. Thank you. Sincerely, Chaitu. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XPathDocument()
I seem to remember something about a version of XPath having problems with AS2what exact version of XPath are you using? I'll check to see if it's newer than the one I'm using...if not, I'll send you my 'xfactorstudio' source tree, as I have had to modify it in order to make it work. Cheers On 1/25/06, Chaitu Vadlapatla [EMAIL PROTECTED] wrote: Hey All, This is my first time here, but I am a regular at Flashnewbie. The reason I am posting here is because i didnt get a reply at newbie, so thought this might be something only FlashCoders might be able to help me with. :-) I am using XPath for building one of my applications and retrieved 2 version of the Xpath component at this link http://www.xfactorstudio.com/ . And the way my application is built only the older version works and my code runs like this import com.xfactorstudio.xml.xpath.*; var myDoc = new XPathDocument(); myDoc.onLoad = function(success){ if(success == true){ var thisLocale = this.selectNodes(/loc/dnam); location.text = thisLocale[0].stringValue(); } And I realized XPathDocument() is not supported in the new version of XPath. But I really dont understand this. Are there any reasons why the XPathDocument() is not supported anymore and along with that .stringValue(). I think the transition happened over the past 1 year or so. Did anybody know why this was done. It would be a great eye opener for me if somebody who saw the transition would help me out with the decision of sticking to the old or the new version of Xpath. Thank you. Sincerely, Chaitu. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Jordan Snyder Applications Developer Image Action LLC http://www.imageaction.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XPathDocument()
Hi, I couldnt find the version number but both the versions are on this page http://www.xfactorstudio.com/ without any explanation about why some of the classes in the older version were deleted. the version that works for me is *OLD XPath for ActionScript 2* implementation on this page and the one that Doesn't work is *new version of the XPath for ActionScript 2 on the same page. *Hope somebody knows why i shouldnt use the older version and why some classes were deleted.* thanks Chaitu. * Jordan Snyder wrote: I seem to remember something about a version of XPath having problems with AS2what exact version of XPath are you using? I'll check to see if it's newer than the one I'm using...if not, I'll send you my 'xfactorstudio' source tree, as I have had to modify it in order to make it work. Cheers On 1/25/06, Chaitu Vadlapatla [EMAIL PROTECTED] wrote: Hey All, This is my first time here, but I am a regular at Flashnewbie. The reason I am posting here is because i didnt get a reply at newbie, so thought this might be something only FlashCoders might be able to help me with. :-) I am using XPath for building one of my applications and retrieved 2 version of the Xpath component at this link http://www.xfactorstudio.com/ . And the way my application is built only the older version works and my code runs like this import com.xfactorstudio.xml.xpath.*; var myDoc = new XPathDocument(); myDoc.onLoad = function(success){ if(success == true){ var thisLocale = this.selectNodes(/loc/dnam); location.text = thisLocale[0].stringValue(); } And I realized XPathDocument() is not supported in the new version of XPath. But I really dont understand this. Are there any reasons why the XPathDocument() is not supported anymore and along with that .stringValue(). I think the transition happened over the past 1 year or so. Did anybody know why this was done. It would be a great eye opener for me if somebody who saw the transition would help me out with the decision of sticking to the old or the new version of Xpath. Thank you. Sincerely, Chaitu. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Jordan Snyder Applications Developer Image Action LLC http://www.imageaction.com ___ 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] XPathDocument()
I think that they pulled it out because it's really just a wrapper for the Xpath classes static methods. In addition he was also using the old prototype syntax to add the functionality directly to the XMLNode class. This pattern worked well when you weren't concerned with strong typing and the whole AS2 philosophy. Anyway, I had the same issue, in that I have a project that makes extensive use of the XPathDocument class, so I created my own when they removed it. Here it is, in case you are interested. It's really quite simple. Just remember that the methods return instances of XML not XPathDocuments, so you have to convert those if you need that functionality on the results. It's working this way, because I decided not to alter the XMLNode class's prototype. -Chris /** Copyright (c) 2002 Neeld Tanksley. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: This product includes software developed by Neeld Tanksley (http://xfactorstudio.com). Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The name Neeld Tanksley must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NEELD TANKSLEY BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ import com.xfactorstudio.xml.xpath.XPath; import com.xfactorstudio.xml.xpath.XPathAxes; import com.xfactorstudio.xml.xpath.XPathFunctions; /** * Based on Neeld Tanksley's original XPathDocument wrapper class. Changed the * prototypes to simple public methods. Note that this implementation * does not return XMLNode instances with an altered prototype. * * @author Chris Allen */ class com.xfactorstudio.xml.xpath.XPathDocument extends XML{ var callback:Object; public function XPathDocument(text:String){ super(text); } public function selectNodes(query:String) { return XPath.selectNodes(this,query); } public function selectSingleNode(query:String) { return XPath.selectNodes(this,query)[0]; } public function ancestor(){ return XPathAxes.ancestor(this); } public function ancestorOrSelf(){ return XPathAxes.ancestorOrSelf(this); } public function attribute(){ return XPathAxes.attribute(this); } public function child(){ return XPathAxes.child(this); } public function descendant(){ return XPathAxes.descendant(this); } public function descendantOrSelf(){ return XPathAxes.descendantOrSelf(this); } public function following(){ return XPathAxes.following(this); } public function followingSibling(){ return XPathAxes.followingSibling(this); } public function parent(){ return XPathAxes.parent(this); } public function preceding(){ return XPathAxes.preceding(this); } public function precedingSibling(){ return XPathAxes.precedingSibling(this); } public function self(){ return XPathAxes.self(this); } public function namespace(){ return XPathAxes.namespace(this); } public function root(){ return XPathAxes.root(this); } public function getNamedNodes(name){ return XPath.getNamedNodes(this.childNodes,name); } public function stringValue(){ return XPathAxes.stringValue(this); } public function name(){ return XPathFunctions.name([[this]]); } public function localName(){ return XPathFunctions.localName([[this]]); } public function namespaceURI(){ return
Re: [Flashcoders] XPathDocument()
that helps. Thanks a bunch!! Chaitu. Chris Allen wrote: I think that they pulled it out because it's really just a wrapper for the Xpath classes static methods. In addition he was also using the old prototype syntax to add the functionality directly to the XMLNode class. This pattern worked well when you weren't concerned with strong typing and the whole AS2 philosophy. Anyway, I had the same issue, in that I have a project that makes extensive use of the XPathDocument class, so I created my own when they removed it. Here it is, in case you are interested. It's really quite simple. Just remember that the methods return instances of XML not XPathDocuments, so you have to convert those if you need that functionality on the results. It's working this way, because I decided not to alter the XMLNode class's prototype. -Chris /** Copyright (c) 2002 Neeld Tanksley. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: This product includes software developed by Neeld Tanksley (http://xfactorstudio.com). Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The name Neeld Tanksley must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NEELD TANKSLEY BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ import com.xfactorstudio.xml.xpath.XPath; import com.xfactorstudio.xml.xpath.XPathAxes; import com.xfactorstudio.xml.xpath.XPathFunctions; /** * Based on Neeld Tanksley's original XPathDocument wrapper class. Changed the * prototypes to simple public methods. Note that this implementation * does not return XMLNode instances with an altered prototype. * * @author Chris Allen */ class com.xfactorstudio.xml.xpath.XPathDocument extends XML{ var callback:Object; public function XPathDocument(text:String){ super(text); } public function selectNodes(query:String) { return XPath.selectNodes(this,query); } public function selectSingleNode(query:String) { return XPath.selectNodes(this,query)[0]; } public function ancestor(){ return XPathAxes.ancestor(this); } public function ancestorOrSelf(){ return XPathAxes.ancestorOrSelf(this); } public function attribute(){ return XPathAxes.attribute(this); } public function child(){ return XPathAxes.child(this); } public function descendant(){ return XPathAxes.descendant(this); } public function descendantOrSelf(){ return XPathAxes.descendantOrSelf(this); } public function following(){ return XPathAxes.following(this); } public function followingSibling(){ return XPathAxes.followingSibling(this); } public function parent(){ return XPathAxes.parent(this); } public function preceding(){ return XPathAxes.preceding(this); } public function precedingSibling(){ return XPathAxes.precedingSibling(this); } public function self(){ return XPathAxes.self(this); } public function namespace(){ return XPathAxes.namespace(this); } public function root(){ return XPathAxes.root(this); } public function getNamedNodes(name){ return XPath.getNamedNodes(this.childNodes,name); } public function stringValue(){ return XPathAxes.stringValue(this); } public function name(){ return XPathFunctions.name([[this]]); } public function localName(){ return XPathFunctions.localName([[this]]); }