Skip to content

v1.3.0

Compare
Choose a tag to compare
@veewee veewee released this 11 Feb 07:07
v1.3.0
9c4e8c1

What's Changed

Examples

Use-case of above 2 features: You want to search for some data in SOAP, but decode it as an array afterwards - without any namespace info or prefix:

use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Dom\Traverser\Visitor\RemoveNamespaces;
use function VeeWee\Xml\Dom\Configurator\traverse;
use function VeeWee\Xml\Encoding\element_decode;

$doc = Document::fromXmlString(<<<EOXML
<?xml version="1.0"?>

<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

    <soap:Body xmlns:m="http://www.example.org/stock">
        <m:GetStockPrice>
            <m:StockName>IBM</m:StockName>
        </m:GetStockPrice>
    </soap:Body>

</soap:Envelope>
EOXML
);

$method = $doc->xpath()->querySingle('//soap:Body')->firstElementChild;

var_dump(element_decode($method, traverse(new RemoveNamespaces())));
array(1) {
  'GetStockPrice' =>
  array(1) {
    'StockName' =>
    string(3) "IBM"
  }
}

Full Changelog: v1.2.0...v1.3.0