Search Flex Components Free

Custom Search

December 10, 2007

XML Resolver 1.05 (F7 compatibility)

Bob Roswell reported an error to me regarding XML Resolver. I took a look and sure enough the library wasn't F7 compatible. Here is a new compatible version.&

XML Resolver extends the XML object to support name based editing of XML Nodes. It makes it really easy to edit and read XML documents. Best part is that there is no reparsing of the XML document, ever! Resolver uses __resolve to virtually remap the path resolution of the XML Object. When you request a name based path, the __resolve function kicks in and returns the correct item if it exists. If you are setting the value, it will extend the XML object in place.

Download XML RESOLVER 1.05

Here is an example of its use:

x = new XML("blahHello World")

trace(x.a) //return XMLnode
trace(x.a.t[2]) //return XMLNode
trace(x.a.t[2].attribute.age) //return attribute value
trace(x.a._value) //return XMLNode
trace(x.a.t[1]._value) //return TextNode Value
trace(x.a.t[2].attribute) //return Attribute array
trace(x.a._node) //return XMLNode
trace(x.a.t[1]._node) //return XMLNode

x.a._value = "blah22" //add/edit TextNode Value
x.a.t[1]._value = "Hellllo World" //add/edit TextNode Value
x.a.t[2]._value = "222 World" //add/edit TextNode Value
x.a.t[0] = "fido" //add/edit attribute Value
x.a.t[2]._attr.age = 34 //add/edit Attribute Value
x.a._node = "" //add Node
x.a.t[0]._node = "" //add Node

(Credit to Arul for AS color!)

The library was written for Flash 5 originally and migrated to Flash 6 in 2003. There were 2 errors in the library that were fixed in this release.

1. Case sensitivity is now correct. XMLNODE is now XMLNode.

2. The AS2 compiler doesn't like you modifying classes at runtime and doesn't allow using 'prototype' or '__proto__' in code compiled for AS2. There is a hack for this that works really well, simply evaluate the keywords as strings and everything works just fine.

XMLNode["prototype"].__resolve = function(){}

XMLNode["prototype"]["__proto__"] = XMLNodeSubClass["prototype"]

If you find any bugs just drop me an email and I will see what I can do. Thank Bob for reporting the error, glad I could help.

Related Flex Tutorials