Get the first list of tags for the first productWhat do “branch”, “tag” and “trunk” mean in Subversion repositories?What is the difference between HTML tags <div> and <span>?jQuery autocomplete tagging plug-in like StackOverflow's input tags?Get first key in a (possibly) associative array?How do I get PHP errors to display?Get the first element of an arrayHow do I get a YouTube video thumbnail from the YouTube API?How do I comment out a block of tags in XML?How to get the client IP address in PHPGet the full URL in PHP

Why did Windows 95 crash the whole system but newer Windows only crashed programs?

What is the German equivalent of the proverb 水清ければ魚棲まず (if the water is clear, fish won't live there)?

Complexity of verifying optimality in (mixed) integer programming

Does dual boot harm a laptop battery or reduce its life?

Can I attune a Circlet of Human Perfection to my animated skeletons to allow them to blend in and speak?

In syntax, why cannot we say things like "he took walked at the park"? but can say "he took a walk at the park"?

Just how much information should you share with a former client?

Is there a word to describe someone who is, or the state of being, content with hanging around others without interacting with them?

Can a US President, after impeachment and removal, be re-elected or re-appointed?

Alternatives to minimizing loss in regression

Summoning A Technology Based Demon

Would people understand me speaking German all over Europe?

Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?

Why was the LRV's speed gauge displaying metric units?

Who said "one can be a powerful king with a very small sceptre"?

Is The Venice Syndrome documentary cover photo real?

What force enables us to walk? Friction or normal reaction?

How should I quote American English speakers in a British English essay?

8086 stack segment and avoiding overflow in interrupts

How does a poisoned arrow combine with the spell Conjure Barrage?

Why does the Eurostar not show youth pricing?

How did astronauts using rovers tell direction without compasses on the Moon?

What clothes would flying-people wear?

How can I kill my goat?



Get the first list of tags for the first product


What do “branch”, “tag” and “trunk” mean in Subversion repositories?What is the difference between HTML tags <div> and <span>?jQuery autocomplete tagging plug-in like StackOverflow's input tags?Get first key in a (possibly) associative array?How do I get PHP errors to display?Get the first element of an arrayHow do I get a YouTube video thumbnail from the YouTube API?How do I comment out a block of tags in XML?How to get the client IP address in PHPGet the full URL in PHP






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















sorry for my bad english
I have no idea how to explain it, go I run.
for a drop-down list in html I must recover only the list of tags of the first product.



if you have an idea or a tip
sorry for my bad english



XML file



<?xml version='1.0' encoding='utf-8'?>
<catalogue lang='french' date='24/03/2019'>
<produit num='0'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[2XL]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[4]]></attributs_stock_qty><stock_ean><![CDATA[8031503033662]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0050]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>
<produit num='1'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[S]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[6]]></attributs_stock_qty><stock_ean><![CDATA[8031503033624]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0010]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>


php code



$file = "file.xml";
function debutElement($parser, $name, $attrs)

if (!empty($name))
echo "<br>".$name; //liste des balises



function finElement($parser, $name)


$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "debutElement", "finElement");
if (!($fp = fopen($file, "r")))
die("Impossible d'ouvrir le fichier XML");

while ($data = fread($fp, 4096))
if (!xml_parse($xml_parser, $data, feof($fp)))
die(sprintf("erreur XML : %s à la ligne %d", xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));


xml_parser_free($xml_parser);


what I get back



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


What I want to recover, so just the tags of the first product



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


thanks in advance










share|improve this question
























  • Is this a large XML file? Could you use something like SimpleXML instead?

    – Nigel Ren
    Mar 27 at 10:59











  • yes I use large files, and often different never the same kind of XML files, yes it does not bother me to use other methods as long as I find a solution

    – Akim Prestatic
    Mar 27 at 11:12











  • OK - A couple of ideas, keep a list of the unique tag names in the file or when you come to the end of the tag covering the first product, then stop processing the file.

    – Nigel Ren
    Mar 27 at 11:20











  • ok thanks i'll try your idea

    – Akim Prestatic
    Mar 27 at 11:34

















0















sorry for my bad english
I have no idea how to explain it, go I run.
for a drop-down list in html I must recover only the list of tags of the first product.



if you have an idea or a tip
sorry for my bad english



XML file



