-
Notifications
You must be signed in to change notification settings - Fork 20
Nodes Load
Thomas Weinert edited this page Jul 29, 2014
·
3 revisions
FluentDOM\Nodes load(mixed $source [, string $contentType = 'text/xml']);
Load the provided source into the Nodes instance. The method can handle other FluentDOM\Nodes, DOMDocument and DOMNode instances directly and has default loaders for XML, HTML and Json.
The loaders are replaceable using [FluentDOM\Nodes::loaders()|Nodes-Loaders]. The constructor calls load() if a $source is provided. The $contentType is used to decide which loader is used.
$fd = new FluentDOM\Nodes();
$fd->load('<message>Hello World!</message>');
foreach ($fd->find('//message') as $message) {
echo $message->nodeValue;
}Hello World!
$json = '{ "message" : "Hello World!" }'; $fd = new FluentDOM\Nodes($json, 'text/json'); foreach ($fd->find('//message') as $message) { echo $message->nodeValue; }
Hello World!
- 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