Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Schema design Help

 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to create a schema such that an element should represent either of the one option tag.
for example the XML document can be either
<Book>
<authorname>John</authorname>
<Book>
(or)
<Book>
<authorId>3423<authorId>
<Book>
but it should not be like this
<Book>
<authorname>John</authorname>
<authorId>4323<authorId>
<Book>
Please tell me whether it is possible to specify this is Schema file (.XSD).due i need to use <xs:choice> tag ??
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the answer..
Below is the answer.
<xs:element name="Book">
<xs:annotation>
<xs ocumentation>Root Element</xs ocumentation>
</xs:annotation>
<xs:complexType>
<xs:choice>
<xs:element name="AuthorName"/>
<xs:element name="AuthorID"/>
</xs:choice>
</xs:complexType>
</xs:element>
Please delete if this message,if unnecessary.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic