Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite code of MedlineImporter #9536

Closed
koppor opened this issue Jan 6, 2023 · 2 comments · Fixed by #9673
Closed

Rewrite code of MedlineImporter #9536

koppor opened this issue Jan 6, 2023 · 2 comments · Fixed by #9673
Assignees
Labels
type: code-quality Issues related to code or architecture decisions

Comments

@koppor
Copy link
Member

koppor commented Jan 6, 2023

The class org.jabref.logic.importer.fileformat.MedlineImporter uses JAXB, but can be rewritten using a StAX-Parser and thus getting rid of a JAXB dependency.

Example:

Old code:

           Object unmarshalledObject = unmarshallRoot(reader);

           // check whether we have an article set, an article, a book article or a book article set
           if (unmarshalledObject instanceof PubmedArticleSet) {
               PubmedArticleSet articleSet = (PubmedArticleSet) unmarshalledObject;
               for (Object article : articleSet.getPubmedArticleOrPubmedBookArticle()) {
                   if (article instanceof PubmedArticle) {

New code:

            XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader);
            xmlStreamReader.nextTag();
            String rootElementName = xmlStreamReader.getName().getLocalPart();
            switch (rootElementName) {
                case "PubMedArticleSet":
                    ...
                    break;
               case "PubmedArticle":
                   parseArticle(xmlStreamReader, bibItems);
                   break;
               case "PubmedBookArticle":
                   parseBookArticle(xmlStreamReader, bibItems);
                   break;
               ...
@koppor koppor added the type: code-quality Issues related to code or architecture decisions label Jan 6, 2023
@Siedlerchr
Copy link
Member

Maybe this also allows us to solve the italic/mathml issues

@aqurilla
Copy link
Contributor

Please assign this issue to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code-quality Issues related to code or architecture decisions
Projects
Development

Successfully merging a pull request may close this issue.

3 participants