{"id":2010,"date":"2004-03-21T11:12:03","date_gmt":"2004-03-21T11:12:03","guid":{"rendered":"http:\/\/www.soulhuntre.com\/items\/date\/2004\/03\/21\/an-xpath-out-of-the-darkness\/"},"modified":"2004-03-21T11:12:03","modified_gmt":"2004-03-21T11:12:03","slug":"an-xpath-out-of-the-darkness","status":"publish","type":"post","link":"http:\/\/legacyiamsenseiken.local\/2004\/03\/21\/an-xpath-out-of-the-darkness\/","title":{"rendered":"An (x)Path out of the darkness…"},"content":{"rendered":"
Read on and see the beauty that is a good [[XML]] parser in [[Flash]].<\/p>\n
Well, it goes to show you how things can change in just a few hours. Remember Anyway, below you will find a sample XML file, a snippet of code to parse <\/p>\n Sample XML input<\/b><\/u><\/p>\n <?xml version=”1.0″ ?> A function to parse that XML tree<\/b><\/u><\/p>\n _global.parseMenu = function() { for (var i = 0; i < menuTitles.length; i++) { \/\/ trace(_global.menuItems[i].title); Reference links<\/b><\/u><\/p>\n Read on and see the beauty that is a good [[XML]] parser in [[Flash]]. Well, it goes to show you how things can change in just a few hours. Remember my Flash XML parsing issue? Well, I did some more poking around and I found out that the folks who built [[XML]] realized that getting […]<\/p>\n","protected":false},"author":3,"featured_media":53186,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[278],"tags":[],"_links":{"self":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/posts\/2010"}],"collection":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/comments?post=2010"}],"version-history":[{"count":0,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/posts\/2010\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/media\/53186"}],"wp:attachment":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/media?parent=2010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/categories?post=2010"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/tags?post=2010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\nmy Flash XML
\nparsing<\/a> issue? Well, I did some more poking around and I found out that the
\nfolks who built [[XML]] realized that getting at specific data in it sucks. They
\nbuilt something called [[XPath]] which you can sort of think of as a analog to
\n[[wp:SQL]] for a parsed XML tree. <\/p>\n
\nthat puppy and some reference links. If you have any questions [[let me know]].<\/p>\n\n
<items>
<item>
<title>Welcome to the Tutorials<\/title>
<weight>1<\/weight>
<url>\/content\/sections\/tutorials\/article.php?article_id=16<\/url>
<target>main_content<\/target>
<\/item>
<item>
<title>article 15<\/title>
<weight>25<\/weight>
<url>\/content\/sections\/tutorials\/article.php?article_id=30<\/url>
<target>main_content<\/target>
<\/item>
<\/items><\/p>\n<\/blockquote>\n\n
<\/b> var titlePath:String = “\/items\/item\/title”;
var urlPath:String = “\/items\/item\/url”;
var menuTitles = mx.xpath.XPathAPI.selectNodeList(_global.menuItems_xml.firstChild, “\/items\/item\/title”);
var menuURLs = mx.xpath.XPathAPI.selectNodeList(_global.menuItems_xml.firstChild, “\/items\/item\/url”);
var menuTargets = mx.xpath.XPathAPI.selectNodeList(_global.menuItems_xml.firstChild, “\/items\/item\/target”);
var menuWeights = mx.xpath.XPathAPI.selectNodeList(_global.menuItems_xml.firstChild, “\/items\/item\/weight”);<\/p>\n
\/\/ trace( “-_-_–_-_–_-_-> ” + i );
_global.menuItems[i] = new Object;
_global.menuItems[i].title = menuTitles[i].firstChild.nodeValue;
_global.menuItems[i].url = menuURLs[i].firstChild.nodeValue;
_global.menuItems[i].target = menuTargets[i].firstChild.nodeValue;
_global.menuItems[i].weight = menuWeights[i].firstChild.nodeValue;<\/p>\n
\/\/ trace(_global.menuItems[i].url);
\/\/ trace(_global.menuItems[i].target);
\/\/ trace(_global.menuItems[i].weight);
}
}<\/p>\n<\/blockquote>\n\n