Comments: on this page. Click to read or post your own.

Class CSSContentParser

Description

CSSContentParser enables parsing & assertion running of HTML content via CSS selectors.

It works by converting the content to XHTML using tidy, rewriting the CSS selectors as XPath queries, and executing those using SimpeXML.

It was built to facilitate testing using PHPUnit and contains a number of assert methods that will throw PHPUnit assertion exception when applicable.

Tries to use the PHP Tidy extension (http://php.net/tidy), and falls back to the "tidy" CLI tool. If none of those exists, the string is parsed directly without sanitization.

Located in /sapphire/dev/CSSContentParser.php (line 19)

Object
   |
   --CSSContentParser
Variable Summary
mixed $simpleXML
Method Summary
CSSContentParser __construct ( $content)
void getBySelector ( $selector)
void selector2xpath ( $selector)
Variables
Methods
Constructor __construct (line 22)
CSSContentParser __construct ( $content)
  • $content

Redefinition of:
Object::__construct()
getBySelector (line 57)

Returns a number of SimpleXML elements that match the given CSS selector.

Currently the selector engine only supports querying by tag, id, and classs

void getBySelector ( $selector)
  • $selector
selector2xpath (line 66)

Converts a CSS selector into an equivalent xpath expression.

Currently the selector engine only supports querying by tag, id, and classs

void selector2xpath ( $selector)
  • $selector

Inherited Methods

Inherited From Object

Object::__construct()
Object::addMethodsFrom()
Object::addStaticVars()
Object::addWrapperMethod()
Object::add_extension()
Object::allMethodNames()
Object::buildMethodList()
Object::cacheToFile()
Object::cacheToFileWithArgs()
Object::create()
Object::createMethod()
Object::defineMethods()
Object::exists()
Object::extend()
Object::extInstance()
Object::getCustomClass()
Object::hasExtension()
Object::hasMethod()
Object::invokeWithExtensions()
Object::is_a()
Object::loadCache()
Object::parentClass()
Object::sanitiseCachename()
Object::saveCache()
Object::set_stat()
Object::set_uninherited()
Object::stat()
Object::strong_create()
Object::uninherited()
Object::useCustomClass()
Object::__call()
Object::__toString()
blog comments powered by Disqus

Documentation generated on Sun, 19 Oct 2008 06:39:26 +1300 by phpDocumentor 1.3.2