Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

correct answer

 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These examples are from witscale.
There seems to be a little bug - in that on the output it says I got it wrong but doesn't give answer or explanation. I thought the first one was correct.
XML Schema documents needs to define new data type to hold 10 digit telephone
number. It is required that the telephone number should be able to hold '-' as the
separators.
<xsd:simpleType name="TelephoneNumber">
<xsd:restriction base="xsd:string">
<xsd:length value="10>
<xsd attern value="\d{3}-\d{3}-\d{4}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="TelephoneNumber">
<xsd:restriction base="xsd:string">
<xsd:length value="12>
<xsd attern value="\d{3}-\d{3}-\d{4}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="TelephoneNumber">
<xsd:restriction base="xsd:integer">
<xsd:length value="12>
<xsd attern value="\d{3}-\d{3}-\d{4}"/>
</xsd:restriction>
</xsd:simpleType>
 
Kenneth Tsuei
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
10 digit telephone PLUS 2 "-" characters
gets a length of 12.
So the second is the correct one.
Cheers
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say '2nd' is correct answer.
10 (data type to hold 10 digit telephone
number) + 2( to hold '-' as the separators) = 12

Please feel free to correct me.
Thanks
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The third one is wrong because xsd:integer does not has a facet length.
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Plus the integer probably wouldn't like the dashes.
Looks like #2 to me.
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeh, Thanks guys
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic