Complex Associative Array to XML FIle and Back

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • swayze

    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.0 00.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
    )

    )

  • Iván Sánchez Ortega

    #2
    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/s3jcQ2mg3Pc8RAq 9SAJwJKYesmOJFz 8LcFHwTSDtsGHZG KQCfU8Pz
    RM52BVwoQxrdtR2 zsZa4Y5w=
    =T5/c
    -----END PGP SIGNATURE-----

    Comment

    Working...