Hi All,&nbsp;<div>I&#39;ve read that&nbsp;</div><div><br></div><div>&quot;</div><div><span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: Arial; line-height: 19px; ">Serialising an ElementTree now includes any internal DTD subsets that are part of the document, as well as comments and PIs that are siblings of the root node.</span><br>
</div><div><span class="Apple-style-span" style="color: rgb(34, 34, 34); line-height: 19px;">&quot; (from changelog)</span></div><div><br></div><div>but I&#39;ve failed to achieve this goal, dtd data is lost:</div><div><br>
</div><div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;root = lxml.etree.parse(StringIO(&quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!DOCTYPE schema [</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!ATTLIST reference id ID #REQUIRED&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!ATTLIST joined_values id ID #REQUIRED&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!ATTLIST file id ID #REQUIRED&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!ATTLIST lookup id ID #REQUIRED&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!ATTLIST selector id ID #REQUIRED&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!ATTLIST Column id ID #REQUIRED&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;]&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;schema/&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;&quot;&quot;))</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;print lxml.etree.tostring(root)</div><div>
<br></div><div>prints me&nbsp;</div><div><br></div><div>&lt;schema/&gt;<br></div><div><br></div><div>What am I doing wrong?</div><div><br></div><div>Thanks in advance,</div><div>Alex</div><br>
</div>