Revision: 260
Author: azizatif
Date: Tue Dec 15 14:21:41 2009
Log: Simplified example on ProjectDescription wiki and added another form
of welcomed contribution.
http://code.google.com/p/fizzler/source/detail?r=260
Modified:
/wiki/ProjectDescription.wiki
=======================================
--- /wiki/ProjectDescription.wiki Fri May 8 06:44:44 2009
+++ /wiki/ProjectDescription.wiki Tue Dec 15 14:21:41 2009
@@ -6,34 +6,45 @@
Contributions are welcome in forms of:
- * Re-factoring
- * Improved tests
* Increased selector support
+ * Implementation over an HTML-like hierarchical document model
+ * Re-factorings
+ * Improved tests
==Examples==
-We have this HTML in a string variable called `html`:
-
{{{
-<html>
- <head></head>
- <body><div><p class="content">Fizzler</p><p>CSS Selector
Engine</p></div></body>
-</html>
-}}}
-
-{{{
-// load the document using HTMLAgilityPack as normal
-var htmlDocument = new HtmlDocument();
-htmlDocument.LoadHtml(html);
-
-// Fizzler for HtmlAgilityPack is implemented as an QuerySelectorAll
extension method to HtmlNode
-var documentNode = htmlDocument.DocumentNode;
-
-documentNode.QuerySelectorAll(".content"); // returns [<p
class="content">Fizzler</p>]
-documentNode.QuerySelectorAll("p"); // returns [<p
class="content">Fizzler</p><p>CSS Selector Engine</p>]
-documentNode.QuerySelectorAll("body>p") // returns empty collection
-documentNode.QuerySelectorAll("body p") // returns [<p
class="content">Fizzler</p><p>CSS Selector Engine</p>]
-documentNode.QuerySelectorAll("p:first-child") // returns [<p
class="content">Fizzler</p>]
+// Load the document using HTMLAgilityPack as normal
+var html = new HtmlDocument();
+html.LoadHtml(@"
+ <html>
+ <head></head>
+ <body>
+ <div>
+ <p class='content'>Fizzler</p>
+ <p>CSS Selector Engine</p></div>
+ </body>
+ </html>");
+
+// Fizzler for HtmlAgilityPack is implemented as the
+// QuerySelectorAll extension method on HtmlNode
+
+var document = htmlDocument.DocumentNode;
+
+// yields: [<p class="content">Fizzler</p>]
+document.QuerySelectorAll(".content");
+
+// yields: [<p class="content">Fizzler</p>,<p>CSS Selector Engine</p>]
+document.QuerySelectorAll("p");
+
+// yields empty sequence
+document.QuerySelectorAll("body>p");
+
+// yields [<p class="content">Fizzler</p>,<p>CSS Selector Engine</p>]
+document.QuerySelectorAll("body p");
+
+// yields [<p class="content">Fizzler</p>]
+document.QuerySelectorAll("p:first-child");
}}}
==Test Overview==