Re: New attributes in element

> 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 UTC