jeudi 26 novembre 2015

Issues importing XML with Laravel Package orchestral/parser

I have this XML that i'm trying to import:

    <products>
<product product_id="62" title="Product Title" description="<p>desc</p>" price="40" brand="" weight="100" in_stock="Y"/>
<product product_id="63" title="Product Title" description="<p>desc</p>" price="40" brand="" weight="100" in_stock="Y"/>
</products>

I'm using Laravel 5 and this package: http://ift.tt/1KBdWon

So i'm running this code:

    $xml = XmlParser::load('http://ift.tt/1OtIkWc');


    $product = $xml->parse([
    'product_id' => ['uses' => 'product::product_id'],
    'title' => ['uses' => 'product::title'],
    'description' => ['uses' => 'product::description'],
]);
    dd($product);

But it's just returning a single product in an array which isn't even the first or last one in the XML. So i'm a bit confused.

Anyone got any ideas?

Thanks.



via Chebli Mohamed

1 commentaire: