{"id":4022,"date":"2013-09-06T05:12:59","date_gmt":"2013-09-05T19:12:59","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4022"},"modified":"2013-09-06T05:12:59","modified_gmt":"2013-09-05T19:12:59","slug":"python-xml-and-dtd-validate-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/python-xml-and-dtd-validate-primer-tutorial\/","title":{"rendered":"Python XML and DTD Validate Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Python\/XML\/Validate\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Python XML and DTD Validate Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/XML\/Validate\/Python_XML-DTD_Validate_Primer-34of.jpg\" title=\"Python XML and DTD Validate Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Python XML and DTD Validate Primer Tutorial<\/p><\/div>\n<p>The XML Validation subject area is quite complex.    The reason for this is that when there is intelligence in your data, as XML often has, it can be organized in a variety of ways.   One approach with XML data is to oversee its integrity with the use of <a target=_blank title='DTD information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Document_type_definition'>DTD schemas<\/a>, which is like a blueprint for your XML data, outlining how it should be structured to pass validation checks.   If you know your XML data passes the validation tests implied by the DTD then you are likely to have a very successful project, if the DTD has been structured methodically and has enough flexibility to express all the complication needed to satisfy business logic requirements.<\/p>\n<p>Python has functionality to help with validating XML in a variety of different scenarios, as do other languages such as PHP and Java, for example.   Here for this tutorial there were two huge contributions from:<\/p>\n<ul>\n<li>the Eclipse IDE XML examples provided ( the same as used in yesterday to yesterday&#8217;s tutorial <a target=_blank title='Java Eclipse XML and DTD Validate Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=3993'>Java Eclipse XML and DTD Validate Primer Tutorial<\/a> )<\/li>\n<li>very good tutorial <a target=_blank title='Tutorial about validating XML against a real existing DTD' href='http:\/\/www.emoticode.net\/python\/xml-dtd-validation-for-python.html'>here<\/a> where only the input file name was changed in download code presented below<\/li>\n<\/ul>\n<p>In this primer  <a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/Python\/XML\/Validate\/'>tutorial<\/a> you can see some Python XML and DTD validation program in action on a Windows laptop using Python 2.4 and PyXML 0.8.4, as you will see being installed, during the tutorial.<\/p>\n<p>Link to downloadable Python programming source code for XML and DTD validation <a target=_blank title='xmldtdvalidate.py' href='http:\/\/www.rjmprogramming.com.au\/Python\/XML\/Validate\/xmldtdvalidate.py_GETME'>xmldtdvalidate.py<\/a><\/p>\n<p>Link to sample DTD data <a target=_blank title='Invoice.dtd' href='http:\/\/www.rjmprogramming.com.au\/Python\/XML\/Validate\/Invoice.dtd_GETME'>Invoice.dtd<\/a><\/p>\n<p>Link to sample XML data <a target=_blank title='Invoice.xml' href='http:\/\/www.rjmprogramming.com.au\/Python\/XML\/Validate\/Invoice.xml_GETME'>Invoice.xml<\/a><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d4022' onclick='var dv=document.getElementById(\"d4022\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Python\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d4022' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The XML Validation subject area is quite complex. The reason for this is that when there is intelligence in your data, as XML often has, it can be organized in a variety of ways. One approach with XML data is &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/python-xml-and-dtd-validate-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[368,997,1012,1319,1357,1480],"class_list":["post-4022","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-dtd","tag-programming","tag-python","tag-tutorial","tag-validate","tag-xml"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4022"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=4022"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4022\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=4022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=4022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=4022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}