PHP CSS Selector

Yo.
Since there's no easiest way of parsing HTML than using css rules ( Xpath is fine too, and it's native ), i implemented Mootools selectors in PHP.For now, i am not specially aiming for perfs, nor complete feature. I just wanted to port a great piece of work on another language. Source on svn http://svn.exyks.org/
<html>
<head>
<meta http-equiv="Content-Type" content=" text/html; charset=utf-8"/>
<title>This is a very basic page</title>
</head>
<body>

<div id="container">
    <div id="header">
        <img src="mylogo.png" id="logo"/>
    </div>

    <div id="contents" class="box anotherclass">
        <h2>This page is cool</h2>
        <p>This page should be XHTML valid because : </p>
        <ul>
            <li class="box">It respects standarts</li>
            <li>It's written  by me</li>
            <li>It's simple</li>
        </ul>
    </div>

<p>This is <i>a test <u>of serialisation</u> for <code>$this-&gt;get("text")</code></i>, another node</p>

</div>

</body>
</html>

Motivation

<?
$url_file = http://selectors.svn.exyks.org/file.htm
$doc = simplexml_load_file($url_file, "Element");
$second_reason = $doc->getElement(".box+li");
?>

Use

Result : 1 elements :
<li>It's written by me</li>
=========

Test

Rule Assert Result Status
body 1 1 pass
html body 1 1 pass
html body body 0 0 pass
html body div 3 3 pass
html>body>div 1 1 pass
html>div 0 0 pass
html#container 0 0 pass
#container 1 1 pass
div#header li 0 0 pass
.box 2 2 pass
.box.anotherclass 1 1 pass
*[content*=" text/html; "] 1 1 pass
li~li 2 2 pass
.box+li 1 1 pass
li:first-child 1 1 pass
li:last-child 1 1 pass
li:odd 1 1 pass
li:even 2 2 pass
li:not(.box) 2 2 pass