]> pere.pagekite.me Git - text-free-culture-lessig.git/blobdiff - scripts/verify-indexterm-range
Review: part "Property" up to chapter 10 "Property".
[text-free-culture-lessig.git] / scripts / verify-indexterm-range
index 19a31a12882ea7e889c286929b0234d2bfda6938..8dd85958e1b69b984ba2936e775d1058d3ee66a3 100755 (executable)
@@ -5,9 +5,18 @@
 # are unique.
 
 from  lxml import etree
+import subprocess
+
 def main():
     filename = 'freeculture.xml'
-    doc = etree.parse(filename)
+
+    # make sure entities are looked up / available
+    # Based on idea from
+    # http://stackoverflow.com/questions/14731633/how-to-resolve-external-entities-with-xml-etree-like-lxml-etree
+    proc = subprocess.Popen(['xmllint','--noent',filename],stdout=subprocess.PIPE)
+    output = proc.communicate()[0]
+    doc = ElementTree.parse(StringIO.StringIO(output))
+
     ids = {}
     order = 0
     for it in doc.getroot().xpath('//indexterm'):