Version 2.8.0
What's Changed
This release introduces a broad set of new and improved Reader matchers:
- all()
- any()
- attribute_local_name()
- attribute_local_value()
- attribute_name()
- attribute_value()
- document_element()
- element_local_name()
- element_name()
- element_position()
- namespaced_attribute()
- namespaced_attribute_value()
- namespaced_element()
- not()
- sequence()
Deprecates:
- node_attribute()
- node_name()
Example:
<root>
<users>
<user locale="nl">Jos</user>
<user>Bos</user>
<user locale="nl">Mos</user>
</users>
</root>
This matcher will grab the user
elements with locale="nl"
use VeeWee\Xml\Reader\Reader;
use \VeeWee\Xml\Reader\Matcher;
$matcher = Matcher\sequence(
// Level 0: <root />
Matcher\document_element(),
// Level 1: <users />
Matcher\element_name('users'),
// Level 2: <user locale="nl" />
Matcher\all(
Matcher\element_name('user'),
Matcher\attribute_value('locale', 'nl')
)
);
$matches = Reader::fromXmlFile($file)->provide($matcher);
Full Changelog: 2.7.0...2.8.0