Connecting Tech Pros Worldwide Forums | Help | Site Map

Attributes in XSD

markmcgookin's Avatar
Moderator
 
Join Date: Dec 2006
Location: Northern Ireland / England
Posts: 546
#1: Mar 14 '08
Hi Folks,

I am having a problem here, I use a piece of software to create xml based interfaces for an application, and I can bind these interfaces datasource to a dataset that I am currently creating using an xsd schema.

Not being an xml expert I can not for the life of me figure out a way to create an xsd schema file that has elements of a type (i.e. xs:string) but that also have attributes...

Ideally I want

Expand|Select|Wrap|Line Numbers
  1. <xs:element name="A1203513053788" type="xs:string">
  2.                     <xs:complexType>
  3.                         <xs:attribute name="Section" type="xs:string" />
  4.                         <xs:attribute name="Title" type="xs:string" />
  5.                         <xs:attribute name="IType" type="xs:string" />
  6.                         <xs:attribute name="Ident" type="xs:string" />
  7.                     </xs:complexType>
  8.                 </xs:element>
Type stuff.. however I know you can not have a type declaration where there is a child node complexType that will declare the type. How can I make this a String or an Int element, but also include attributes in it?

I can not create nodes using ref="myNodeType" stuff, as the software we are using can't seem to create this join and link up the datatables...

Any help would be brilliant here...

Cheers,

Mark (Moderator/Expert - Mobile Development Forum)

markmcgookin's Avatar
Moderator
 
Join Date: Dec 2006
Location: Northern Ireland / England
Posts: 546
#2: Mar 14 '08

re: Attributes in XSD


Quote:

Originally Posted by markmcgookin

Hi Folks,

I am having a problem here, I use a piece of software to create xml based interfaces for an application, and I can bind these interfaces datasource to a dataset that I am currently creating using an xsd schema.

Not being an xml expert I can not for the life of me figure out a way to create an xsd schema file that has elements of a type (i.e. xs:string) but that also have attributes...

Ideally I want

Expand|Select|Wrap|Line Numbers
  1. <xs:element name="A1203513053788" type="xs:string">
  2.                     <xs:complexType>
  3.                         <xs:attribute name="Section" type="xs:string" />
  4.                         <xs:attribute name="Title" type="xs:string" />
  5.                         <xs:attribute name="IType" type="xs:string" />
  6.                         <xs:attribute name="Ident" type="xs:string" />
  7.                     </xs:complexType>
  8.                 </xs:element>
Type stuff.. however I know you can not have a type declaration where there is a child node complexType that will declare the type. How can I make this a String or an Int element, but also include attributes in it?

I can not create nodes using ref="myNodeType" stuff, as the software we are using can't seem to create this join and link up the datatables...

Any help would be brilliant here...

Cheers,

Mark (Moderator/Expert - Mobile Development Forum)

Also this:

Expand|Select|Wrap|Line Numbers
  1. <xs:attribute name="type" type="xs:string" fixed="xs:int" />
didnt work, I got an error binding an item on the interface to it.. I dont think it can see it's an int
Reply