title: How to validate an xml file against an XSD Schema using Amara library in Python?
body: <p>High bounty for the following Q:</p>
  
  <p>Hello, 
  Here is what I tried on Ubuntu 9.10 using Python 2.6, Amara2 
  (by the way, test.xsd was created using xml2xsd tool): </p>
  
  <pre><code>g@spot:~$ cat test.xml; echo =====o=====; cat test.xsd; echo ==== 
  o=====; cat test.py; echo =====o=====; ./test.py; echo =====o===== 
  &lt;?xml version="1.0" encoding="utf-8"?&gt;==; ./test.py` &gt; 
  test.txttest.xsd; echo === 
  &lt;test&gt;abcde&lt;/test&gt; 
  =====o===== 
  &lt;?xml version="1.0" encoding="UTF-8"?&gt; 
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  elementFormDefault="qualified"&gt; 
    &lt;xs:element name="test" type="xs:NCName"/&gt; 
  &lt;/xs:schema&gt; 
  =====o===== 
  #!/usr/bin/python2.6 
  # I wish to validate an xml file against an external XSD schema. 
  from amara import bindery, parse 
  source = 'test.xml' 
  schema = 'test.xsd' 
  #help(bindery.parse) 
  #doc = bindery.parse(source, uri=schema, validate=True) # These 2 seem 
  to fail in the same way. 
  doc = parse(source, uri=schema, validate=True) # So, what is the 
  difference anyway? 
  # 
  =====o===== 
  Traceback (most recent call last): 
    File "./test.py", line 14, in &lt;module&gt; 
      doc = parse(source, uri=schema, validate=True) 
    File "/usr/local/lib/python2.6/dist-packages/Amara-2.0a4-py2.6-linux- 
  x86_64.egg/amara/tree.py", line 50, in parse 
      return _parse(inputsource(obj, uri), flags, 
  entity_factory=entity_factory) 
  amara.ReaderError: In file:///home/g/test.xml, line 2, column 0: 
  Missing document type declaration 
  g@spot:~$ 
  =====o===== 
  </code></pre>
  
  <p>So, why am I seeing this error? Is this functionality not supported? 
  How can I validate an XML file against an XSD while having the 
  flexibility to point to any XSD file? 
  Thanks, and let me know if you have questions. </p>