{"id":1707,"date":"2010-07-20T11:23:25","date_gmt":"2010-07-20T16:23:25","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=1707"},"modified":"2010-07-20T11:23:25","modified_gmt":"2010-07-20T16:23:25","slug":"xml-schema-use-elementformdefault-to-hideexpose-namespaces","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=1707","title":{"rendered":"XML Schema: Use elementFormDefault to Hide\/Expose Namespaces"},"content":{"rendered":"<span id=\"Use_elementFormDefault_to_HideExpose_Namespaces\"><h2>Use elementFormDefault to Hide\/Expose Namespaces<\/h2><\/span>\n<p>* &#8216;elementFormDefault&#8217; is a binary switch attribute in the schema to control if the origin (i.e. namespace) of each element should be<br \/>\n&#8211; hidden (elementFormDefault=&#8221;unqualified&#8221;)<br \/>\n&#8211; or exposed (&#8220;elementFormDefault=&#8221;qualified&#8221;).<br \/>\n* elementFormDefault defaults to &#8220;unqualified&#8221;<br \/>\n* All schemas must have a consistent value for &#8216;elementFormDefault&#8217; in order to hide\/expose <strong>all<\/strong> elements.<\/p>\n<span id=\"Hide_Namespaces\"><h3>Hide Namespaces<\/h3><\/span>\n<p>* Advantages:<br \/>\n&#8211; Simplicity<br \/>\n&#8211; Flexibility to change the schema without impact of instance documents.<br \/>\n* Howto:<br \/>\n&#8211; Set elementFormDefault=&#8221;unqualified&#8221; in all schemas.<br \/>\n&#8211; The element must not be globally declared.<\/p>\n<span id=\"Best_Practices\"><h3>Best Practices<\/h3><\/span>\n<p>* Make two identical copies of a schema:<br \/>\n&#8211; One with elementFormDefault=&#8221;qualified&#8221;<br \/>\n&#8211; One with elementFormDefault=&#8221;unqualified&#8221;<br \/>\n* Minimize the use of global elements and attributes.<\/p>\n<span id=\"Notes\"><h2>Notes<\/h2><\/span>\n<p>* Global elements and attribute must always be qualified.<br \/>\n* Use &lt;include&gt; to include schema with same namespace.<br \/>\n* Use &lt;import&gt; to include schema with different namespace.<\/p>\n<span id=\"References\"><h1>References<\/h1><\/span>\n<p>* <a href=\"http:\/\/www.xfront.com\/HideVersusExpose.html\">Hide (Localize) Namespaces Versus Expose Namespaces<\/a> or <a href=\"http:\/\/www.xfront.com\/HideVersusExpose.pdf\">PDF version<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use elementFormDefault to Hide\/Expose Namespaces * &#8216;elementFormDefault&#8217; is a binary switch attribute in the schema to control if the origin (i.e. namespace) of each element should be &#8211; hidden (elementFormDefault=&#8221;unqualified&#8221;) &#8211; or exposed (&#8220;elementFormDefault=&#8221;qualified&#8221;). * elementFormDefault defaults to &#8220;unqualified&#8221; * &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=1707\">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-1707","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-rx","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1707","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=1707"}],"version-history":[{"count":1,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1707\/revisions"}],"predecessor-version":[{"id":1708,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1707\/revisions\/1708"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}