title: Ignore Whitespace when working with SelectSingleNode and Xpath
body: <p>Let's assume we have the following <code>xml</code> file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;bookstore&gt;
    &lt;book genre="novel" publicationdate="1997" ISBN="1-861001-57-8"&gt;
      &lt;title&gt;Pride And Prejudice&lt;/title&gt;
      &lt;author&gt;
        &lt;first-name&gt;Jane&lt;/first-name&gt;
        &lt;last-name&gt;Austen&lt;/last-name&gt;
      &lt;/author&gt;
      &lt;price&gt;24.95&lt;/price&gt;
    &lt;/book&gt;
    &lt;book genre="textbook" publicationdate="2013" ISBN="1-861002-30-1"&gt;
      &lt;title&gt;Head First C#&lt;/title&gt;
      &lt;author&gt;
        &lt;first-name&gt;Jennifer&lt;/first-name&gt;
        &lt;last-name&gt;Greene&lt;/last-name&gt;
      &lt;/author&gt;
      &lt;price&gt;29.95&lt;/price&gt;
    &lt;/book&gt;
  &lt;/bookstore&gt;
  </code></pre>
  
  <p>I want to check if the element <code>book</code> with the attribute <code>genre="novel"</code> exist and if not add it.</p>
  
  <p>I've written the following code and it works beautifully. However, if someone edits the xml file and accidentally places an extra space between the word "novel" and the double quotes, <code>genre=" novel "</code>, or let's say I'm an idiot and added the extra space when creating the attribute's value the xpath won't be valid any more and the code will add a node when one already exists. Is there a way to use <code>SelectSingleNode</code> in a way that it will ignore whitespace?</p>
  
  <pre><code>XmlDocument doc = new XmlDocument();
  doc.Load(@"C:\Users\anonymous\Documents\file.xml");
  
  string xpath = @"/bookstore/book [@genre='novel']";
  var rootNode = doc.SelectSingleNode(@"/bookstore");
  var bookNode = doc.SelectSingleNode(xpath);
  
  if (bookNode == null)
  {
    XmlNode newNode = doc.CreateElement("book");
    XmlAttribute genreAttribute = doc.CreateAttribute("genre");
    genreAttribute.Value = @"novel";
    newNode.Attributes.Append(genreAttribute);
    rootNode.AppendChild(newNode);
  }
  doc.Save(@"C:\Users\anonymous\Documents\file.xml");
  </code></pre>