I have a simplexml object which looks as below
<?xml version="1.0"?>
<SalesInvoices xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.unleashedsoftware.com/version/1">
<SalesInvoice>
<OrderNumber>100</OrderNumber>
</SalesInvoice>
<SalesInvoice>
<OrderNumber>101</OrderNumber>
</SalesInvoice>
</SalesInvoices>
I want to iterate through it and print only the order number. I use this script:
foreach ($xml->SalesInvoices->SalesInvoice as $salesinvoice) {
echo "hello";
echo $salesinvoice->OrderNumber;
}
When I do this I get no output from the loop at all, even the "hello" does not print. What am I doing wrong?