title: Extracting text from JATS XML file using Python
body: <p>I want to extract text from a <a href="https://drive.google.com/open?id=0B-GrETdP7h-sOWVteE92Yk4tTmc" rel="nofollow noreferrer"> JATS-XML file</a></p>
  
  <p><a href="https://jats.nlm.nih.gov/archiving/tag-library/1.1/" rel="nofollow noreferrer">JATS</a> is a standardized XML format for representation of research publications. </p>
  
  <pre><code>&lt;article&gt;
    &lt;front&gt;
      &lt;journal-meta&gt;
        &lt;journal-title-group&gt;
          &lt;journal-title&gt;Elsevier Science B.V. All rights reserved.
  P I I S&lt;/journal-title&gt;
        &lt;/journal-title-group&gt;
      &lt;/journal-meta&gt;
      &lt;article-meta&gt;
        &lt;title-group&gt;
          &lt;article-title&gt;How does foreign direct investment affect economic 1 growth? E. Borenszteina ,*, J. De Gregoriob, J-W. Leec&lt;/article-title&gt;
        &lt;/title-group&gt;
        &lt;contrib-group&gt;
          &lt;contrib contrib-type="author"&gt;
            &lt;string-name&gt;E. Borensztein&lt;/string-name&gt;
            &lt;email&gt;eborensztein@imf.org&lt;/email&gt;
            &lt;xref ref-type="aff" rid="0"&gt;0&lt;/xref&gt;
          &lt;/contrib&gt;
          &lt;contrib contrib-type="author"&gt;
            &lt;string-name&gt;J. De Gregorio&lt;/string-name&gt;
            &lt;xref ref-type="aff" rid="2"&gt;2&lt;/xref&gt;
          &lt;/contrib&gt;
          &lt;contrib contrib-type="author"&gt;
            &lt;string-name&gt;J-W. Lee&lt;/string-name&gt;
            &lt;xref ref-type="aff" rid="3"&gt;3&lt;/xref&gt;
          &lt;/contrib&gt;
          &lt;aff id="0"&gt;
            &lt;label&gt;0&lt;/label&gt;
            &lt;institution&gt;International Monetary Fund, Research Department&lt;/institution&gt;
            ,
            &lt;addr-line&gt;Washington DC 20431&lt;/addr-line&gt;
            &lt;country country="US"&gt;USA&lt;/country&gt;
          &lt;/aff&gt;
          &lt;aff id="1"&gt;
            &lt;label&gt;1&lt;/label&gt;
            &lt;institution&gt;We are grateful for comments from Robert Barro&lt;/institution&gt;
            ,
            &lt;addr-line&gt;Elhanan Helpman, Boyan Jovanovic, Mohsin Khan, Se-Jik Kim, Donald Mathieson, Sergio Rebelo, Jeffrey Sachs&lt;/addr-line&gt;
            ,
            &lt;institution&gt;Peter Wickham, and two anonymous referees. Comments by participants in seminars at 1995 World Congress of the Econometric Society, Korean Macroeconomics Workshop, Kobe University, and Osaka University were very helpful. This paper was partially prepared while Jose ́ de Gregorio and Jong-Wha Lee were at the Research Department, International Monetary Fund. Any opinions expressed are only those of the&lt;/institution&gt;
          &lt;/aff&gt;
          &lt;aff id="2"&gt;
            &lt;label&gt;2&lt;/label&gt;
            &lt;institution&gt;Center for Applied Economics, Department of Industrial Engineering, Universidad de Chile&lt;/institution&gt;
            ,
            &lt;addr-line&gt;Santiago&lt;/addr-line&gt;
            ,
            &lt;country country="CL"&gt;Chile&lt;/country&gt;
          &lt;/aff&gt;
          &lt;aff id="3"&gt;
            &lt;label&gt;3&lt;/label&gt;
            &lt;institution&gt;Economics Department, Korea University and NBER&lt;/institution&gt;
            ,
            &lt;addr-line&gt;Seoul 136 -701&lt;/addr-line&gt;
            &lt;country country="KR"&gt;Korea&lt;/country&gt;
          &lt;/aff&gt;
        &lt;/contrib-group&gt;
        &lt;abstract&gt;
          &lt;p&gt;We test the effect of foreign direct investment (FDI) on economic growth in a cross-country regression framework, utilizing data on FDI flows from industrial countries to 69 developing countries over the last two decades. Our results suggest that FDI is an important vehicle for the transfer of technology, contributing relatively more to growth than domestic investment. However, the higher productivity of FDI holds only when the host country has a minimum threshold stock of human capital. Thus, FDI contributes to economic growth only when a sufficient absorptive capability of the advanced technologies is available in the host economy. 1998 Elsevier Science B.V.&lt;/p&gt;
        &lt;/abstract&gt;
        &lt;kwd-group&gt;
          &lt;kwd&gt;Foreign direct investment&lt;/kwd&gt;
          &lt;kwd&gt;Economic growth&lt;/kwd&gt;
          &lt;kwd&gt;Cross-country regression framework&lt;/kwd&gt;
          &lt;kwd&gt;Developing countries&lt;/kwd&gt;
        &lt;/kwd-group&gt;
        &lt;volume&gt;0&lt;/volume&gt;
        &lt;issue&gt;0&lt;/issue&gt;
        &lt;fpage&gt;115&lt;/fpage&gt;
        &lt;lpage&gt;135&lt;/lpage&gt;
        &lt;pub-date&gt;
          &lt;year&gt;1998&lt;/year&gt;
        &lt;/pub-date&gt;
        &lt;history&gt;
          &lt;date date-type="accepted"&gt;
            &lt;day&gt;20&lt;/day&gt;
            &lt;month&gt;5&lt;/month&gt;
            &lt;year&gt;1997&lt;/year&gt;
          &lt;/date&gt;
          &lt;date date-type="received"&gt;
            &lt;day&gt;21&lt;/day&gt;
            &lt;month&gt;2&lt;/month&gt;
            &lt;year&gt;1996&lt;/year&gt;
          &lt;/date&gt;
          &lt;date date-type="revised"&gt;
            &lt;day&gt;24&lt;/day&gt;
            &lt;month&gt;2&lt;/month&gt;
            &lt;year&gt;1997&lt;/year&gt;
          &lt;/date&gt;
        &lt;/history&gt;
      &lt;/article-meta&gt;
    &lt;/front&gt;
    &lt;back&gt;
      &lt;ref-list&gt;
        &lt;ref id="1"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Aitken&lt;/surname&gt;
              ,
              &lt;given-names&gt;B.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Harrison&lt;/surname&gt;
              ,
              &lt;given-names&gt;A.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1993&lt;/year&gt;
            ,
            &lt;article-title&gt;Do Domestically-Owned Firms Benefit from Foreign Direct Investment: Evidence from Panel Data, Unpublished manuscript&lt;/article-title&gt;
            ,
            &lt;source&gt;International Monetary Fund.&lt;/source&gt;
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="2"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Barro&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Lee&lt;/surname&gt;
              ,
              &lt;given-names&gt;J-W.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1993&lt;/year&gt;
            .
            &lt;article-title&gt;International comparisons of educational attainment&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Monetary Economics&lt;/source&gt;
            &lt;volume&gt;32&lt;/volume&gt;
            ,
            &lt;fpage&gt;361&lt;/fpage&gt;
            -
            &lt;lpage&gt;394&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="3"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Barro&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Lee&lt;/surname&gt;
              ,
              &lt;given-names&gt;J-W.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1994&lt;/year&gt;
            .
            &lt;article-title&gt;Sources of economic growth&lt;/article-title&gt;
            .
            &lt;source&gt;Carnegie Rochester Conference Series on Public Policy&lt;/source&gt;
            &lt;volume&gt;40&lt;/volume&gt;
            ,
            &lt;fpage&gt;1&lt;/fpage&gt;
            -
            &lt;lpage&gt;46&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="4"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Barro&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;article-title&gt;Sala-i-&lt;/article-title&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Martin&lt;/surname&gt;
              ,
              &lt;given-names&gt;X.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1995&lt;/year&gt;
            . Economic Growth,
            &lt;string-name&gt;
              &lt;surname&gt;McGraw-Hill&lt;/surname&gt;
            &lt;/string-name&gt;
            , Cambridge, MA.
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="5"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Benhabib&lt;/surname&gt;
              ,
              &lt;given-names&gt;J.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Spiegel&lt;/surname&gt;
              ,
              &lt;given-names&gt;M.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1994&lt;/year&gt;
            .
            &lt;article-title&gt;The roles of human capital in economic development: evidence from aggregate cross-country data&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Monetary Economics&lt;/source&gt;
            &lt;volume&gt;34&lt;/volume&gt;
            ,
            &lt;fpage&gt;143&lt;/fpage&gt;
            -
            &lt;lpage&gt;173&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="6"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Blomstrom&lt;/surname&gt;
              ,
              &lt;given-names&gt;M.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Lipsey&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Zejan&lt;/surname&gt;
              ,
              &lt;given-names&gt;M.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1992&lt;/year&gt;
            .
            &lt;article-title&gt;What Explains Developing Country Growth&lt;/article-title&gt;
            . NBER Working Paper No.
            &lt;volume&gt;4132&lt;/volume&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="7"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Cohen&lt;/surname&gt;
              ,
              &lt;given-names&gt;D.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1993&lt;/year&gt;
            .
            &lt;article-title&gt;Foreign Finance and Economic Growth - An Empirical Analysis&lt;/article-title&gt;
            .
            &lt;article-title&gt;Unpublished manuscript&lt;/article-title&gt;
            , CEPREMAP.
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="8"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;De Gregorio&lt;/surname&gt;
              ,
              &lt;given-names&gt;J.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1992&lt;/year&gt;
            .
            &lt;article-title&gt;Economic growth in Latin America&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Development Economics&lt;/source&gt;
            &lt;volume&gt;39&lt;/volume&gt;
            ,
            &lt;fpage&gt;58&lt;/fpage&gt;
            -
            &lt;lpage&gt;84&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="9"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Easterly&lt;/surname&gt;
              ,
              &lt;given-names&gt;W.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1993&lt;/year&gt;
            .
            &lt;article-title&gt;How much do distortions affect growth&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Monetary Economics&lt;/source&gt;
            &lt;volume&gt;32&lt;/volume&gt;
            ,
            &lt;fpage&gt;187&lt;/fpage&gt;
            -
            &lt;lpage&gt;212&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="10"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Easterly&lt;/surname&gt;
              ,
              &lt;given-names&gt;W.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;King&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Levine&lt;/surname&gt;
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Rebelo&lt;/surname&gt;
              ,
              &lt;given-names&gt;S.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1994&lt;/year&gt;
            . Policy,
            &lt;article-title&gt;Technology Adoption and Growth&lt;/article-title&gt;
            . NBER Working Paper No.
            &lt;volume&gt;4681&lt;/volume&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="11"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Edwards&lt;/surname&gt;
              ,
              &lt;given-names&gt;S.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1990&lt;/year&gt;
            . Capital Flows, Foreign Direct Investment, and
            &lt;article-title&gt;Debt-Equity Swaps in Developing Countries&lt;/article-title&gt;
            . NBER Working Paper No.
            &lt;volume&gt;3497&lt;/volume&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="12"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Ethier&lt;/surname&gt;
              ,
              &lt;given-names&gt;W.J.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1982&lt;/year&gt;
            .
            &lt;article-title&gt;National and international returns to scale in the modern theory of international trade&lt;/article-title&gt;
            .
            &lt;source&gt;American Economic Review&lt;/source&gt;
            &lt;volume&gt;72&lt;/volume&gt;
            ,
            &lt;fpage&gt;389&lt;/fpage&gt;
            -
            &lt;lpage&gt;405&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="13"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Findlay&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1978&lt;/year&gt;
            .
            &lt;article-title&gt;Relative backwardness, direct foreign investment, and the transfer of technology: a simple dynamic model&lt;/article-title&gt;
            .
            &lt;source&gt;Quarterly Journal of Economics 92&lt;/source&gt;
            ,
            &lt;fpage&gt;1&lt;/fpage&gt;
            -
            &lt;lpage&gt;16&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="14"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Grossman&lt;/surname&gt;
              ,
              &lt;given-names&gt;G.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Helpman&lt;/surname&gt;
              ,
              &lt;given-names&gt;E.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1991&lt;/year&gt;
            .
            &lt;article-title&gt;Innovation and Growth in the Global Economy&lt;/article-title&gt;
            , MIT Press Cambridge, MA.
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="15"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Gastil&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.D.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1987&lt;/year&gt;
            . Freedom in the World, Greenwood Press, Westport, CT.
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="16"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Graham&lt;/surname&gt;
              ,
              &lt;given-names&gt;E.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Krugman&lt;/surname&gt;
              ,
              &lt;given-names&gt;P.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1991&lt;/year&gt;
            .
            &lt;article-title&gt;Foreign Direct Investment in the United States&lt;/article-title&gt;
            , Institute for International Economics, Washington DC.
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="17"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Jovanovic&lt;/surname&gt;
              ,
              &lt;given-names&gt;B.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Rob&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1989&lt;/year&gt;
            .
            &lt;article-title&gt;Growth and diffusion of technology&lt;/article-title&gt;
            .
            &lt;source&gt;Review of Economic Studies&lt;/source&gt;
            &lt;volume&gt;56&lt;/volume&gt;
            ,
            &lt;fpage&gt;569&lt;/fpage&gt;
            -
            &lt;lpage&gt;582&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="18"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;King&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Levine&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1993&lt;/year&gt;
            .
            &lt;article-title&gt;Finance and growth: Schumpeter might be right&lt;/article-title&gt;
            .
            &lt;source&gt;Quarterly Journal of Economics&lt;/source&gt;
            &lt;volume&gt;108&lt;/volume&gt;
            ,
            &lt;fpage&gt;717&lt;/fpage&gt;
            -
            &lt;lpage&gt;738&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="19"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Knack&lt;/surname&gt;
              ,
              &lt;given-names&gt;S.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Keefer&lt;/surname&gt;
              ,
              &lt;given-names&gt;P.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1995&lt;/year&gt;
            .
            &lt;article-title&gt;Institutions and economic performance: cross-country tests using alternative institutional measures&lt;/article-title&gt;
            .
            &lt;source&gt;Economics and Politics&lt;/source&gt;
            &lt;volume&gt;7&lt;/volume&gt;
            ,
            &lt;fpage&gt;207&lt;/fpage&gt;
            -
            &lt;lpage&gt;227&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="20"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Levine&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Renelt&lt;/surname&gt;
              ,
              &lt;given-names&gt;D.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1992&lt;/year&gt;
            .
            &lt;article-title&gt;A sensitivity analysis of cross-country growth regressions&lt;/article-title&gt;
            .
            &lt;source&gt;American Economic Review&lt;/source&gt;
            &lt;volume&gt;82&lt;/volume&gt;
            ,
            &lt;fpage&gt;942&lt;/fpage&gt;
            -
            &lt;lpage&gt;963&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="21"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Nelson&lt;/surname&gt;
              ,
              &lt;given-names&gt;R.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;string-name&gt;
              &lt;surname&gt;Phelps&lt;/surname&gt;
              ,
              &lt;given-names&gt;E.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1966&lt;/year&gt;
            .
            &lt;article-title&gt;Investment in humans, technological diffusion, and economic growth&lt;/article-title&gt;
            .
            &lt;source&gt;American Economic Review: Papers and Proceedings&lt;/source&gt;
            &lt;volume&gt;61&lt;/volume&gt;
            ,
            &lt;fpage&gt;69&lt;/fpage&gt;
            -
            &lt;lpage&gt;75&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="22"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Romer&lt;/surname&gt;
              ,
              &lt;given-names&gt;P.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1990&lt;/year&gt;
            .
            &lt;article-title&gt;Endogenous technological change&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Political Economy&lt;/source&gt;
            &lt;volume&gt;98&lt;/volume&gt;
            ,
            &lt;fpage&gt;S71&lt;/fpage&gt;
            -
            &lt;lpage&gt;S102&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="23"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Romer&lt;/surname&gt;
              ,
              &lt;given-names&gt;P.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1993&lt;/year&gt;
            .
            &lt;article-title&gt;Idea gaps and object gaps in economic development&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Monetary Economics&lt;/source&gt;
            &lt;volume&gt;32&lt;/volume&gt;
            ,
            &lt;fpage&gt;543&lt;/fpage&gt;
            -
            &lt;lpage&gt;573&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="24"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Segerstrom&lt;/surname&gt;
              ,
              &lt;given-names&gt;P.S.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1991&lt;/year&gt;
            . Innovation, imitation, and
            &lt;article-title&gt;economic growth&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of Political Economy&lt;/source&gt;
            &lt;volume&gt;99&lt;/volume&gt;
            ,
            &lt;fpage&gt;807&lt;/fpage&gt;
            -
            &lt;lpage&gt;827&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="25"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;given-names&gt;United&lt;/given-names&gt;
              &lt;surname&gt;Nations&lt;/surname&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1992&lt;/year&gt;
            .
            &lt;source&gt;World Investment Report 1992 Transnational Corporations as Engines of Growth&lt;/source&gt;
            , Department of Economic and Social Development, United Nations, New York.
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
        &lt;ref id="26"&gt;
          &lt;mixed-citation&gt;
            &lt;string-name&gt;
              &lt;surname&gt;Wang&lt;/surname&gt;
              ,
              &lt;given-names&gt;J-Y.&lt;/given-names&gt;
            &lt;/string-name&gt;
            ,
            &lt;year&gt;1990&lt;/year&gt;
            .
            &lt;article-title&gt;Growth, technology transfer, and the long-run theory of international capital movements&lt;/article-title&gt;
            .
            &lt;source&gt;Journal of International Economics&lt;/source&gt;
            &lt;volume&gt;29&lt;/volume&gt;
            ,
            &lt;fpage&gt;255&lt;/fpage&gt;
            -
            &lt;lpage&gt;271&lt;/lpage&gt;
            .
          &lt;/mixed-citation&gt;
        &lt;/ref&gt;
      &lt;/ref-list&gt;
    &lt;/back&gt;
  &lt;/article&gt;
  </code></pre>
  
  <p>There is a tag <code>&lt;abstract&gt;</code> around line 58. I intend to extract the text corresponding to that. The caveat here is the file structure is too complex and although its structure is similar to XML, I am unable to get output. I have tried many libraries like <code>untangle</code> <code>lxml</code> and <code>beautifulsoup</code> but no success.</p>
  
  <p>This is one of the code I tried.</p>
  
  <pre><code>fo = open('The international law on foreign investment.cermxml')
  doc = etree.parse(fo)
  ## TRY 1
  doc.find('abstract') # This yields nothing
  
  ## TRY 2
  path_result = doc.xpath('//abstract') ## Returns empty list
  
  ## TRY 3
  root = doc.getroot()
  result = root.iter('abstract') # This yeilds &lt;lxml.etree.ElementDepthFirstIterator at 0x7f1f71c15a20&gt;
  ## Dont know what to do ahead. Printing in loop doesn't work
  
  ## TRY 4
  for child in root[0][1]:
      print(child.tag)
  ## Abstract tag is child of article-meta[0] which in turn is a child of main parent tag. Hence [0][1]
  ## This should ideally give abstract as one of its child - but it does not.
  </code></pre>
  
  <p>EDIT:
  I also a few nested tags with dynamic names. I want to extract the text between <p> tags Eg</p>
  
  <pre><code>&lt;body&gt;
      &lt;sec id="1"&gt;
        &lt;title&gt;1. Introduction&lt;/title&gt;
        &lt;p&gt;Technology diffusion plays a central role in the process of economic
      development.2 In contrast to the traditional growth framework, where technological
      change was left as an unexplained residual, the recent growth literature has
      highlighted the dependence of growth rates on the state of domestic technology
      relative to that of the rest of the world. Thus, growth rates in developing countries
      are, in part, explained by a ‘catch-up’ process in the level of technology. In a
      typical model of technology diffusion, the rate of economic growth of a backward
      country depends on the extent of adoption and implementation of new
      technologies that are already in use in leading countries.&lt;/p&gt;
  &lt;p&gt;The paper is divided into four sections. Section 2 presents a simple model to
  motivate our empirical investigation; Section 3 provides an account of the data
  used in the empirical analysis; Section 4 describes the regression results, and
  Section 5 presents some concluding remarks.&lt;/p&gt;
       &lt;/sec&gt;
   &lt;sec id="2"&gt;... &lt;/sec&gt;
  &lt;/body&gt;
  </code></pre>