Wednesday, May 30, 2007

xml namespaces decision table

Being able to correctly handle XML namespaces in an XML processor seems to me to be summarized in the following formulation. I don't know if I'm right or not, but that's why I posted a question about it in the xml-dev mailing list.


Let's consider three variables: a, b and c:


a. Name is qualified in XML Schema: yes/no
b. Name is prefixed in XML document: yes/no (default namespace is also considered as a prefix, the empty string prefix, for this discussion’s sake)
c. Prefix for name is defined in XML document: yes/no


If we consider all possible values for a, b and c we end up with 8 possibilities:











abc
000
001
010
011
100
101
110
111

I don't expect to get any namespace related error
if a==b==c==0
or
if a==c==1 and b is either 1 or 0

(0 stands for no and 1 for yes...)

If I'm right than testing for namespace can be done with two comparisons


In case we don't have an XML Schema, the table has only two columns (no column for qualification):
So we get






bc
00
01
10
11


we get that the only error is if we use a prefix that is not declared.

No comments:

Post a Comment