Skip to content

Releases: veewee/xml

Version 2.12.0

23 Nov 13:33
2.12.0
78a4ba4
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.11.2...2.12.0

Version 2.11.2

12 Nov 18:08
2.11.2
e84f554
Compare
Choose a tag to compare

What's Changed

  • Revert "More stable node loading" by @veewee in #64

This commit reverts The more stable node loading from #61.
It turns out that this solution introduces some more problems.

It seems like a better idea to wait for a fix in PHP than to deal with these newer issues in this package.

Full Changelog: 2.11.1...2.11.2

Version 2.11.1

09 Nov 07:24
2.11.1
2331ce1
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.11.0...2.11.1

Version 2.11.0

05 Nov 14:34
2.11.0
c1978d9
Compare
Choose a tag to compare

What's Changed

  • Explain how the reader component works by @veewee in #59
  • Make namespace remover configurable by @veewee in #60

Full Changelog: 2.10.0...2.11.0

Version 2.10.0

03 Nov 07:07
2.10.0
43c8e0e
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.9.0...2.10.0

Version 2.9.0

01 Nov 18:16
2.9.0
8dda371
Compare
Choose a tag to compare

What's Changed

  • Introduce the nested() XML Reader matcher by @veewee in #56

Provide nested matchers that represents parts of an XML tree.
It can be used similar to the //user xpath operator to search on any matching node at any level in the XML

Given:

<root>
    <users>
        <user locale="nl">Jos</user>
        <user>Bos</user>
        <user>Mos</user>    
    </users>
</root>

This matcher will grab the user element with locale="nl"

use \VeeWee\Xml\Reader\Matcher;

Matcher\nested(
    // Breakpoint 1: <root />
    Matcher\document_element(),
    // Breakpoint 2: <user locale="nl">Jos</user>
    // Searches for all elements that matches `<user />` and attribute `locale="nl"` in the `<root />` document.
    // Note that you can skip matching on `<users />` here : it's not an exact matcher
    Matcher\all( 
        Matcher\element_name('user'),
        Matcher\attribute_value('locale', 'nl')
    )
);

Every provided matcher acts as a breakpoint in the NodeSequence for the next matcher,
making it composable with the exact XML tree sequence matcher as well.

use \VeeWee\Xml\Reader\Matcher;

Matcher\nested(
    // Breakpoint 1: <root />
    Matcher\document_element(),
    // Breakpoint 2: <user />
    // The nested matcher will provide the NodeSequence starting from the element after previous match.
    // The sequence will basically receive: 'users > user'
    Matcher\sequence( 
        // Level 0: The element inside <root /> at level 0 must exactly match <users /> 
        Matcher\element_name('users'),
        // Level 1: The element inside <root /> at level 1 must exactly match <user />
        Matcher\element_name('user'),
    ),
    // Breakpoint 3: <email />
    // After matching a sequence, you can still continue matching deeper or adding even more sequences:
    Matcher\element_name('email')
);

Full Changelog: 2.8.0...2.9.0

Version 2.8.0

30 Oct 12:40
2.8.0
a425c77
Compare
Choose a tag to compare

What's Changed

  • Provide better reader matchers by @veewee in #55

This release introduces a broad set of new and improved Reader matchers:

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

Version 2.7.0

20 Jul 08:13
2.7.0
b2dc9f0
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.6.0...2.7.0

Version 2.6.0

26 Jan 18:03
2.6.0
b34b0d6
Compare
Choose a tag to compare

What's Changed

  • Fix mutable nodeList reference during traversal by @veewee in #50

Full Changelog: 2.5.0...2.6.0

2.5.0

29 Dec 19:22
2.5.0
6123139
Compare
Choose a tag to compare

What's Changed

Add document_uri DOM configurator by @veewee in #48

Allows you to keep track of the document uri, even if you are using an in-memory string.
Internally, it sets DOMDocument::$documentURI, which gets used as file in the error handling issues component.

use VeeWee\Xml\Dom\Document;
use function VeeWee\Xml\Dom\Configurator\document_uri;

$wsdl = 'http://myservice.com?wsdl';
Document::fromXmlString(
    $loadFromHttp($wsdl),
    document_uri($wsdl)
);

Add 'expect*' shortcut functions to NodeList by @veewee in #47

Provides shortcut functions to the NodeList that allow you to grab a single element OR throw a customizable exception instead.

$item = $list->expectAt(0, 'Expected an element at index %s');
$item = $list->expectFirst('Expected a first element.');
$item = $list->expectSingle('Expected exactly 1 element, got %s');
$item = $list->expectLast('Expected an element at index %s');

Full Changelog: 2.4.0...2.5.0