W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Re: New attributes in element

From: Eddie Robertsson <eddie@allette.com.au>
Date: Tue, 11 Dec 2001 14:23:20 +1100
Message-ID: <3C157C28.59DB492B@allette.com.au>
To: "Qiao, Wenjie" <wq@hnc.com>
CC: xmlschema-dev@w3.org
> I am new here.
>
> Could I add a new attribute to xsd:element without violating the schema?
> For example, instead of,
>         <xsd:element name = "name" type = "xsd:string"/>
> I want
>         <xsd:element name = "name" type = "xsd:string" display =
> "Name"/>
>                                                      ^^^^^^^
> Notice "display" is not a standard attribute of xsd:element.

Yes, you can do this provided that the attributes you want to add have a
namespace different from http://www.w3.org/2001/XMLSchema.

This means you can't just do:

<xsd:element name = "name" type = "xsd:string" display ="Name"/>

Instead you have to say:

<xsd:element name = "name" type = "xsd:string" my:display ="Name"/>

and then add a namespace declaration defining the my: prefix on for example
the xsd:schema element.
Example:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:my="www.my.com">
 <xsd:element name = "name" type = "xsd:string" my:display ="Name"/>
</xsd:schema>

Cheers,
/Eddie


>
>
> Thanks,
>
> -Wenjie
Received on Monday, 10 December 2001 22:36:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:25 GMT