XML Question

Malte Brill revolution at derbrill.de
Thu Aug 28 22:00:21 EDT 2008


While this is inconvenient behaviour, it might be argued that it is  
correct, or at least standard compliant. ;-)
So before the behaviour is changed I would like this discussed. I  
think the reason why you seem to lose the tag is that the namespace is  
not defined.
The tag is not lost, but loses the undefined namespace identifier  
though.

If you parse XML like this:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<wfw:commentRss>Just a comment</wfw:commentRss>
</feed>

You end up with this XMLText:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <commentRss>Just a comment</commentRss>
</feed>

You could now still access the tags by looping over all children and  
siblings recursively.


However, parsing a valid XML file like this:

<?xml version="1.0" encoding="UTF-8"?>
<f:table xmlns:f="http://www.w3schools.com/furniture">
    <f:name>African Coffee Table</f:name>
    <f:width>80</f:width>
    <f:length>120</f:length>
</f:table>

ends up with this XMLText:

<?xml version="1.0" encoding="UTF-8"?>
<f:table xmlns:f="http://www.w3schools.com/furniture">
   <f:name>African Coffee Table</f:name>
   <f:width>80</f:width>
   <f:length>120</f:length>
</f:table>

This would allow accessing the tags including the namespaces.

There are XML libraries for other environments, that handle the 1st  
case exactly the way rev does, others do not lose the namespace. As  
far as I can tell version 2 is W3C compliant while version 1 is not. A  
bug in Revs external? Not sure about that but eager to hear other  
opinions.

All the best,

Malte


More information about the use-livecode mailing list