• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Schema

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me if there is any difference between these two xsd files. Thx.
**********************************
<?xml versoin="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3c.org/2001/XMLSchema" >
<xsd:element name="evaluationMark" type="xsd:integer"
minInclusive="10" maxInclusive="100" />
</xsd:schema >
**********************************
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="evaluationMark" >
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="10"/>
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
**********************************
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think these two files are both correct and have the same function.
But yes, there is difference between them, since they are not exact the same.
 
Tony Yan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I tested with both schema and got the following, using <?xml version="1.0"?> <evaluationMark>50</evaluationMark>.
Neither of them works.
(1) The first one simply says " Attribute 'maxInclusive' cannot appear in element 'element'". I think maxInclusive only can appear in restriction simple types.
(2) The second one says no definition of the <evaluationMark> exist. When I add an element definintion in it with the type="evaluationMark", it works. I think the original schema simply defines one type w/o using it.
Correct me if wrong.
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, well. I didn't run them. I look them as portion of program. I am mainly addressing the different ways to use element tag. To make them working programs, you probablly have to add more.
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Second one is right. First one wont work because element tag cannot have maxInclusive or minInclusive as it is one of the facets of the data type.
Micheal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic