DIGG IT!
7
Comments
Published
Sunday, December 05, 2004
at
6:27 PM
.
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.&
x = new XML("<a>blah<t/><t>Hello World</t><t age='1'/></a>")
//GET REQUESTS
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
//SET REQUESTS
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]._attr.dog = "fido" //add/edit attribute Value
x.a.t[2]._attr.age = 34 //add/edit Attribute Value
x.a._node = "<superNode/>" //add Node
x.a.t[0]._node = "<subtNode/>" //add Node
XMLNode["prototype"].__resolve = function(){}
XMLNode["prototype"]["__proto__"] = XMLNodeSubClass["prototype"]
Ted on Twitter - @__ted__
Ted on Adobe Groups
Ted on LinkedIn
Ted on Facebook
Ted at Adobe
Great Stuff. Super usefull !
very cool
and very usefull.
already use it )
Hey Ted, Aral here... Great class! One thing: It appears that you need to access attributes not with "attribute" but _attr when getting them too. I couldn't see support for "attribute" in a cursory glance at the code.
XMLResolver adds items to XMLNode and XML but does not remove anything. You should be able to access any node property/attribute/child identically as before. If you find one that does not work, this is an error in the software.
Ted ;)
How do we treat CDATA using this wonderful thing?
Hi Ted, tx. great stuff. But shouldn't the "attribute" in the example be "attributeS"?
Cheers,
Ben Smeets
Ben,
It should be 'attributes' above that is a typo. The code base has this correct, my blog entry is flawed.
Sorry for the error.
Ted :)