I'm in an internship in a start up and I really need some of your help, after looking and thinking about my problem i can't figure a solution on how to go through it. I want to translate a xml file into a php array so that i can insert my datas into a SQL Database. (this will allow us to control some things easily)
Here is what my xml looks like:
 <?xml version="1.0" encoding="UTF-8"?>
<a att1="aa" att2="ab" att3="ac" att8="ad">
    <b>value</b>
    <c>
       <d>value</d>
       <d>value</d>
    </c>
    <e>value</e>
    <f att1="ae" att2="af">value</f>
    <f att1="ag">value</f>
    <g att1="ah" att5="ai">
        <h att1="aj">
           <i>value</i>
           <j>value</j>
        </h>
        <k att1="ak">value</k>
        <l att1="al">value</l>
        <m att1="am">value</m>
        <n att1="an">value</n>
    </g>
    <o att1="ao" att5="ap">
        <h att1="aq">
           <i>value</i>
           <j>value</j>
        </h>
        <k att1="ar">value</k>
        <l att1="as">value</l>
        <m att1="at">value</m>
        <n att1="au">value</n>
    </o>
    <p>
        <q att1="av">value</q>
        <r att1="aw">value</r>
        <s att1="ax">value</s>
        <t att1="ay">value</t>
    </p>
    <u>
        <v>value</v>
    </u>
    <w>value</w>
I tried a lot of ways i found on the web, but so far the most efficient was
$xml = file_get_contents($fileName);
$ob = simplexml_load_string($xml);
$json = json_encode($ob);
$configData = json_decode($json, true);
... and here i treat my php array
The problem of this code and of all those i found on stack overflow (the answers from Parsing Huge XML Files for example)is that a lot of the attributes are lost during the process and so i can't have a ll the informations we need in the database.
If someone have an idea on how to keep all the attributes and transform this looks a like xml into a usable array i ask on my knee for him to help me, because i'm really getting mad on this :o
Thanks in advance!
