Qualified attributes
Jirka Kosek
jirka at kosek.cz
Mon Jun 8 00:26:40 CEST 2009
Shawn Villaron wrote:
> Can someone explain to me why this is worthy of changing?
Using unqualified attributes is common and it is sort of best practice.
From top of my head I can't think of any XML vocabulary which I would
consider well designed and which will be using qualified attributes.
(And I'm talking about "normal" vocabularies now, not about generic
vocabularies like XLink which are intended to be used in combination
with other vocabularies and thus they are using qualified attributes to
prevent name clasehes.)
But apart from this common practice, there are plenty of another
reasons. For example XML namespaces are designed in a way that usage of
qualified attributes is discouraged. For example default namespace
propagates only to elements, not to attributes. So for example you can
use default namespace to simplify syntax of primitive WordML file:
<?xml version="1.0" encoding="UTF-8"?>
<document
xmlns="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<body>
<p>
<r>
<t>Hello World</w:t>
</r>
</p>
</body>
</document>
But once you want to use attributes, you have to declare prefixes,
because the following two documents are not the same:
<?xml version="1.0" encoding="UTF-8"?>
<w:document
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
<w:r>
<w:rPr>
<w:sz w:val="24"/>
</w:rPr>
<w:t>Hello World</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
and
<?xml version="1.0" encoding="UTF-8"?>
<document
xmlns="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<body>
<p>
<r>
<rPr>
<sz val="24"/>
</rPr>
<t>Hello World</t>
</r>
</p>
</body>
</document>
(the latter example doesn't have val attribute in WML namespace and it
is currently invalid).
> I get that it's inconsistent, but I'm having trouble understanding what's bad about this ( said another way, how does this impact interoperability )?
Having qualified/unqualified attributes has zero impact to interop. But
since namespace change for Strict will effectively change name of all
elements and qualified attributes, backward compatibility is lost
anyway, and we can make this additional change to make OOXML Strict
nicer and more "XMLish".
--
------------------------------------------------------------------
Jirka Kosek e-mail: jirka at kosek.cz http://xmlguru.cz
------------------------------------------------------------------
Professional XML consulting and training services
DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.vse.cz/pipermail/sc34wg4/attachments/20090608/5810f1ea/attachment.pgp>
More information about the sc34wg4
mailing list