<?xml version='1.0' encoding='utf-8'?>
<catalogue lang='french' date='24/03/2019'>
<produit num='0'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[2XL]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[4]]></attributs_stock_qty><stock_ean><![CDATA[8031503033662]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0050]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>
<produit num='1'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[S]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[6]]></attributs_stock_qty><stock_ean><![CDATA[8031503033624]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0010]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>


php code



$file = "file.xml";
function debutElement($parser, $name, $attrs)

if (!empty($name))
echo "<br>".$name; //liste des balises



function finElement($parser, $name)


$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "debutElement", "finElement");
if (!($fp = fopen($file, "r")))
die("Impossible d'ouvrir le fichier XML");

while ($data = fread($fp, 4096))
if (!xml_parse($xml_parser, $data, feof($fp)))
die(sprintf("erreur XML : %s à la ligne %d", xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));


xml_parser_free($xml_parser);


what I get back



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


What I want to recover, so just the tags of the first product



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


thanks in advance










share|improve this question
























  • Is this a large XML file? Could you use something like SimpleXML instead?

    – Nigel Ren
    Mar 27 at 10:59











  • yes I use large files, and often different never the same kind of XML files, yes it does not bother me to use other methods as long as I find a solution

    – Akim Prestatic
    Mar 27 at 11:12











  • OK - A couple of ideas, keep a list of the unique tag names in the file or when you come to the end of the tag covering the first product, then stop processing the file.

    – Nigel Ren
    Mar 27 at 11:20











  • ok thanks i'll try your idea

    – Akim Prestatic
    Mar 27 at 11:34













0












0








0








sorry for my bad english
I have no idea how to explain it, go I run.
for a drop-down list in html I must recover only the list of tags of the first product.



if you have an idea or a tip
sorry for my bad english



XML file



<?xml version='1.0' encoding='utf-8'?>
<catalogue lang='french' date='24/03/2019'>
<produit num='0'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[2XL]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[4]]></attributs_stock_qty><stock_ean><![CDATA[8031503033662]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0050]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>
<produit num='1'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[S]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[6]]></attributs_stock_qty><stock_ean><![CDATA[8031503033624]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0010]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>


php code



$file = "file.xml";
function debutElement($parser, $name, $attrs)

if (!empty($name))
echo "<br>".$name; //liste des balises



function finElement($parser, $name)


$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "debutElement", "finElement");
if (!($fp = fopen($file, "r")))
die("Impossible d'ouvrir le fichier XML");

while ($data = fread($fp, 4096))
if (!xml_parse($xml_parser, $data, feof($fp)))
die(sprintf("erreur XML : %s à la ligne %d", xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));


xml_parser_free($xml_parser);


what I get back



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


What I want to recover, so just the tags of the first product



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


thanks in advance










share|improve this question














sorry for my bad english
I have no idea how to explain it, go I run.
for a drop-down list in html I must recover only the list of tags of the first product.



if you have an idea or a tip
sorry for my bad english



XML file



<?xml version='1.0' encoding='utf-8'?>
<catalogue lang='french' date='24/03/2019'>
<produit num='0'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[2XL]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[4]]></attributs_stock_qty><stock_ean><![CDATA[8031503033662]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0050]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>
<produit num='1'>
<categorie><![CDATA[Boxers & Shorties]]></categorie>
<marque><![CDATA[Navigare]]></marque>
<collection><![CDATA[]]></collection>
<model><![CDATA[573E]]></model>
<product_id><![CDATA[3818]]></product_id>
<designation><![CDATA[Boxer 573E]]></designation>
<description><![CDATA[Navigare ref.573E -
Boxer homme 573E de la marque Navigare
ligne permanente
composition: Jersey/Coton/Elasthanne]]></description>
<attributs>
<option_1><![CDATA[Couleur boxer]]></option_1><value_1><![CDATA[blanc]]></value_1><attributs_prefix_1><![CDATA[]]></attributs_prefix_1><attributs_price_1_ht><![CDATA[]]></attributs_price_1_ht><option_2><![CDATA[Taille boxer]]></option_2><value_2><![CDATA[S]]></value_2><attributs_prefix_2><![CDATA[]]></attributs_prefix_2><attributs_price_2_ht><![CDATA[]]></attributs_price_2_ht><attributs_stock_qty><![CDATA[6]]></attributs_stock_qty><stock_ean><![CDATA[8031503033624]]></stock_ean><stock_gescom><![CDATA[573E000BLANC0010]]></stock_gescom></attributs>
<livraison_ht>5.76</livraison_ht>
<prix_achat_ht>5.3</prix_achat_ht>
<prix_public_conseille_ht>10.42</prix_public_conseille_ht>
<promo>non</promo>
<prix_promo_ht>0</prix_promo_ht><url><![CDATA[/catalogue/product_info.php?products_id=3818]]></url><img><![CDATA[navigare/573E_defaut.jpg]]></img><poids><![CDATA[0.15]]></poids><unite><![CDATA[KG]]></unite></produit>


