# Path: pyminer/parsers/parsers.py
# def parse_xml(x):
#     '''
#     parse xml
# 
#     :param path: [String] Path to an xml file
#     :return: object of class lxml.etree._Element
# 
#     Usage::
# 
#         from pyminer import fetch
#         from pyminer import parsers
#         url = "https://peerj.com/articles/cs-23.xml"
#         out = fetch(url)
#         parsers.parse_xml(out.path)
#     '''
#     # text = read_disk(x)
#     # xmlparser = etree.XMLParser()
#     # tt = etree.fromstring(text, xmlparser)
#     tt = etree.parse(x)
#     return tt
# 
# def parse_plain(x):
#     '''
#     parse plain text
# 
#     :param path: [String] Path to a plain text file
#     :return: a string
# 
#     Usage::
# 
#         from pyminer import fetch
#         from pyminer import parsers
#         url = "xx"
#         out = fetch(url)
#         parsers.parse_plain(out.path)
#     '''
#     return read_disk(x)
# 
# def parse_pdf(x):
#     '''
#     parse pdf
# 
#     :param path: [String] Path to a pdf file
#     :return: a string
# 
#     Usage::
# 
#         from pyminer import fetch
#         from pyminer import parsers
#         url = "http://www.banglajol.info/index.php/AJMBR/article/viewFile/25509/17126"
#         out = fetch(url)
#         parsers.parse_pdf(out.path)
#     '''
#     return extract(x)


from .parsers import parse_xml, parse_plain, parse_pdf

class Fetched(object):
  """docstring for Fetched"""
  def __init__(self, url, path, type):
    super(Fetched, self).__init__()
    self.url = url
    self.path = path
    self.type = type

  def parse(self):
    if self.type == "xml" or self.type == "html":
      return parse_xml(self.path)
    elif self.type == "plain":

# Path: pyminer/parsers/parsers.py
# def parse_xml(x):
#     '''
#     parse xml
# 
#     :param path: [String] Path to an xml file
#     :return: object of class lxml.etree._Element
# 
#     Usage::
# 
#         from pyminer import fetch
#         from pyminer import parsers
#         url = "https://peerj.com/articles/cs-23.xml"
#         out = fetch(url)
#         parsers.parse_xml(out.path)
#     '''
#     # text = read_disk(x)
#     # xmlparser = etree.XMLParser()
#     # tt = etree.fromstring(text, xmlparser)
#     tt = etree.parse(x)
#     return tt
# 
# def parse_plain(x):
#     '''
#     parse plain text
# 
#     :param path: [String] Path to a plain text file
#     :return: a string
# 
#     Usage::
# 
#         from pyminer import fetch
#         from pyminer import parsers
#         url = "xx"
#         out = fetch(url)
#         parsers.parse_plain(out.path)
#     '''
#     return read_disk(x)
# 
# def parse_pdf(x):
#     '''
#     parse pdf
# 
#     :param path: [String] Path to a pdf file
#     :return: a string
# 
#     Usage::
# 
#         from pyminer import fetch
#         from pyminer import parsers
#         url = "http://www.banglajol.info/index.php/AJMBR/article/viewFile/25509/17126"
#         out = fetch(url)
#         parsers.parse_pdf(out.path)
#     '''
#     return extract(x)


# Path: pyminer/fetched.py
from .parsers import parse_xml, parse_plain, parse_pdf


class Fetched(object):
  """docstring for Fetched"""
  def __init__(self, url, path, type):
    super(Fetched, self).__init__()
    self.url = url
    self.path = path
    self.type = type

  def parse(self):
    if self.type == "xml" or self.type == "html":
      return parse_xml(self.path)
    elif self.type == "plain":

      return parse_plain(self.path)