0

so I have a XML invoice and I want to access the data in it and I am absolutely clueless on how to do it. I tried following various guides online and nothing works, I get zero errors but zero results.

How can I get data from "inv:invoiceType" tag of this xml file? Thanks!

The XML is this:

<?xml version="1.0" encoding="UTF-8"?>
<dat:dataPack id="fa001" application="StwTest" version="2.0" note="Import" xmlns:dat="http://www.stormware.cz/schema/version_2/data.xsd" xmlns:inv="http://www.stormware.cz/schema/version_2/invoice.xsd" xmlns:typ="http://www.stormware.cz/schema/version_2/type.xsd">

<dat:dataPackItem id="20007" version="2.0">
    <inv:invoice version="2.0">
        <inv:invoiceHeader>
            <inv:invoiceType>issuedInvoice</inv:invoiceType>
            <inv:number>
              <typ:numberRequested>20007</typ:numberRequested>
            </inv:number>
            <inv:paymentType>
              <typ:paymentType>draft</typ:paymentType>
            </inv:paymentType>
            <inv:carrier>
            <typ:ids>magic horse</typ:ids>
            </inv:carrier>
            <inv:numberOrder>20007</inv:numberOrder>
            <inv:symVar>20007</inv:symVar>
            <inv:date>2020-05-11</inv:date>
            <inv:dateTax>2020-05-13</inv:dateTax>
            <inv:dateDue>2020-05-27</inv:dateDue>
        </inv:invoiceHeader>                
    </inv:invoice>
</dat:dataPackItem>

</dat:dataPack>

1 Answers1

0

try using SimpleXML if you are not using it. you can follow this document : Basic SimpleXML usage

Ali Afine
  • 67
  • 3