{"id":1197,"date":"2013-04-07T01:59:47","date_gmt":"2013-04-07T01:59:47","guid":{"rendered":"http:\/\/www.softwareeverydayblog.com\/?p=1197"},"modified":"2013-06-01T08:01:12","modified_gmt":"2013-06-01T08:01:12","slug":"1197","status":"publish","type":"post","link":"https:\/\/www.softwareeverydayblog.com\/?p=1197","title":{"rendered":"XML Namespaces 101"},"content":{"rendered":"<p>XML Namespaces also carry typical advantages of using namespaces, i.e. all variables related to a particular category can go under that namespace. <\/p>\n<p>Here is an example of namespaces being used for Spring.<br \/>\n<beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"\nxmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \nxmlns:aop=\"http:\/\/www.springframework.org\/schema\/aop\"\nxmlns:p=\"http:\/\/www.springframework.org\/schema\/p\"\nxsi:schemaLocation=\"http:\/\/www.springframework.org\/schema\/beans http:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd \nhttp:\/\/www.springframework.org\/schema\/aop http:\/\/www.springframework.org\/schema\/aop\/spring-aop-3.0.xsd\"><\/p>\n<p>Lets say in an xml file we have information about an html table and a real table.<\/p>\n<pre lang=\"xml\">\r\n<root>\r\n  <item>\r\n    <table>\r\n      <name>Ikea Coffee table<\/name>\r\n      <size>Large<\/size>\r\n      <html>\r\n        <table>\r\n          <tr>\r\n            <td>Name<\/td>\r\n            <td>Size<\/td>\r\n          <\/tr>\r\n          <tr>\r\n            <td>Ikea Coffee table<\/td>\r\n            <td>Large<\/td>\r\n          <\/tr>\r\n        <\/table>\r\n      <\/html>\r\n    <\/table>\r\n  <\/item>\r\n<\/root>\r\n<\/pre>\n<p>Ok, there is a problem here. Clearly, there should be a distinction between an html table and real table. Namespaces to the rescue.<\/p>\n<pre lang=\"xml\">\r\n<root xmlns=\"https:\/\/www.softwareeverydayblog.com\/\" xmlns:table=\"https:\/\/www.softwareeverydayblog.com\/realtable\" xmlns:htmltable=\"https:\/\/www.softwareeverydayblog.com\/htmltable\"<\/strong> >\r\n  <item>\r\n    <table:table>\r\n      <name>Ikea Coffee table<\/name>\r\n      <size>Large<\/size>\r\n      <html>\r\n        <htmltable:table>\r\n          <tr>\r\n            <td>Name<\/td>\r\n            <td>Size<\/td>\r\n          <\/tr>\r\n          <tr>\r\n            <td>Ikea Coffee table<\/td>\r\n            <td>Large<\/td>\r\n          <\/tr>\r\n        <\/htmltable:table>\r\n      <\/html>\r\n    <\/table:table>\r\n  <\/item>\r\n<\/root>\r\n<\/pre>\n<p>This works. An html table (xmlns:htmltable) and a real table (xmlns:table) have their own namespaces. xmlns is the default namespace. By default all the elements without a namespace go into this namespace (e.g. <root>, <item> etc).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>XML Namespaces also carry typical advantages of using namespaces, i.e. all variables related to a particular category can go under that namespace. Here is an example of namespaces being used for Spring. Lets say in an xml file we have information about an html table and a real table. Ikea Coffee table Large Name Size [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1197","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1197"}],"version-history":[{"count":16,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1197\/revisions"}],"predecessor-version":[{"id":1199,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1197\/revisions\/1199"}],"wp:attachment":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}