-
Notifications
You must be signed in to change notification settings - Fork 20
Backwards Compatibility
The minimum required PHP version now is 7.0. HHVM is not supported any more. Scalar type hints and return types were added.
Moved the extended DOM classes into the FluentDOM\DOM
namespace.
(FluentDOM\Document
-> FluentDOM\DOM\Document
). FluentDOM\Nodes\Creator
was moved
to FluentDOM\Creator
. Several internal classes were moved into a FluentDOM\Utiltity
namespace.
FluentDOM\Query::get()
now return a DOMNode
is the position was provided, not an array
any more.
FluentDOM\DOM\Element::find()
was removed, use FluentDOM($element)->find()
.
The minimum required PHP version now is 5.6.
FluentDOM\Query
now parses fragment arguments depending on the
content type. It uses the loaders to parse the fragments for methods like
FluentDOM\Query::append()
. To parse the fragments as XML change the content type
after loading.
$fd = FluentDOM($content, 'type/some-type');
$fd->contentType = 'text/xml';
FluentDOM\Query::attr()
, FluentDOM\Query::css()
and FluentDOM\Query::data()
now recognize that the second argument is provided, even if it is NULL.
Serializer factories can now be registered on the FluentDOM class. Loaders implement
an additional method to parse a fragment. This allows the FluentDOM\Nodes() class
to keep the content type used to load a source. Methods like append()
now parse
a string as a fragment of the current content type. Casting the FluentDOM\Nodes()
instance to a string serializes it to the current content type.
$fd = FluentDOM('{"firstName": "John"}', 'text/json');
echo $fd->find('/*')->append('{"lastName": "Smith"}');
/*
{"firstName":"John","lastName":"Smith"}
*/
To get the previous behaviour you will have to change the content type to 'text/xml' after loading a source.
$fd = FluentDOM('{"firstName": "John"}', 'text/json');
$fd->contentType = 'text/xml';
echo $fd->find('/*')->append('<lastName>Smith</lastName>');
/*
<json:json xmlns:json="urn:carica-json-dom.2013">
<firstName>John</firstName>
<lastName>Smith</lastName>
</json:json>
*/
Loaders have an additional method loadFragment(). Serializers are now expected to be able to serialize a node (not only a document).
You will now have to explicitly allow loaders to load a file.
$fd = FluentDOM('...', '...', [FluentDOM\Loader\Options::ALLOW_FILE => TRUE]);
$fd = FluentDOM('...', '...', [FluentDOM\Loader\Options::IS_FILE => TRUE]);
CSS Selectors are now provided by separate packages. If you like to use them you will need to require the connector package now.
The FluentDOM\Loadable::load()
method now has a third argument $options. The
FluentDOM\Nodes method and the FluentDOM function that load data sources got this
argument, too. It allows to specify additional, loader specific options. The
values are only used inside the loader. This change affects the implementation of
loaders, but not the use.
Version 5 is a major rewrite. It now uses php namespaces. The original FluentDOM
classes (FluentDOM
, FluentDOMCore
and FluentDOMStyle
) are merged into the new
FluentDOM\Query
class.
The old loaders are gone and replaced with the new FluentDOM\Loadable interface.
The registerNamespaces() method was replaced with a registerNamespace() method, having the same arguments like DOMXpath::registerNamespace().
- 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