This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create XMl Schema for following

 
Milind Deodhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<Item>
<Weight unit = "kg">10</Weight>
</Item>

I am having problem defining the attribute element for this
<xsd:complexType name = "Item">
<xsd:element name = Weight type= "xsd:string"/>
<xsd:attribute name = unit type= "xsd:string"/>
</xsd:complexType>
Is this correct, I tried lot of things, but still it gives an error.
Please advise
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Milind Deodhar:
Is this correct, I tried lot of things, but still it gives an error.
Please advise

Hi,
Here is the Schema conforming to your xml,this is not the only way,it can also be done in different way.

Regards
Balaji
 
Milind Deodhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Balaji,
Your code worked.
I have one doubt,
Where do you define that Element weight
should be text or integer or anyother datatype
Milind
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic