mercredi 1 décembre 2021

How can I get values from XML array [closed]

enter image description here

I have this dropdown option, after choosing an option I have to fetch the values from the XML file. Suppose if I choose "Products > Product > LongDescription" then fetch all the values of "LongDescription" from the XML file like following

array (
   0=>'Don't forget me this weekend!',
   1=>null,
   2=>null,
   3=>'Test description'
)

XML File

<?xml version="1.0" encoding="UTF-8"?>
<Products>
  <Product>
    <SKU>RR02</SKU>
    <Name>Samsung Cable for QLED TVs, 15m</Name>
    <ShortDescription></ShortDescription>
    <LongDescription>Don't forget me this weekend!</LongDescription>
    <Quantity>10</Quantity>
    <BuyPrice>8</BuyPrice>
    <Price>10</Price>
    <SalePrice>9</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-000249</SKU>
    <Name>71T6550</Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-1</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-2</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>3</Quantity>
    <BuyPrice>15</BuyPrice>
    <Price>20</Price>
    <SalePrice>18</SalePrice>
  </Product>
</Products>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire