Jump to content

I can't parse an XML file

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I've got an XML file with this structure
<dataXML version="1.0">
<RaceResults>
    <FixedUpgrades>0</FixedUpgrades>
    <Qualify>
        <DateTime>1289648667</DateTime>
        <Stream>
            <Score et="1337.0">xxxxxxxxxx(27) lap=2 point=2 t=-1.000 et=1336.913</Score>
            <Incident et="1386.8">xxxxxxxxxx(34) reported contact (0.03) with another vehicle xxxxxxxxxx(29)</Incident>
            <Score et="1433.3">xxxxxxxxxx(28) lap=11 point=2 t=67.916 et=1433.185</Score>
            <Incident et="1466.0">xxxxxxxxxx(33) reported contact (0.84) with Track</Incident>
            <Incident et="1466.0">xxxxxxxxxx(33) reported contact (0.58) with Track</Incident>
        </Stream>
    </Qualify>
    <Warmup>
        <DateTime>1289656481</DateTime>
        <Stream>
            <Score et="99.7">xxxxxxxxxx(49) lap=0 point=1 t=-1.000 et=99.614</Score>
        </Stream>
    </Warmup>
    <Race>
        <DateTime>1289657579</DateTime>
        <Stream>
            <Incident et="73.6">xxxxxxxxxx(42) reported contact (0.06) with another vehicle xxxxxxxxxx(37)</Incident>
            <Score et="1440.5">xxxxxxxxxx(32) lap=1 point=2 t=66.951 et=1440.365</Score>
            <Incident et="144.1">xxxxxxxxxx(40) reported contact (0.13) with another vehicle xxxxxxxxxx(37)</Incident>
            <Incident et="144.1">xxxxxxxxxx(37) reported contact (0.03) with another vehicle xxxxxxxxxx(40)</Incident>
        </Stream>
    </Race>
</RaceResults>
</dataXML>
I need to read all the <Incident> tags' values inside <race> tag and put those strings inside an array.

I'm new to XML parsing and reading around I've found some code which uses simpleXML, but I can't use it.

On my pc I was using PHP5.2.9 and it said that simpleXML class was missing, I've instaled PHP5.3.1 but I have the same problem.

What should I use to do what I need? It's important that the code will be compatible with PHP5.2.12

#2
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
What is the name of the Operating System currently running on your PC?

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#3
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
Windows XP Professional SP3

#4
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
Thats weird. Can you give me the exact error message you receive when running the script?

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#5
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I think I had some configuration problems on my XAMPP installation, I've uninstalled it and installed again, now it works.