title: parsing HTML in swift
body: <p>Can anyone help me out with this one:</p>
  
  <p>I have a HTTP page formatted this way:</p>
  
  <pre><code>&lt;ul class="ms-spbTree" id="_ul"&gt;
      &lt;li id="XXX\$username"&gt;Person0
          &lt;ul id="XXX\$username_ul"&gt;
              &lt;li id="XXX\$username"&gt;Person1
                  &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
              &lt;/li&gt;
              &lt;li id="XXX\$username"&gt;Person2
                  &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
              &lt;/li&gt;
              &lt;li id="XXX\$username"&gt;Person3
                  &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
              &lt;/li&gt;
              &lt;li id="XXX\$username"&gt;Person4
                  &lt;ul id="XXX\$username_ul"&gt;
                      &lt;li id="XXX\$username"&gt;Person5
                          &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li id="XXX\$username"&gt;Person6
                          &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li id="XXX\$username"&gt;Person7
                          &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
                      &lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li id="XXX\$username"&gt;Person8
                  &lt;ul id="XXX\$username_ul"&gt;&lt;/ul&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>My function is:</p>
  
  <pre><code>func loadTutorial(webString: NSString)
  {
      var data : NSData = webString.dataUsingEncoding(NSUTF8StringEncoding)!
  
      var tutorialsParser = TFHpple(HTMLData: data)
      var tutorialsXPathString = "//ul/li"
      var tutorialNodes = tutorialsParser.searchWithXPathQuery(tutorialsXPathString) as NSArray
      if(tutorialNodes.count == 0)
      {
          println("empty here")
      }
      else
      {
          for element in tutorialNodes
          {
              var elementTwo: TFHppleElement = element as TFHppleElement
           //   var tutorial = Tutorial()
              println("\(elementTwo.firstChild.content)")
  
         //     println(elementTwo.raw)
  
              let userscanner = NSScanner(string:elementTwo.raw)
              var userscanned: NSString?
  
              if userscanner.scanUpToString("li id=\"", intoString:nil){
                  userscanner.scanString("li id=\"", intoString:nil)
                  if userscanner.scanUpToString("\"&gt;", intoString:&amp;userscanned) {
                      let newResult: String = userscanned as String
  
                      println("NewResultValue: \(newResult)")
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>But what i get is the following list:</p>
  
  <pre><code>Person0
  Person1
  Person2
  Person3
  Person4
  Person5
  Person6
  Person7
  Person8
  </code></pre>
  
  <p>I only want to retrieve</p>
  
  <pre><code>Person0
  Person1
  Person2
  Person3
  Person4
  Person8
  </code></pre>
  
  <p>Or i list so i know that Person5,6 and 7 are having Person4 as manager.</p>
  
  <p>I tried with</p>
  
  <pre><code>var tutorialsXPathString = "//ul[not(contains(@style, 'style=\"display: none;\"'))/li"
  </code></pre>
  
  <p>Because all sub persons (5,6,7) have this in ther  tag, but it did not work :(</p>
  
  <p>Any help would be appreciated.</p>