PHP Classes
elePHPant
Icontem

Little Problem

Recommend this page to a friend!

      Clean XML To Array  >  All threads  >  Little Problem  >  (Un) Subscribe thread alerts  
Subject:Little Problem
Summary:Empty tags with attributes causing output array to go wrong.
Messages:4
Author:Andrew Johnson
Date:2007-11-29 15:00:20
Update:2007-12-03 11:18:35
 

  1. Little Problem   Reply   Report abuse  
Andrew Johnson - 2007-11-29 15:00:21
Nice work guys!

Everything great until today using the class with the XML pasted below...

LocationID tag is handled just fine, but the -ATTR parts of FloorPlan and PhotoImage tags go wrong :(

Any ideas? ... because I love the class and had no problems till we needed to use it for parsing this new XML!

...
<Detail>
<ChangeType>0</ChangeType>
<LocationID TimeStamp="29/11/2007 14:58" SequenceNo="9">3394</LocationID>
<PrimaryName>XXXXXX</PrimaryName>
<FloorPlan Floor="0" />
<FloorPlan Floor="1" />
<FloorPlan Floor="2" />
<FloorPlan Floor="3" />
<PhotoImage ImageType="1" />
<PhotoImage ImageType="2" />
<HouseTypeID>422</HouseTypeID>
<ShowHome>0</ShowHome>
<Description />
</Detail>
...

gives array like

[Detail] => Array
(
[0] => Array
(
[ChangeType] => 0
[LocationID] => 3394
[LocationID-ATTR] => Array
(
[TimeStamp] => 29/11/2007 14:58
[SequenceNo] => 9
)

[PrimaryName] => XXXXXX
[FloorPlan] => {{2}}
[FloorPlan-ATTR] => Array
(
[Floor] => 0
[4] => Array
(
[Floor] => 1
)

[5] => Array
(
[Floor] => 2
)

[6] => Array
(
[Floor] => 3
)

)

[PhotoImage] => {{2}}
[PhotoImage-ATTR] => Array
(
[ImageType] => 1
[8] => Array
(
[ImageType] => 2
)

)

[HouseTypeID] => 422
[ShowHome] => 0
[Description] => {{2}}
)
)

  2. Re: Little Problem   Reply   Report abuse  
Ivan Enderlin - 2007-12-02 20:11:49 - In reply to message 1 from Andrew Johnson
Hey :)

I will be direct with you. I don't maintain this class anymore, and I don't have enough time at this moment to work on.
I will try to look the problem in a close future (strange sentence hehe :P).

Sorry, and maybe, you should use SimpleXML with PHP 5, it's a better way to manipulate XML data :).

  3. Re: Little Problem   Reply   Report abuse  
Ivan Enderlin - 2007-12-02 20:14:30 - In reply to message 1 from Andrew Johnson
Hey :)

I will be direct with you. I don't maintain this class anymore, and I don't have enough time at this moment to work on.
I wil try to look the problem in a close future (strange sentence hehe :P).

Sorry, and if maybe, you should use SimpleXML with PHP 5, it's a better way to manipulate XML data :).

  4. Re: Little Problem   Reply   Report abuse  
Andrew Johnson - 2007-12-03 11:18:35 - In reply to message 3 from Ivan Enderlin
No problem. I understand exactly what "too little time" problem feels like.

Thanks for responding. Will look at SimpleXML, though server still runs PHP4 :(