Recommend this page to a friend! |
Download .zip |
Info | View files (19) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2013-09-25 (3 years ago) | Not yet rated by the users | Total: 281 | All time: 7,147 This week: 900 |
Version | License | PHP version | Categories | |||
css-parser 1.0.0 | BSD License | 5.3 | HTML, XML, PHP 5, Parsers |
Description | Author | ||||||||||||||
This package can get HTML or XML document nodes matching a CSS selector. |
|
# cssparser Evaluates a CSS selector expression and filters nodes from a given DOMNode object. For example: ```php // loads an xml document $doc = new DOMDocument("1.0", "UTF-8"); $doc->load('test.xml'); // filters nodes $p = new CSSParser($doc, 'books item.sci-fi.horror[author_id ^= theodore][author_id $= sturgeon]'); $nodes = $p->parse(); // prints nodes foreach ($nodes as $node) { echo CSSHelper::dom2str($node) . "\n~~~\n"; } ``` ### Supported features #### Basic selectors: 1. [All Selector (“*”)](http://api.jquery.com/all-selector/) 2. [Class Selector (“.class”)](http://api.jquery.com/class-selector/) 3. [Element Selector (“element”)](http://api.jquery.com/element-selector/) 4. [ID Selector (“#id”)](http://api.jquery.com/id-selector/) 5. [Multiple Selector (“selector1, selector2, selectorN”)](http://api.jquery.com/multiple-selector/) #### Child filters: 1. [:first-child Selector](http://api.jquery.com/first-child-selector/) 2. [:nth-child() Selector](http://api.jquery.com/nth-child-selector/) #### Attribute filters: 1. [Attribute Contains Prefix Selector \[name|="value"\]](http://api.jquery.com/attribute-contains-prefix-selector/) 2. [Attribute Contains Selector \[name*="value"\]](http://api.jquery.com/attribute-contains-selector/) 3. [Attribute Contains Word Selector \[name~="value"\]](http://api.jquery.com/attribute-contains-word-selector/) 4. [Attribute Ends With Selector \[name$="value"\]](http://api.jquery.com/attribute-ends-with-selector/) 5. [Attribute Equals Selector \[name="value"\]](http://api.jquery.com/attribute-equals-selector/) 6. [Attribute Not Equal Selector \[name!="value"\]](http://api.jquery.com/attribute-not-equal-selector/) 7. [Attribute Starts With Selector \[name^="value"\]](http://api.jquery.com/attribute-starts-with-selector/) 8. [Has Attribute Selector \[name\]](http://api.jquery.com/has-attribute-selector/) 9. [Multiple Attribute Selector \[name="value"\]\[name2="value2"\]](http://api.jquery.com/multiple-attribute-selector/) |
Files | / | classes |
File | Role | Description | ||
---|---|---|---|---|
css-parser (5 files, 1 directory) | ||||
parser (2 files, 1 directory) |
Files | / | classes | / | css-parser |
File | Role | Description | ||
---|---|---|---|---|
filters (7 files) | ||||
css-element.php | Class | CSSElement class | ||
css-factor.php | Class | CSSFactor class | ||
css-helper.php | Class | Class source | ||
css-parser.php | Class | CSSParser class | ||
css-term.php | Class | CSSTerm class |
Files | / | classes | / | css-parser | / | filters |
File | Role | Description |
---|---|---|
css-attr-filter.php | Class | CSSAttrFilter class |
css-class-filter.php | Class | CSSClassFilter class |
css-filter.php | Class | CSSFilter class |
css-id-filter.php | Class | CSSIdFilter class |
css-pseudo-filter.php | Class | CSSPseudoFilter class |
css-pseudo-first-child-filter.php | Class | CSSPseudoFirstChild class |
css-pseudo-nth-child-filter.php | Class | CSSPseudoNthChildFilter class |
Files | / | classes | / | parser |
File | Role | Description | ||
---|---|---|---|---|
exceptions (1 file) | ||||
parser.php | Class | Parser class | ||
tokenizer.php | Class | Tokenizer class |
Files | / | classes | / | parser | / | exceptions |
File | Role | Description |
---|---|---|
parser-exception.php | Class | ParserException class |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.