One of the more challenging aspects in creating the interactive app for exploring the United States Constitution was the lack of an XML version of the U.S. Constitution.
I looked around on the web a bit, but I was unable to find one. (Perhaps I missed it, please let me know). This in contrast to the Titles of the U.S. Code which have been released in .xml Format.
(Edit: Update – Some time after I wrote this, Congress released an Official version of the US Constitution in xml – located here. You may prefer that to my unofficial version below.)
Structuring the law as data in XML (or some other structured format) is what permits us to create interesting visualizations like the above, or those here and here.
US Constitution in XML
Thus, I decided to create versions of the U.S. Constitution in XML and JSON (Javascript Object Notation) format. The text of the Constitution was copied from this source. I wrote a parser in python to read in the plain text file and create the xml and JSON files based upon the heading structure.
You can download this version of the U.S. Constitution in XML from github or simply copy from below. Please note, this is just a “beta” version. I haven’t fully vetted the contents of the Constitution that I copied, and while I believe it to be correct, there may be errors. Please feel free to copy it and adapt it for your own purposes.
Continue reading