[Biopython-dev] [Bug 2488] Adding XML parsers to Bio.Entrez

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Sun Apr 13 00:55:03 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2488





------- Comment #2 from mdehoon at ims.u-tokyo.ac.jp  2008-04-12 20:55 EST -------
> Why don't the Bio/Entrez/XXX.py implement subclasses of Bio.Entrez.DataHandler,
> rather than just the two methods startElement() and endElement() -- I'm trying
> to understand why you did it this way round Michiel.

We don't know what kind of XML we're handling until after we start reading it,
since this is information contained in the XML. So we need to create the
handler before knowing which handler will be needed.

> Finally, in Bio/Entrez/__init__.py why is the _NameToModule dict defined
> within the DataHandler class?  This seems to prevent it from being edited
> -- desirable if the user wanted to add or change the parsers called by 
> Bio.Entrez.read() in their script.

We can get to _nameToModule. Try it:
>>> from Bio import Entrez
>>> Entrez.DataHandler._NameToModule
Being able to override the parsers in Bio.Entrez is something Sean requested. I
am not sure if he still wants it, or if it's really useful. A user can also
modify the record after parsing it with the standard parser in Bio.Entrez,
which gives the same end result as modifying the parser.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list