So far I have this code wich I want to change to make this work. :<Invoice> <InvoiceHeader> <InvoiceType></InvoiceType> <InvoiceStatus></InvoiceStatus> <InvoiceNumber></InvoiceNumber> <InvoiceDate></InvoiceDate> <Supplier> <Name> </Name> <OrgNumber></OrgNumber> <VatId></VatId> </Supplier> </InvoiceHeader> <InvoiceDetails> <BaseItemDetails> <Description></Description> <PerQuantity></PerQuantity> <QuantityInvoiced></QuantityInvoiced> <UnitOfMeasure></UnitOfMeasure> <LineItemGrossAmount></LineItemGrossAmount> <LineItemAmount></LineItemAmount> <SuppliersProductId></SuppliersProductId> <UnitPrice></UnitPrice> <StartDate></StartDate> <EndDate></EndDate> </BaseItemDetails> <BaseItemDetails> ------------------- -------------------- ----------------- </BaseItemDetails> </InvoiceDetails> </Invoice>
How can i extract the <BaseItemDetails> for each record ? I Have no problem getting the data I need until I reach the multiple "simular" records. I can get the first "record" but clueless on how to get the next. Iv also managed to get all the <baseItemsDetails> printed out, but then i have no way of knowing wich record they belong to from the start. Wich is a big point. Whats the proper way to do this ? Do i need something different the xpath ? I`m pretty new to perl, so really any tips/advice is appriciated.foreach my $row ($xp->findnodes('Invoice')){ my $description= $row->find('InvoiceDetails/BaseItemDetails/Desc +ription')->string_value; ----------- ----------- print "$description "; }
In reply to Problems with multiple records in xml file , Xpath by joppei
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |