OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespace: what's the correct usage?




> Without the xmlns='' a validator wouldn't know where to look for the
> declaration of name (which according to XML Namespaces would be http://foo
> and according to XML Schemas would be urn:x2). If the unr:x2 schema defined

This statement is wrong, and I saw other people made the same
misunderstanding. That's why I hate the entire ridiculous concept of
the "unqualifed local element".


The rule is "XML Schema doesn't change the interpretation of namespaces".


There is no exception to this rule. No matter what option do you use,
this rule applies.


Let me introduce two examples and prevent this confusion from happening
again.





<?xml version="1.0"?>
<foo xmlns="ns1">
  <p:bar xmlns:p="ns2">
    <child/>
  </p:bar>
</foo>

is interpreted as:

<{ns1}foo>
  <{ns2}bar>
    <{ns1}child />       <-- not ns2!
  </{ns2}bar>
</{ns1}foo>

It doesn't matter whether you use XML Schema or not.



And

<?xml version="1.0"?>
<foo>
  <p:bar xmlns:p="ns1">
    <child/>
  </p:bar>
</foo>

is interpreted as:

<{}foo>
  <{ns1}bar>
    <{}child/>
  </{ns1}bar>
</{}foo>

even if you use XML Schema.



P.S. If you are not familiar with {uri}local notation, you may want to
read http://www.jclark.com/xml/xmlns.htm

regards,
----------------------
K.Kawaguchi
E-Mail: kohsukekawaguchi@yahoo.com