title: Get first lines of Wikipedia Article
body: <p><strong>I got a Wikipedia-Article and I want to fetch the first z lines (or the first x chars, or the first y words, doesn't matter) from the article.</strong> </p>
  
  <p>The problem: I can get either the source Wiki-Text (via API) or the parsed HTML (via direct HTTP-Request, eventually on the print-version) but how can I find the first lines displayed? Normaly the source (both html and wikitext) starts with the info-boxes and images and the first real text to display is somewhere down in the code.</p>
  
  <p>For example:
  <a href="http://en.wikipedia.org/w/index.php?title=Albert_Einstein&amp;printable=yes" rel="noreferrer">Albert Einstein on Wikipedia</a> (print Version). Look in the code, the first real-text-line <em>"Albert Einstein (pronounced /ˈælbərt ˈaɪnstaɪn/; German: [ˈalbɐt ˈaɪ̯nʃtaɪ̯n]; 14 March 1879–18 April 1955) was a theoretical physicist."</em> is not on the start. The same applies to the <a href="http://en.wikipedia.org/w/index.php?title=Albert_Einstein&amp;action=edit" rel="noreferrer">Wiki-Source</a>, it starts with the same info-box and so on.</p>
  
  <p><strong>So how would you accomplish this task? Programming language is java, but this shouldn't matter.</strong></p>
  
  <p><em>A solution which came to my mind was to use an xpath query but this query would be rather complicated to handle all the border-cases. [update]It wasn't that complicated, see my solution below![/update]</em></p>
  
  <p>Thanks!</p>