>I don't like xml namespaces either because of the overhead they bring on simple
>documents, but they can't just simply be removed. Parsing would be unguaranteed,
>because documents could have have property name collisions, and creating xml back from vfp
>would be impossible because you'll end up with a vfp object that is not a real representation
>of the original XML. ( And of course, you would not be able to create XML with namespaces using VFP. )
>
>So yesterday I uploaded a new version, changing the ugly "_58_" for a simple "_" .
>
>The character escaping for property names is now:
>
>_ = __
>: = _
>. = _d_
>) = _l_
>( = _r_
>- = _h_
I see your point, but without namespaces XML wouldn't serve much for data and semantic integration.
Whether one likes or not, all elements in an XML document belong to a namespace. If none is declared, they still belong to the default namespace, that resolves to an empty URI. The case of attributes is a bit different, because if they are unqualified then they belong to a partition of their parent element's namespace.
I've been building on your code to address namespace in what I believe to to be a clear manner. When serialized to a VFP object, every structural component of the XML document holds a value, in the
xmlvalue property, a namespace, in the
xmlns property, if present, a list of attributes under
xmlattributes property, and a sub-tree of other components. This is actually much like a DOM interpreter sees an XML document, so I'm not inventing nothing at all.
For this document (stressed a little bit from a previous version, to present the problem of different attributes with the same name)
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:a="http://myserver.com" xmlns:b="http://yourserver.com">
<branch>branch</branch>
<root xmlns="http://myserver.com">
<a:branch>a-branch</a:branch>
<branch xmlns="http://yourserver.com">
<deep xmlns:a="http://yourserver.com" xmlns:b="http://myserver.com">
<a:x b:attrib="my" a:attrib="you" attrib="default" />
</deep>
b-branch
</branch>
<branch/>
</root>
</root>
the resulting serialization is as the attached image represents.
----------------------------------
António Tavares Lopes