lxml: XML validation with XMLSchema doesn't give error's position
<p>Here is python code referencing to valid XML-schema(1.xsd) and arbitrary XML (1.xml):</p>

<p><strong>1.xsd:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="product"/&gt;
&lt;/xs:schema&gt;
</code></pre>

<p><strong>1.xml:</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;my-product/&gt;
</code></pre>

<p><strong>main.py:</strong></p>

<pre><code>from lxml.etree import XMLParser, XMLSchema, parse, XMLSyntaxError

parser = XMLParser(schema=XMLSchema(file='1.xsd'))
try:
    xml = parse(open('1.xml', mode='rb'), parser)
except XMLSyntaxError as e:
    for error in parser.error_log:
        print error.message, error.line, error.column
</code></pre>

<p><strong>Output:</strong></p>

<blockquote>
  <p>Element 'my-product': No matching global declaration available for the validation root. 0 0</p>
</blockquote>

<p><strong>error.line</strong> and <strong>error.column</strong> are always <strong>0</strong>.
How can I get an error position?</p>

<hr>

<p><strong>UPD</strong></p>

<p>This code gives the correct position, but it has the lack of double parsing:</p>

<pre><code>from lxml.etree import XMLParser, XMLSchema, parse, XMLSyntaxError, XML

schema=XMLSchema(file='1.xsd')
parser = XMLParser(schema=schema)

xml_file = open('1.xml', mode='rb')
xml = XML(xml_file.read())
if not schema.validate(xml):
    for error in schema.error_log:
        print error.message, error.line, error.column
else:
    xml = parse(xml_file, parser)
</code></pre>

<blockquote>
  <p>Element 'my-product': No matching global declaration available for the validation root. 2 0</p>
</blockquote>