{"id":2590,"date":"2016-01-14T18:40:11","date_gmt":"2016-01-14T16:40:11","guid":{"rendered":"https:\/\/adrhc.go.ro\/wordpress\/?p=2590"},"modified":"2017-05-10T22:23:53","modified_gmt":"2017-05-10T20:23:53","slug":"xsd-schema","status":"publish","type":"post","link":"https:\/\/adrhc.go.ro\/blog\/xsd-schema\/","title":{"rendered":"XSD schema"},"content":{"rendered":"<pre class=\"brush:xml\" toolbar=\"false\">\r\n&lt;!-- example -->\r\n&lt;xs:simpleType>\r\n  &lt;xs:restriction base=\"xs:string\">\r\n    &lt;xs:enumeration value=\"Audi\"\/>\r\n    &lt;xs:enumeration value=\"Golf\"\/>\r\n    &lt;xs:enumeration value=\"BMW\"\/>\r\n  &lt;\/xs:restriction>\r\n&lt;\/xs:simpleType>\r\n\r\n&lt;!-- example -->\r\n&lt;xs:complexType name=\"personinfo\">\r\n  &lt;xs:sequence>\r\n    &lt;xs:element name=\"firstname\" type=\"xs:string\"\/>\r\n    &lt;xs:element name=\"lastname\" type=\"xs:string\"\/>\r\n  &lt;\/xs:sequence>\r\n&lt;\/xs:complexType>\r\n\r\n&lt;xs:complexType name=\"fullpersoninfo\">\r\n  &lt;xs:complexContent>\r\n    &lt;xs:extension base=\"personinfo\">\r\n      &lt;xs:sequence>\r\n        &lt;xs:element name=\"address\" type=\"xs:string\"\/>\r\n        &lt;xs:element name=\"city\" type=\"xs:string\"\/>\r\n        &lt;xs:element name=\"country\" type=\"xs:string\"\/>\r\n      &lt;\/xs:sequence>\r\n    &lt;\/xs:extension>\r\n  &lt;\/xs:complexContent>\r\n&lt;\/xs:complexType>\r\n\r\n&lt;!-- example -->\r\n&lt;element name=\"callMyApp\" type=\"dc:processingHook\" \/>\r\n&lt;callMyApp\/>\r\n<\/pre>\n<pre>\r\n<a href=\"https:\/\/www.w3.org\/TR\/xmlschema-2\/#built-in-datatypes\" target=\"_blank\">https:\/\/www.w3.org\/TR\/xmlschema-2\/#built-in-datatypes<\/a>\r\n<a href=\"http:\/\/www.xml.com\/pub\/a\/2001\/08\/22\/easyschema.html\" target=\"_blank\">http:\/\/www.xml.com\/pub\/a\/2001\/08\/22\/easyschema.html<\/a> -> best article\r\nThat leaves us with &lt;complexType> with &lt;complexContent>, which ensures that there will not be any data content in the element.\r\n<\/pre>\n<pre class=\"brush:xml\" toolbar=\"false\">\r\n&lt;complexType name=\"processingHook\">\r\n  &lt;complexContent>\r\n    &lt;restriction base=\"xs:anyType\"> -> the default syntax for complex types is complex content that restricts anyType\r\n    &lt;\/restriction>\r\n  &lt;\/complexContent>\r\n&lt;\/complexType>\r\n\r\n&lt;complexType name=\"processingHook\">&lt;\/complexType>\r\n\r\n&lt;!-- example -->\r\n&lt;product prodid=\"1345\" \/>\r\n\r\n&lt;xs:element name=\"product\">\r\n  &lt;xs:complexType>\r\n    &lt;xs:complexContent>\r\n      &lt;xs:restriction base=\"xs:anyType\">\r\n        &lt;xs:attribute name=\"prodid\" type=\"xs:positiveInteger\"\/>\r\n      &lt;\/xs:restriction>\r\n    &lt;\/xs:complexContent>\r\n  &lt;\/xs:complexType>\r\n&lt;\/xs:element>\r\n\r\n&lt;xs:complexType name=\"prodtype\">\r\n  &lt;xs:attribute name=\"prodid\" type=\"xs:positiveInteger\"\/>\r\n&lt;\/xs:complexType>\r\n\r\n&lt;!-- example -->\r\n<\/pre>\n<pre>\r\n<a href=\"http:\/\/stackoverflow.com\/questions\/5457217\/xsd-for-simplecontent-with-attribute-and-text\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/5457217\/xsd-for-simplecontent-with-attribute-and-text<\/a>\r\nApparently, you can't restrict simpleContent within a complexType, only extend it.\r\n<\/pre>\n<pre class=\"brush:xml\" toolbar=\"false\">\r\n&lt;shoesize country=\"france\">35&lt;\/shoesize>\r\n&lt;xs:complexType name=\"shoetype\">\r\n  &lt;xs:simpleContent>\r\n    &lt;xs:extension base=\"xs:integer\">\r\n      &lt;xs:attribute name=\"country\" type=\"xs:string\" \/>\r\n    &lt;\/xs:extension>\r\n  &lt;\/xs:simpleContent>\r\n&lt;\/xs:complexType>\r\n\r\n&lt;!-- example -->\r\n&lt;marks>95&lt;\/marks>\r\n&lt;xs:element name=\"marks\">\r\n  &lt;xs:simpleType>\r\n    &lt;xs:restriction base=\"xs:integer\">\r\n      &lt;xs:minInclusive value=\"0\"\/>\r\n      &lt;xs:maxInclusive value=\"100\"\/>\r\n    &lt;\/xs:restriction>\r\n  &lt;\/xs:simpleType>\r\n&lt;\/xs:element>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!&#8211; example &#8211;> &lt;xs:simpleType> &lt;xs:restriction base=&#8221;xs:string&#8221;> &lt;xs:enumeration value=&#8221;Audi&#8221;\/> &lt;xs:enumeration value=&#8221;Golf&#8221;\/> &lt;xs:enumeration value=&#8221;BMW&#8221;\/> &lt;\/xs:restriction> &lt;\/xs:simpleType> &lt;!&#8211; example &#8211;> &lt;xs:complexType name=&#8221;personinfo&#8221;> &lt;xs:sequence> &lt;xs:element name=&#8221;firstname&#8221; type=&#8221;xs:string&#8221;\/> &lt;xs:element name=&#8221;lastname&#8221; type=&#8221;xs:string&#8221;\/> &lt;\/xs:sequence> &lt;\/xs:complexType> &lt;xs:complexType name=&#8221;fullpersoninfo&#8221;> &lt;xs:complexContent> &lt;xs:extension base=&#8221;personinfo&#8221;> &lt;xs:sequence> &lt;xs:element name=&#8221;address&#8221; type=&#8221;xs:string&#8221;\/> &lt;xs:element name=&#8221;city&#8221; type=&#8221;xs:string&#8221;\/> [&hellip;]<\/p>\n<div class=\"link-more\"><a href=\"https:\/\/adrhc.go.ro\/blog\/xsd-schema\/#more-2590\" class=\"more-link\">Continue reading &#10142; <span class=\"screen-reader-text\">XSD schema<\/span><\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[67],"class_list":["post-2590","post","type-post","status-publish","format-standard","hentry","category-programming","tag-xsd"],"_links":{"self":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/2590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/comments?post=2590"}],"version-history":[{"count":0,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/2590\/revisions"}],"wp:attachment":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/media?parent=2590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/categories?post=2590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/tags?post=2590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}