[cddlm] XML Namespaces and references.

Jun Tatemura tatemura at sv.nec-labs.com
Mon Jan 30 14:01:18 CST 2006


HI

XML namespace is a source of headache, when we need to import a fragment 
of XML from
a document to document..
My interpretation is that, when we say @cdl:refroot  has a QName value,  
it should be so
in description time, not in resolution time.  That is,  the prefix must 
be interpreted where it is
written.
An implementation headache is that we must carry over the namespace 
context from the original
template.

        <cdl:cdl >
          <cdl:configuration >
            <p1:local xmlns:p1="http://cddlm.org/prefix1">
              <newvalue>prefix1</newvalue>
            </p1:local>
            <p1:local xmlns:p1="http://cddlm.org/prefix2">
              <newvalue>prefix2</newvalue>
            </p1:local>
            <node xmlns:p1="http://cddlm.org/prefix1">
              <value cdl:ref="/newvalue" cdl:refroot="p1:local" />
            </node>
            <toplevel cdl:extends="node" 
xmlns:p1="http://cddlm.org/prefix2">
            </toplevel>
          </cdl:configuration>
          <cdl:system >
            <app>
              <user cdl:ref="value" cdl:refroot="toplevel"/>
            </app>
          </cdl:system>
        </cdl:cdl>

cdl:extends at toplevel should be resolved to something equivalent to:
            <toplevel xmlns:p1="http://cddlm.org/prefix2">
              <value cdl:ref="/newvalue" cdl:refroot="p1:local" 
xmlns:p1="http://cddlm.org/prefix1"/>
            </toplevel>


Thanks,
Jun

Steve Loughran wrote:
> Steve Loughran wrote:
>>
>>
>> I've just checked in
>>
>> -more valid (non-lazy) reference tests
>> -new invalid non-lazy reference tests
>> -the first refroot tests.
>>
>> These tests are encoding my (mis?)-understanding of the ref and 
>> especially refroot bits of the spec. Please check and advise me of 
>> any errors.
>>
>> The fun ones are refroot related. I believe the following is valid 
>> (cddlm-cdl-2005-02-0010)
>>
>>         <cdl:cdl >
>>           <cdl:configuration xmlns:test1="http://cddlm.org/test1.cdl" >
>>             <test1:toplevel>
>>               <test1:value>username</test1:value>
>>             </test1:toplevel>
>>           </cdl:configuration>
>>           <cdl:system xmlns:t1="http://cddlm.org/test1.cdl">
>>             <app>
>>               <user cdl:ref="t1:value" cdl:refroot="t1:toplevel"/>
>>             </app>
>>           </cdl:system>
>>         </cdl:cdl>
>>
>> This uses qnames and resolves against something in cdl:configuration
>>
>
> I am now starting to think that XML is invalid. It all depends upon 
> where QName prefixes are evaluated.
>
> It may be legit to use xmlns prefixes that are only defined in the 
> context of the destination reference, e.g.
>       <user cdl:ref="test1:value" cdl:refroot="t1:toplevel"/>
>
> I am going to read up on Xpath and think about this some more.
>
> What is everyone else doing regarding QName prefix lookup during 
> resolution? There is no coverage of the problem in the specification 
> itself,.
>
> -steve





More information about the cddlm-wg mailing list