In my last post I presented a RegEx solution to remove a pesky namespace from an XML response payload; another possible solution is to use the * notation to specify any namespace like the following:
Any namespaceThe following example shows how to get an element or attribute value when any namespace is specified on the element or attribute:var attributes:XMLList = XML(event.result).*::Description.*::value;The previous code returns xxx for either one of the following XML documents:XML document one:<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description> <rdf:value>xxx</rdf:value> </rdf:Description> </rdf:RDF>XML document two:<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cm="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <cm:Description> <rdf:value>xxx</rdf:value> </cm:Description> </rdf:RDF>
I nabbed this chunk of code from the Flex Developer’s Guide, section “Handling results as XML with the e4x result format.
Recent Comments