-
Notifications
You must be signed in to change notification settings - Fork 20
Functions
FluentDOM provides several functions that act as shortcuts to access logic. These are static calls, so they introduce hard dependencies into your source, but they can be really convenient.
Most of them are static functions on the abstract class FluentDOM
.
This function return a FluentDOM\Query instance. You can provide a source an a content type as arguments.
// global function
$fd = FluentDOM('<xml/>', 'xml');
// static function
$fd = FluentDOM::Query('<xml/>', 'xml');
// creating an instance
$fd = new FluentDOM\Query('<xml/>', 'xml');
Basically the same as FluentDOM::Query()
. But it sets callback that is used to transform the provided selector arguments from CSS to XPath. You need to have a transformation library installed.
(FluentDOM >= 5.1)
Returns an instance of FluentDOM\Nodes\Creator
. The arguments are optional.
// static call
$_ = FluentDOM::create('1.0', 'utf-8');
// creating an instance
$_ = new FluentDOM\Nodes\Creator('1.0', 'utf-8');
(FluentDOM >= 5.2)
Returns a FluentDOM\DOM\Document() instance. This uses the loaders, so you can load formats like JSON, too. FluentDOM::setLoader()
even allows you to define a specific loader if really necessary.
// static call
$document = FluentDOM::load($json, 'json');
// creating an instance
$loader = new FluentDOM\Loader\Json();
$document = $loader->load($json, 'json');
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces