470,849 Members | 1,036 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Additional properties of attributes in XSD

How does one define additional attributes for elements in an XSD?

So, I'd like something like this:

....
<xs:element name="ClaimNumber" type="xs:string"
mycustomproperty="xs:string"/>
....

Ideally, I'd like Visual Studio (2005) to allow the entry of these
"additional properties" while designing it.

Any ideas?

Kind regards,

Abdullah
Mar 1 '06 #1
6 1526


Abdullah Kauchali wrote:
How does one define additional attributes for elements in an XSD?


If you want to allow attributes then the element has complex type e.g.
<xs:element name="ClaimNumber">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="mycustomproperty" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
You could now have e.g.
<ClaimNumber mycustomproperty="Kibo">Xibo</ClaimNumber>
in your XML instance document.
I hope this is what you are looking for, not sure whether you want the
above or whether you want to define additional attributes on schema
elements itself.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 1 '06 #2
Martin Honnen wrote:
You could now have e.g.
<ClaimNumber mycustomproperty="Kibo">Xibo</ClaimNumber>
in your XML instance document.

Hi Martin!

Thanks for responding. The above is not what I am looking for ...

I hope this is what you are looking for, not sure whether you want the
above or whether you want to define additional attributes on schema
elements itself.


.... it's the latter: looking for ways to define additional attributes
on the schema elements itself. :)

So, if a new schema is being created, I'd like the user to have the
opportunity to enter values in the schema for "mycustomproperty". (Not
in the XML file, but in the schema.)

Is this possible with Visual Studio?
Mar 1 '06 #3
Hi Abdullah,

You can do it in VS. Here's an example:

<?xml version="1.0" encoding="utf-8" ?>

<xs:schema targetNamespace="myNS"

elementFormDefault="qualified"

xmlns="myNS"

xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns:vs
="http://schemas.microsoft.com/Visual-Studio-Intellisense">

<xs:element name="foo" vs:help="help"/>

</xs:schema>
--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Abdullah Kauchali" <no**@none.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
How does one define additional attributes for elements in an XSD?

So, I'd like something like this:

...
<xs:element name="ClaimNumber" type="xs:string"
mycustomproperty="xs:string"/>
...

Ideally, I'd like Visual Studio (2005) to allow the entry of these
"additional properties" while designing it.

Any ideas?

Kind regards,

Abdullah

Mar 2 '06 #4
Stan Kitsis [MSFT] wrote:
Hi Abdullah,

You can do it in VS. Here's an example:

Thanks Stan! Exactly what I needed.

So, I can create my own namespace definition file with all the relevant
attributes, but one last (minor) question:

Is there any way for Visual Studio to allow entering of these
"properties" in "Designer view"? The intellisense works when viewing
the code, but no additional properties are visible besides the usual.

Any ideas?

Mar 3 '06 #5
I don't think the design view surfaces visual support for this.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Abdullah Kauchali" <no**@none.com> wrote in message
news:eV**************@TK2MSFTNGP15.phx.gbl...
Stan Kitsis [MSFT] wrote:
Hi Abdullah,

You can do it in VS. Here's an example:

Thanks Stan! Exactly what I needed.

So, I can create my own namespace definition file with all the relevant
attributes, but one last (minor) question:

Is there any way for Visual Studio to allow entering of these
"properties" in "Designer view"? The intellisense works when viewing
the code, but no additional properties are visible besides the usual.

Any ideas?

Mar 6 '06 #6
Stan Kitsis [MSFT] wrote:
I don't think the design view surfaces visual support for this.

Many thanks Stan!
Mar 7 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Martin Montgomery | last post: by
13 posts views Thread by Patrick * | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.