473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
)

)

Mar 7 '06 #1
1 4106
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

swayze wrote:
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.


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-----
Mar 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Abdullah Kauchali | last post by:
Hi folks, Can one rely on the order of keys inserted into an associative Javascript array? For example: var o = new Object(); o = "Adam"; o = "Eve";
2
by: Zenobia | last post by:
I have a problem. I need to look up several values stored in arrays. Each value is stored as a pair. The first (number) represents the probability of this item occurring. For instance, in the...
6
by: mark4asp | last post by:
Suppose I have the following code. It functions to randomly select a city based upon the probabilities given by the key differences in the associative array. . Eg. because the key difference...
4
by: Robert | last post by:
I am curious why some people feel that Javascript doesn't have associative arrays. I got these definitions of associative arrays via goggle: Arrays in which the indices may be numbers or...
8
by: Derek Basch | last post by:
Is there any way to associate name/value pairs during an array initialization? Like so: sType = "funFilter" filterTypeInfo = ; filterTypeInfo = new Array("type" : sType); I can do it using...
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
0
by: olafmol | last post by:
Hello, i have a problem using a .NET WSDL Webservice from PHP. Using both the NuSOAP lib for PHP4, and the build-in SOAP lib for PHP5 it seems that the SOAP client cannot pass a variable amount...
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
4
by: Kozman | last post by:
I have a problem where I need to use the literal "length" as a subscript in an associative array (I have no control over what is used as a subscript..."length" happens to be one of the uncontrolled...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.