php code



$file = "file.xml";
function debutElement($parser, $name, $attrs)

if (!empty($name))
echo "<br>".$name; //liste des balises



function finElement($parser, $name)


$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "debutElement", "finElement");
if (!($fp = fopen($file, "r")))
die("Impossible d'ouvrir le fichier XML");

while ($data = fread($fp, 4096))
if (!xml_parse($xml_parser, $data, feof($fp)))
die(sprintf("erreur XML : %s à la ligne %d", xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));


xml_parser_free($xml_parser);


what I get back



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


What I want to recover, so just the tags of the first product



CATALOGUE
PRODUIT
CATEGORIE
MARQUE
COLLECTION
MODEL
PRODUCT_ID
DESIGNATION
DESCRIPTION
ATTRIBUTS
OPTION_1
VALUE_1
ATTRIBUTS_PREFIX_1
ATTRIBUTS_PRICE_1_HT
OPTION_2
VALUE_2
ATTRIBUTS_PREFIX_2
ATTRIBUTS_PRICE_2_HT
ATTRIBUTS_STOCK_QTY
STOCK_EAN
STOCK_GESCOM
LIVRAISON_HT
PRIX_ACHAT_HT
PRIX_PUBLIC_CONSEILLE_HT
PROMO
PRIX_PROMO_HT
URL
IMG
POIDS
UNITE


thanks in advance







php xml tags






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 20:27









Akim PrestaticAkim Prestatic

187 bronze badges




187 bronze badges















  • Is this a large XML file? Could you use something like SimpleXML instead?

    – Nigel Ren
    Mar 27 at 10:59











  • yes I use large files, and often different never the same kind of XML files, yes it does not bother me to use other methods as long as I find a solution

    – Akim Prestatic
    Mar 27 at 11:12











  • OK - A couple of ideas, keep a list of the unique tag names in the file or when you come to the end of the tag covering the first product, then stop processing the file.

    – Nigel Ren
    Mar 27 at 11:20











  • ok thanks i'll try your idea

    – Akim Prestatic
    Mar 27 at 11:34

















  • Is this a large XML file? Could you use something like SimpleXML instead?

    – Nigel Ren
    Mar 27 at 10:59











  • yes I use large files, and often different never the same kind of XML files, yes it does not bother me to use other methods as long as I find a solution

    – Akim Prestatic
    Mar 27 at 11:12











  • OK - A couple of ideas, keep a list of the unique tag names in the file or when you come to the end of the tag covering the first product, then stop processing the file.

    – Nigel Ren
    Mar 27 at 11:20











  • ok thanks i'll try your idea

    – Akim Prestatic
    Mar 27 at 11:34
















Is this a large XML file? Could you use something like SimpleXML instead?

– Nigel Ren
Mar 27 at 10:59





Is this a large XML file? Could you use something like SimpleXML instead?

– Nigel Ren
Mar 27 at 10:59













yes I use large files, and often different never the same kind of XML files, yes it does not bother me to use other methods as long as I find a solution

– Akim Prestatic
Mar 27 at 11:12





yes I use large files, and often different never the same kind of XML files, yes it does not bother me to use other methods as long as I find a solution

– Akim Prestatic
Mar 27 at 11:12













OK - A couple of ideas, keep a list of the unique tag names in the file or when you come to the end of the tag covering the first product, then stop processing the file.

– Nigel Ren
Mar 27 at 11:20





OK - A couple of ideas, keep a list of the unique tag names in the file or when you come to the end of the tag covering the first product, then stop processing the file.

– Nigel Ren
Mar 27 at 11:20













ok thanks i'll try your idea

– Akim Prestatic
Mar 27 at 11:34





ok thanks i'll try your idea

– Akim Prestatic
Mar 27 at 11:34












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365694%2fget-the-first-list-of-tags-for-the-first-product%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365694%2fget-the-first-list-of-tags-for-the-first-product%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현