{"id":1702,"date":"2011-05-24T09:33:03","date_gmt":"2011-05-24T14:33:03","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=1702"},"modified":"2011-05-24T09:33:03","modified_gmt":"2011-05-24T14:33:03","slug":"xml-schema-best-practices","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=1702","title":{"rendered":"XML Schema: Best Practices"},"content":{"rendered":"<span id=\"Best_Practices\"><h2>Best Practices<\/h2><\/span>\n<p>* Use Venetian Blind Design over Russian Doll and Slami Slice Designs when possible<br \/>\n* Make targetNamespace the default namespace<br \/>\n* Make two identical copies of all your schemas:<br \/>\n&#8211; One with elementFormDefault=&#8221;qualified&#8221;<br \/>\n&#8211; One with elementFormDefault=&#8221;unqualified&#8221;<br \/>\n* Uniquely identify all schema components with the id attribute<\/p>\n<pre lang=\"xml\">\r\n<xsd:element name=\"elevation\" type=\"xsd:integer\" id=\"flight:aircraft:elevation\"\/>\r\n<xsd:complexType name=\"publication\" id=\"wrox:book:publication\"\/>\r\n<\/pre>\n<p>* Postpone binding decisions<br \/>\n* Create extensible schemas<br \/>\n&#8211; Use abstract type with type substitution<br \/>\n&#8211; Use &lt;any&gt;<\/p>\n<pre lang=\"xml\">\r\n<xsd:element name=\"other\" minOccurs=\"0\">\r\n  <xsd:any namespace=\"##any\" maxOccurs=\"2\"\/>\r\n<\/xsd:element>\r\n<\/pre>\n<p>* When in doubt, use type, i.e. declare an item as a type instead of an element.<br \/>\n&#8211; A type can be reused in other elements.<br \/>\n* Favor composition over inheritance<\/p>\n<span id=\"References\"><h2>References<\/h2><\/span>\n<p>* <a href=\"http:\/\/www.xfront.com\/BestPracticesHomepage.html\">http:\/\/www.xfront.com\/BestPracticesHomepage.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Best Practices * Use Venetian Blind Design over Russian Doll and Slami Slice Designs when possible * Make targetNamespace the default namespace * Make two identical copies of all your schemas: &#8211; One with elementFormDefault=&#8221;qualified&#8221; &#8211; One with elementFormDefault=&#8221;unqualified&#8221; * &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=1702\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[32],"tags":[],"class_list":["post-1702","post","type-post","status-publish","format-standard","hentry","category-xml"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-rs","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1702"}],"version-history":[{"count":2,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1702\/revisions"}],"predecessor-version":[{"id":2424,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1702\/revisions\/2424"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}