<html>
<head>
<style>
body {
font-family: Verdana, sans-serif;
font-size: 0.8em;
color:#484848;
}
h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin: 0px; }
h1 { font-size: 1.2em; }
h2, h3 { font-size: 1.1em; }
a, a:link, a:visited { color: #2A5685;}
a:hover, a:active { color: #c61a1a; }
a.wiki-anchor { display: none; }
fieldset.attachments {border-width: 1px 0 0 0;}
hr {
width: 100%;
height: 1px;
background: #ccc;
border: 0;
}
span.footer {
font-size: 0.8em;
font-style: italic;
}
</style>
</head>
<body>
Issue #3430 has been updated by Travis Wrightsman.
<ul>
<li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li>
<li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li>
</ul>
<p>NXML file was improperly formatted.</p>
<hr />
<h1><a href="https://redmine.open-bio.org/issues/3430#change-15300">Bug #3430: Error parsing PubMedCentral XML files</a></h1>
<ul><li>Author: Paulo Nuin</li>
<li>Status: Resolved</li>
<li>Priority: Normal</li>
<li>Assignee: Biopython Dev Mailing List</li>
<li>Category: Main Distribution</li>
<li>Target version: </li>
<li>URL: </li></ul>
<p>It seems that there is an error parsing locally downloaded PubMedCentral xml (extension nxml) files. Using the code</p>
<p><code><br />from Bio import Entrez<br />handle = open('nihms83342.nxml')<br />records = Entrez.parse(handle)<br />for record in records:<br /> print record<br /></code></p>
<p>the following error occurs (copied from iPython), even though the XML header contains the declaration</p>
<p>---------------------------------------------------------------------------<br />NotXMLError Traceback (most recent call last)<br /><ipython-input-5-e78d8d3c3888> in <module>()<br /> 2 handle = open('nihms83342.nxml')<br /> 3 records = Entrez.parse(handle)<br />----> 4 for record in records:<br /> 5 print record</p>
<p>/Library/Python/2.7/site-packages/Bio/Entrez/Parser.pyc in parse(self, handle)<br /> 229 # We did not see the initial <!xml declaration, so<br /> 230 # probably the input data is not in XML format.<br />--> 231 raise NotXMLError("XML declaration not found")<br /> 232 self.parser.Parse("", True)<br /> 233 self.parser = None</p>
<p>NotXMLError: Failed to parse the XML data (XML declaration not found). Please make sure that the input data are in XML format.</p>
<p>The XML file in question is attached.</p>
<fieldset class="attachments"><legend>Files</legend>
<a href="https://redmine.open-bio.org/attachments/download/1772/nihms83342.nxml">nihms83342.nxml</a>
(74.9 KB)<br />
</fieldset>
<hr />
<span class="footer"><p>You have received this notification because you have either subscribed to it, or are involved in it.<br />To change your notification preferences, please click here and login: <a class="external" href="http://redmine.open-bio.org">http://redmine.open-bio.org</a></p></span>
</body>
</html>