Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 7th, 2006, 09:45 AM
swayze
Guest
 
Posts: n/a
Default Complex Associative Array to XML FIle and Back

Hi there,

We're using php 4.1 and it doesn't seem to have built in support for
this. Coming from a dotnet background this surprised me...Anyways,
thats a different topic altogether...

I'm looking for a php class that can allow me to save a complex
associative array as an xml file on our server and also be able to read
in back into a complex array when needed. (you'll find an example of
the array below). Because of the complexity if the array, I feel it
would be easier to use this method as opposed to saving to a db.

I know i could write a class to do it, but I'm trying not to reinvent
the wheel. Googleing only refers me to extentions like pear which I
dont want. And I 'm sure someone else has had to do this before.

Any information or links would be greatly appreciated.

Kindest regards,

Swayze

//ARRAY EXAMPLE

Array
(
[0] => Array
(
[marka_id] => 4
[model_id] => 1
[model_yili] => 01/2004
[props] =>
5^4,11^1,52^3,5^4,6^2,7^2,11^1,52^3,65^5,5^4,6^2,7 ^2,11^1,25^2,52^3,65^5,82^7
[numerasi] => 41617042893
[adi] => Hood
[uretici] => BMW
[resim] => images/iconimages/60093.GIF
[parca_kodu] => 5130.000.0000.000.0
[adet] => 1
[fiyat] => 749.61
[main_subject_id] => 8
[labors] => Array
(
[0] => Array
(
[laborcode] => 21140.0009.02
[desc] => Hood - Replace
[time] => 1.80
[details] => Array
(
[0] => Array
(
[laborcode] =>
21140.0009.01
[desc] => Hood - Remove &
Reinstall
[time] => 0.8
)

[1] => Array
(
[laborcode] =>
21140.0021.01
[desc] => Emblem, Hood -
Remove & Reinstall
[time] => 0.10
)

[2] => Array
(
[laborcode] =>
21140.0023.01
[desc] => Isolating Trim,
Hood - Remove & Reinstall
[time] => 0.50
)

[3] => Array
(
[laborcode] =>
21140.0024.01
[desc] => Striker, Hood -
Remove & Reinstall
[time] => 0.20
)

[4] => Array
(
[laborcode] =>
21140.0002.01
[desc] => Front
Weatherstrip, Hood - Remove & Reinstall
[time] => 0.20
)

)

)

)

[paint_labors] => Array
(
[laborcode] => 21140.0009.06
[desc] => Hood - New part refinish
[time] => 2.30
[labor_cost] => 138.00
[material_cost] => 99.98
[paint_cost] => 115.80
)

[source] => mc
[repair_type] => replace
[labor_hour] => 60.00
[paint_hour] => 60.00
[colors] => 1
[stages] => 1
[repair_name] => Replace
)

)

  #2  
Old March 7th, 2006, 10:25 PM
Iván Sánchez Ortega
Guest
 
Posts: n/a
Default Re: Complex Associative Array to XML FIle and Back

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

swayze wrote:
[color=blue]
> I'm looking for a php class that can allow me to save a complex
> associative array as an xml file on our server and also be able to read
> in back into a complex array when needed. (you'll find an example of
> the array below). Because of the complexity if the array, I feel it
> would be easier to use this method as opposed to saving to a db.[/color]

Is there any reason for you to not to use serialize() and unserialize() ??

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

No hay nada mas activo que un rumor ocioso.
-- Anónimo.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEDf/s3jcQ2mg3Pc8RAq9SAJwJKYesmOJFz8LcFHwTSDtsGHZGKQCfU 8Pz
RM52BVwoQxrdtR2zsZa4Y5w=
=T5/c
-----END PGP SIGNATURE-----
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles