# Path: src/eutils/_internal/utils.py
# def xml_get_text_or_none(node, xpath):
#     try:
#         return xml_get_text(node, xpath)
#     except IndexError:    # xpath search found 0 matches
#         return None
# 
# def xml_get1(node, xpath):
#     return node.xpath(xpath)[0]
# 
# Path: src/eutils/_internal/xmlfacades/base.py
# class Base(object):
#     """Root class for all xmlfacade classes.
# 
#     This class is instantiated only by subclasses.
# 
#     xmlfacades must be instantiated with an XML document, passed
#     either as XML text or as the root of a parsed XML document.
# 
#     _root_tag must be defined by the subclass. It is used to validate
#     the node type upon instantiation of the subclass.
# 
#     """
# 
#     _root_tag = None
# 
#     def __init__(self, xml):
#         if isinstance(xml, lxml.etree._Element):
#             self._xml_root = xml
#         elif isinstance(xml, str) or isinstance(xml, bytes):
#             self._xml_root = lxml.etree.XML(xml)
#         else:
#             raise EutilsError("Cannot create object from type " + type(xml).__name__)
# 
#         if self._root_tag is None:
#             raise EutilsError("_root_tag not defined for class {}".format(type(self).__name__))
#         elif self._root_tag != self._xml_root.tag:
#             raise EutilsError("XML for {} object must be a {} element (got {})".format(
#                 type(self).__name__, self._root_tag, self._xml_root.tag))


from ..utils import xml_get_text_or_none, xml_get1
from .base import Base
    from .xmlfacades.pubmedcentralarticleset import PubmedCentralArticleSet
    import lxml.etree as le
    import os
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals



class PubmedCentralArticle(Base):

    _root_tag = "article"

    def __str__(self):
        return ("{pmca.__class__.__name__}(pmc={pmca.pmc};pmid={pmca.pmid};doi={pmca.doi};{pmca.title})".format(pmca=self))

    @property
    def title(self):
        return ''.join([x for x in xml_get1(self._xml_root, "front/article-meta/title-group/article-title").itertext()])

    @property
    def abstract_text(self):

# Path: src/eutils/_internal/utils.py
# def xml_get_text_or_none(node, xpath):
#     try:
#         return xml_get_text(node, xpath)
#     except IndexError:    # xpath search found 0 matches
#         return None
# 
# def xml_get1(node, xpath):
#     return node.xpath(xpath)[0]
# 
# Path: src/eutils/_internal/xmlfacades/base.py
# class Base(object):
#     """Root class for all xmlfacade classes.
# 
#     This class is instantiated only by subclasses.
# 
#     xmlfacades must be instantiated with an XML document, passed
#     either as XML text or as the root of a parsed XML document.
# 
#     _root_tag must be defined by the subclass. It is used to validate
#     the node type upon instantiation of the subclass.
# 
#     """
# 
#     _root_tag = None
# 
#     def __init__(self, xml):
#         if isinstance(xml, lxml.etree._Element):
#             self._xml_root = xml
#         elif isinstance(xml, str) or isinstance(xml, bytes):
#             self._xml_root = lxml.etree.XML(xml)
#         else:
#             raise EutilsError("Cannot create object from type " + type(xml).__name__)
# 
#         if self._root_tag is None:
#             raise EutilsError("_root_tag not defined for class {}".format(type(self).__name__))
#         elif self._root_tag != self._xml_root.tag:
#             raise EutilsError("XML for {} object must be a {} element (got {})".format(
#                 type(self).__name__, self._root_tag, self._xml_root.tag))


# Path: src/eutils/_internal/xmlfacades/pubmedcentralarticle.py
from ..utils import xml_get_text_or_none, xml_get1
from .base import Base
    from .xmlfacades.pubmedcentralarticleset import PubmedCentralArticleSet
    import lxml.etree as le
    import os

# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals



class PubmedCentralArticle(Base):

    _root_tag = "article"

    def __str__(self):
        return ("{pmca.__class__.__name__}(pmc={pmca.pmc};pmid={pmca.pmid};doi={pmca.doi};{pmca.title})".format(pmca=self))

    @property
    def title(self):
        return ''.join([x for x in xml_get1(self._xml_root, "front/article-meta/title-group/article-title").itertext()])

    @property
    def abstract_text(self):

        return ''.join([x for x in xml_get1(self._xml_root, "front/article-meta/abstract").itertext()])