title: XPathSelectElement Giving NullReferenceException
body: <p>I have problem with properly using <code>XPathSelectElement</code>. I'm trying to find element in XML file by XPathSelectElement.</p>
  
  <pre><code>this.xdocument = XDocument.Parse (this.loadDialogues ());
  XElement element = this.xdocument.XPathSelectElement ("/dialogues/npc[@npcid='1']/conversation[@id='1']/message[@mid='1']/options/option[@oid='1']/text()");
  </code></pre>
  
  <p>It is giving me this error:</p>
  
  <blockquote>
    <p>NullReferenceException: Object reference not set to an instance of an object</p>
  </blockquote>
  
  <p>But when I run for ex. this query:</p>
  
  <pre><code>XElement element = this.xdocument.XPathSelectElement ("/dialogues/npc");
  </code></pre>
  
  <p>Everything is ok. Can anyone tell me what is wrong? I can't find anything about this error in that context.</p>
  
  <p>My XML example file:</p>
  
  <pre><code>&lt;dialogues&gt;
  &lt;!-- Greetings messages --&gt;
  &lt;greetings&gt;
      &lt;friendly&gt;
          &lt;text id="1"&gt;Witaj przybyszu! W czym mogę Ci pomóc?&lt;/text&gt;
          &lt;text id="2"&gt;Aniele, co Cię do mnie sprowadza?&lt;/text&gt;
          &lt;text id="3"&gt;Witaj przybyszu! Czy szukasz czegoś konkretnego?&lt;/text&gt;
      &lt;/friendly&gt;
      &lt;agressive&gt;
          &lt;text id="1"&gt;Czego chcesz? Nie mam ochoty rozmawiać więc się streszczaj.&lt;/text&gt;
          &lt;text id="2"&gt;Możesz mnie zostawić? To wszystko mnie przerasta...&lt;/text&gt;
      &lt;/agressive&gt;
  &lt;/greetings&gt;
  &lt;!-- Farewells --&gt;
  &lt;farewells&gt;
      &lt;friendly&gt;
          &lt;text id="1"&gt;Żegnaj&lt;/text&gt;
          &lt;text id="2"&gt;Dziękuję, żegnaj&lt;/text&gt;
          &lt;text id="3"&gt;Do zobaczenia&lt;/text&gt;
      &lt;/friendly&gt;
      &lt;agressive&gt;
          &lt;text id="1"&gt;***** z moich oczu, przybłędo&lt;/text&gt;
          &lt;text id="2"&gt;Odejdź stąd natychmiast, nie masz tu czego szukać&lt;/text&gt;
      &lt;/agressive&gt;
  &lt;/farewells&gt;
  &lt;!-- Monologs --&gt;
  &lt;monologs&gt;
      &lt;monolog id="1"&gt;
          &lt;text id="1"&gt;
              Monolog się rozpoczyna...
          &lt;/text&gt;
          &lt;text id="2"&gt;
              Monolog, część środkowa...
          &lt;/text&gt;
          &lt;text id="3"&gt;
              Monolog się kończy...
          &lt;/text&gt;
      &lt;/monolog&gt;
  &lt;/monologs&gt;
  &lt;!-- NPC --&gt;
  &lt;npc npcid="1"&gt; 
      &lt;conversation id="1"&gt;
          &lt;message mid="1" trigger="greetingRandom(friendly)"&gt;                
              &lt;options&gt;
                  &lt;option oid="1" nextmid="2"&gt;Tak, możesz mi powiedzieć gdzie znajdę Kaplicę?&lt;/option&gt;
                  &lt;option trigger="endConversationRandom(friendly)"&gt;&lt;/option&gt;
              &lt;/options&gt;
          &lt;/message&gt;
          &lt;message mid="2"&gt;
              &lt;text&gt;Musisz pójść prosto, u dołu tych schodów będzie strażnik. Powiedz mu, żę Cię przysyłam, wtedy nie powinien robić problemów.&lt;/text&gt;
              &lt;options&gt;
                  &lt;option oid="1" trigger="endConversation"&gt;Dziękuję, żegnaj.&lt;/option&gt;
              &lt;/options&gt;
          &lt;/message&gt;
      &lt;/conversation&gt;
  &lt;/npc&gt;
  </code></pre>
  
  <p></p>
  
  <p>//EDIT: Full error with more info</p>
  
  <pre><code>NullReferenceException: Object reference not set to an instance of an object
  System.Xml.Linq.XNodeNavigator.get_NodeType ()  
  System.Xml.XPath.NodeTypeTest.Match (IXmlNamespaceResolver nsm, System.Xml.XPath.XPathNavigator nav)  
  System.Xml.XPath.AxisIterator.MoveNextCore ()  
  System.Xml.XPath.BaseIterator.MoveNext ()  
  System.Xml.XPath.SimpleSlashIterator.MoveNextCore ()  
  System.Xml.XPath.BaseIterator.MoveNext ()  
  System.Xml.XPath.SlashIterator.MoveNextCore ()  
  System.Xml.XPath.BaseIterator.MoveNext ()  
  System.Xml.XPath.SortedIterator..ctor (System.Xml.XPath.BaseIterator iter)  
  System.Xml.XPath.ExprSLASH2.Evaluate (System.Xml.XPath.BaseIterator iter)  
  System.Xml.XPath.Expression.EvaluateNodeSet (System.Xml.XPath.BaseIterator iter)  
  System.Xml.XPath.CompiledExpression.EvaluateNodeSet (System.Xml.XPath.BaseIterator iter)  
  System.Xml.XPath.XPathNavigator.Select (System.Xml.XPath.XPathExpression expr, IXmlNamespaceResolver ctx)  
  System.Xml.XPath.XPathNavigator.Select (System.Xml.XPath.XPathExpression expr)  
  System.Xml.XPath.XPathNavigator.SelectSingleNode (System.Xml.XPath.XPathExpression expression)  
  System.Xml.XPath.XPathNavigator.SelectSingleNode (System.String xpath, IXmlNamespaceResolver nsResolver)  
  System.Xml.XPath.Extensions.XPathSelectElement (System.Xml.Linq.XNode node, System.String xpath, IXmlNamespaceResolver nsResolver)  
  System.Xml.XPath.Extensions.XPathSelectElement (System.Xml.Linq.XNode node, System.String xpath)  
  DialogueParser.getConversation (Int32 npcID, Int32 conversationID) (at Assets/Dedicated Assets/Scripts/Dialogue/DialogueParser.cs:38)  
  DialogueManager.Awake () (at Assets/Dedicated Assets/Scripts/Dialogue/DialogueManager.cs:33)
  </code></pre>