Re: Attributes and Default Namespaces

Original Message From: "Neil Beddoe"

> I've also discovered from this article 
> http://msdn.microsoft.com/en-us/magazine/cc302166.aspx
> that attributes must be fully qualified and aren't mapped by an xmlns="... 
> declaration like
> elements are.

I haven't read the article, but I assume it means that _IF_ you want 
attributes to be qualified, then you must associate a (non-empty) namespace 
prefix with the namespace in question, as the namespace assignment of 
attributes isn't affected by the default namespace (set by xmlns="..."). 
i.e. xmlns="..." doesn't dictate the namespace associated with 
myAttribute="...", whereas xmlns:myPrefix="..." + myPrefix:myAttribute="..." 
would.

HTH,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info
----- Original Message ----- 
From: "Neil Beddoe" <Neil.Beddoe@raidllp.com>
To: "'Mukul Gandhi'" <gandhi.mukul@gmail.com>
Cc: <xmlschema-dev@w3.org>
Sent: Friday, November 12, 2010 9:31 AM
Subject: RE: Attributes and Default Namespaces


> Thanks.  This is useful and I've changed my root element so that it 
> actually does something.
>
> I've also discovered from this article 
> http://msdn.microsoft.com/en-us/magazine/cc302166.aspx  that attributes 
> must be fully qualified and aren't mapped by an xmlns="... declaration 
> like elements are.
>
> Neil
>
>
> -----Original Message-----
> From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
> Sent: 12 November 2010 07:01
> To: Neil Beddoe
> Cc: xmlschema-dev@w3.org
> Subject: Re: Attributes and Default Namespaces
>
> If you see the following element declaration (which is element declaration 
> for the root element of your XML document) in your Schema document,
>
> <xs:element name="Results">
>     <xs:annotation>
>         <xs:documentation>Comment describing your root 
> element</xs:documentation>
>     </xs:annotation>
> </xs:element>
>
> There is nothing defined within this element declaration (except an 
> annotation). I think this implies that schema type of such an element 
> declaration (even if this element is in non null namespace which is 
> http://raid.raidllp.com in your case) is xs:anyType (which allows any XML 
> markup as content), which means your XML document should be reported valid 
> with your schema with a compliant XML Schema validator.
> But I think, you wouldn't want to write such a schema document (i.e having 
> no schema components defined within the root element declaration, which 
> doesn't make such an element declaration any-way useful).
>
> In your example, I think an xs:import is necessary (in Schema 1.0
> mode) to import attribute declarations from no/null namespace, since the 
> parent schema defines (or must define) components in non null namespace 
> (i.e http://raid.raidllp.com), in your example.
>
> On Thu, Nov 11, 2010 at 8:42 PM, Neil Beddoe <Neil.Beddoe@raidllp.com> 
> wrote:
>> Actually, I Figured it out. I was rustier than I thought. I was creating 
>> attributes outside the element when what I should have been doing is 
>> creating types and using those for the attributes instead.
>
>
>
>
> --
> Regards,
> Mukul Gandhi
>
> .
>
> This message is intended only for the use of the person(s) to whom it is 
> addressed. It may contain information which is privileged and 
> confidential. Accordingly any unauthorised use is strictly prohibited. If 
> you are not the intended recipient, please contact the sender as soon as 
> possible.
>
> It is not intended as an offer or solicitation for the purchase or sale of 
> any financial instrument or as an official confirmation of any 
> transaction, unless specifically agreed otherwise. All market prices, data 
> and other information are not warranted as to completeness or accuracy and 
> are subject to change without notice. Any opinions or advice contained in 
> this Internet email are subject to the terms and conditions expressed in 
> any applicable governing Marble Bar Asset Management LLP's  terms and 
> conditions of business or client agreement letter. Any comments or 
> statements made herein do not necessarily reflect those of Marble Bar 
> Asset Management LLP.
>
> Marble Bar Asset Management LLP is regulated and authorised by the FSA.
> 

Received on Friday, 12 November 2010 11:26:40 UTC