- From: <Misha.Wolf@thomsonreuters.com>
- Date: Fri, 01 Jul 2011 16:15:38 +0100
- To: xml-editor@w3.org
- Cc: iptc-news-architecture-dev@yahoogroups.com
- Message-id: <A29ADE959C70A1449470AA9A212F5D8013AF4AA9@LONSMSXM06.emea.ime.reuters.com>
Dear XML Core WG, Please would you be kind enough to advise on this conundrum. Many thanks, Misha From: iptc-news-architecture-dev@yahoogroups.com [mailto:iptc-news-architecture-dev@yahoogroups.com] On Behalf Of Michael Steidl (IPTC) Sent: 27 June 2011 12:10 To: iptc-news-architecture-dev@yahoogroups.com Subject: [IPTC-NAR-dev] XML: attributes and namespaces - no clear solution This posting refers to the discussion on the NAR-dev conference call last Friday, 24 June. The issue was: do attributes inherit the namespace of its element and this way also default namespaces? After some searching my findings are: ** [1] is the standard document of the W3C and it speaks about Applying Namespaces to Elements and Attributes (chapter 6) : - 6.1 Namespace scoping: “ The scope of a namespace declaration declaring a prefix extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner declarations with the same NSAttName part. In the case of an empty tag, the scope is the tag itself. Such a namespace declaration applies to all element and attribute names within its scope whose prefix matches that specified in the declaration.” With this example: <?xml version="1.0"?> <html:html xmlns:html='http://www.w3.org/1999/xhtml'> <html:head><html:title>Frobnostication</html:title></html:head> <html:body><html:p>Moved to <html:a href='http://frob.example.com'>here.</html:a></html:p></html:body> </html:html> - 6.2 Namespace defaulting “The scope of a default namespace declaration extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner default namespace declarations. In the case of an empty tag, the scope is the tag itself. A default namespace declaration applies to all unprefixed element names within its scope. Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear.” This leaves open what “determined by the element” exactly means – what we discussed last Friday: does the attribute inherit the element’s namespace – or not. The next paragraph tells: “ .... The namespace name for an unprefixed attribute name always has no value. ...” ... hm, this does not explain what “determined by the element” exactly means (Btw: the Errata document for this document says no errata exist ...). And there is no note available for the example above explaining if the @href pertains to the html: namespace or not. ** So I started to google for views on that issue: * The German page (but not the one in English) about XML namespaces talks explicitly about attributes [2] – in short: as attributes are not a child node of an element they never inherit its namespace, if one wants to apply a namespace the corresponding prefix has to be applied. * A website with “Articles and tutorials about XML-technology” [3] says about this issue: “An attribute is not considered a child of its parent element. An attribute never inherits the namespace of its parent element.” * A VB tutorial about XML namespaces asserts the same [4] * The only contradiction I found is on Stackoverflow [5] “There's a reason that most XML vocabularies use non-namespaced attributes: When your elements have a namespace and those elements have attributes, then there can be no confusion: the attributes belong to your element, which belongs to your namespace. Adding a namespace prefix to the attributes would just make everything more verbose. So why do namespaced attributes exist? Because some vocabularies do useful work with mostly attributes, and can do this when mixed in with other vocabularies.” Conclusion: - W3C does not define how default namespaces apply to attributes in a straightforward way - It is not fully clear if an attribute of a namespaced element interits its namespace. - Published views on that matter lean towards “does not inherit” – but not unambiguously What’s next: asking one of the editors of this document – Tim Bray or Henry Thompson? Michael [1] http://www.w3.org/TR/xml-names/ [2] http://de.wikipedia.org/wiki/Namensraum_%28XML%29#Attribute [3] http://www.xmlplease.com/attributexmlns [4] http://www.developerfusion.com/article/3720/understanding-xml-namespaces/6/ [5] http://stackoverflow.com/questions/41561/xml-namespaces-and-attributes Michael Steidl Managing Director of the IPTC [mdirector@iptc.org] International Press Telecommunications Council Web: www.iptc.org <http://www.iptc.org/> - on Twitter @IPTC <http://www.twitter.com/IPTC> Business office address: 20 Garrick Street, London WC2E 9BT, United Kingdom Registered in England, company no 101096 __._,_.___ <http://geo.yahoo.com/serv?s=97476590/grpId=14330092/grpspId=1706030389/msgId=7160/stime=1309172992> Your email settings: Individual Email|Traditional Change settings via the Web <http://groups.yahoo.com/group/iptc-news-architecture-dev/join;_ylc=X3oDMTJnYzU2Nms3BF9TAzk3NDc2NTkwBGdycElkAzE0MzMwMDkyBGdycHNwSWQDMTcwNjAzMDM4OQRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMzA5MTcyOTky> (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest <mailto:iptc-news-architecture-dev-digest@yahoogroups.com?subject=Email%20Delivery:%20Digest> | Switch to Fully Featured <mailto:iptc-news-architecture-dev-fullfeatured@yahoogroups.com?subject=Change%20Delivery%20Format:%20Fully%20Featured> Visit Your Group <http://groups.yahoo.com/group/iptc-news-architecture-dev;_ylc=X3oDMTJlaTZwM3RpBF9TAzk3NDc2NTkwBGdycElkAzE0MzMwMDkyBGdycHNwSWQDMTcwNjAzMDM4OQRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTMwOTE3Mjk5Mg--> | Yahoo! Groups Terms of Use <http://docs.yahoo.com/info/terms/> | Unsubscribe <mailto:iptc-news-architecture-dev-unsubscribe@yahoogroups.com?subject=Unsubscribe> __,_._,___ This email was sent to you by Thomson Reuters, the global news and information company. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
Received on Friday, 1 July 2011 15:16:08 UTC