Repository: biopython/biopython

Issue:
ValueError: Unknown prefix 'ali' with uri 'http://www.niso.org/schemas/ali/1.0'
### Setup

I am reporting a problem with Biopython version, Python version, and operating
system as follows:

```python
import sys; print(sys.version)
import platform; print(platform.python_implementation()); print(platform.platform())
import Bio; print(Bio.__version__)
```

(*Please copy and run the above in your Python, and copy-and-paste the output*)

3.9.12 (main, Apr  5 2022, 06:56:58) 
[GCC 7.5.0]
CPython
Linux-4.15.0-122-generic-x86_64-with-glibc2.27
1.79

I am fetching and reading articles from PMC using Bio.Entrez. I can fetch and read most articles, but get an error when reading the article with id *PMC4664543*. I have checked, and PMC4664543 is an article in Pubmed Central. Link: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4664543/

I run the following code:

```python 
from Bio import Entrez

Entrez.email = "<email>"
Entrez.api_key =  "<api_key>"

pmc_id = "PMC2627607"
handle = Entrez.efetch(db="pmc", retmode="json", id=pmc_id)
results = Entrez.read(handle, validate=False)
print(type(results))

pmc_id = "PMC4664543"
handle = Entrez.efetch(db="pmc", retmode="json", id=pmc_id)
results = Entrez.read(handle, validate=False)
print(type(results))
```

### Expected behaviour
```
<class 'Bio.Entrez.Parser.ListElement'>
<class 'Bio.Entrez.Parser.ListElement'>
```
### Actual behaviour

```
<class 'Bio.Entrez.Parser.ListElement'>
Traceback (most recent call last):
  File "/home/je/repositories/medical-dataset/test.py", line 16, in <module>
    results = Entrez.read(handle, validate=False)
  File "/home/je/.conda/envs/pmc_test/lib/python3.9/site-packages/Bio/Entrez/__init__.py", line 508, in read
    record = handler.read(handle)
  File "/home/je/.conda/envs/pmc_test/lib/python3.9/site-packages/Bio/Entrez/Parser.py", line 335, in read
    self.parser.ParseFile(handle)
  File "/opt/conda/conda-bld/python-split_1654083059479/work/Modules/pyexpat.c", line 618, in StartNamespaceDecl
  File "/home/je/.conda/envs/pmc_test/lib/python3.9/site-packages/Bio/Entrez/Parser.py", line 471, in startNamespaceDeclHandler
    raise ValueError("Unknown prefix '%s' with uri '%s'" % (prefix, uri))
ValueError: Unknown prefix 'ali' with uri 'http://www.niso.org/schemas/ali/1.0'
```
### Steps to reproduce
1. `pip install biopython==1.79`


2. Run the python code above:


Discussion:
Why are you asking for JSON when the parser expects XML? Entrez seems to give you XML anyway but that's still odd.

Anyway, the second example is essentially using this URL (try ``print(handle.url)``),

```
$ curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&retmode=xml&id=PMC4664543"
<!DOCTYPE pmc-articleset PUBLIC "-//NLM//DTD ARTICLE SET 2.0//EN" "https://dtd.nlm.nih.gov/ncbi/pmc/articleset/nlm-articleset-2.0.dtd">
<pmc-articleset><article xmlns:ali="http://www.niso.org/schemas/ali/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" article-type="review-article">
  <?properties open_access?>
  <front>
    <journal-meta>
      <journal-id journal-id-type="nlm-ta">Clin Ophthalmol</journal-id>
      <journal-id journal-id-type="iso-abbrev">Clin Ophthalmol</journal-id>
      <journal-id journal-id-type="publisher-id">Clinical Ophthalmology</journal-id>
      <journal-title-group>
...
```

So it does at least try to declare the ali prefix...



Resolving patch:
diff --git a/Bio/Entrez/Parser.py b/Bio/Entrez/Parser.py
--- a/Bio/Entrez/Parser.py
+++ b/Bio/Entrez/Parser.py
@@ -504,7 +504,7 @@ def startNamespaceDeclHandler(self, prefix, uri):
             elif prefix == "xlink":
                 assert uri == "http://www.w3.org/1999/xlink"
             elif prefix == "ali":
-                assert uri == "http://www.niso.org/schemas/ali/1.0/"
+                assert uri.rstrip("/") == "http://www.niso.org/schemas/ali/1.0"
             else:
                 raise ValueError(f"Unknown prefix '{prefix}' with uri '{uri}'")
             self.namespace_level[prefix] += 1


Test patch: