I am working on an embedded platform. Disk storage is at a premium, so
I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a
webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and
it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a
simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule
< Line
< From %f >
< To %f >
< Op1 true >
< Op2 true >
< Op3 false >
< Op4 true >
</ Line>
.... [more lines as needed]
</ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and
is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the
above structure, is there a way to dump an array to file and then read
it back?
Something like print_r, but using file ops and also a read_r to read it
into the array?
Bascially, I am looking for the simplest way to create something that
looks sort of like XML.... 5 1726
Hi,
You might try to serialize an array and deserialize it later. http://www.php.net/serialize
Captain Dondo wrote: I am working on an embedded platform. Disk storage is at a premium, so I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule < Line < From %f > < To %f > < Op1 true > < Op2 true > < Op3 false > < Op4 true > </ Line> ... [more lines as needed] </ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the above structure, is there a way to dump an array to file and then read it back?
Something like print_r, but using file ops and also a read_r to read it into the array?
Bascially, I am looking for the simplest way to create something that looks sort of like XML....
Captain Dondo wrote: I am working on an embedded platform. Disk storage is at a premium, so I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule < Line < From %f > < To %f > < Op1 true > < Op2 true > < Op3 false > < Op4 true > </ Line> ... [more lines as needed] </ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the above structure, is there a way to dump an array to file and then read it back?
Something like print_r, but using file ops and also a read_r to read it into the array?
Bascially, I am looking for the simplest way to create something that looks sort of like XML....
How about the WDDX functions? http://fi.php.net/wddx
Chung Leong wrote: Bascially, I am looking for the simplest way to create something that looks sort of like XML....
How about the WDDX functions? http://fi.php.net/wddx
Wow! That looks really interesting....
Do you happen to know if there is a C parser for wddx? Google finds
nothing...
My backend is written in C....
Hi,
I hope I didn't get you wrong, but assuming you don't need any DOM
operations, you can just build a string containing your XML and write it
to a file with file_put_conten ts($filename).
To read it, you could use (PHP 5-only) the build-in SimpleXML-API, which
is very fast and easy to handle for reading purposes: http://www.php.net/manual/en/ref.simplexml.php
For PHP 4, you could include the also easy to handle XML-Parser from the
PEAR repository: http://www.php.net/manual/en/ref.simplexml.php
Captain Dondo wrote: I am working on an embedded platform. Disk storage is at a premium, so I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule < Line < From %f > < To %f > < Op1 true > < Op2 true > < Op3 false > < Op4 true > </ Line> ... [more lines as needed] </ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the above structure, is there a way to dump an array to file and then read it back?
Something like print_r, but using file ops and also a read_r to read it into the array?
Bascially, I am looking for the simplest way to create something that looks sort of like XML.... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave Smithz |
last post by:
Hi there,
As a newbie to PHP is it in anyway possible for a casual web surfer to
actually get to see the PHP behind my .php file.
E.g.
if index.php contained PHP code to check if the page had been called with a
variable such as "password", is there anyway a public member can get to see
the raw php file and therefore see what the...
|
by: Maxim Khesin |
last post by:
I want to have a config file with my python proggie, satisfying the
following requirements:
1) support key->(value, default)
2) simple and intuitive to read and edit
3) easyly readable into a python datastructure (a dictionary?)
4) not requiring any heavy libraries needed (I am distributing my
proggie as a py2exe executable and do not want...
|
by: aj |
last post by:
DB2 WSE 8.1 FP5
Red Hat Linux AS 2.1
I am working on a Java-Swing based interface for a DB2 database,
and want to display more human-readable error meesages to the
end user when/if a database exception occurs. I am using the
type 4 Universal JDBC driver.
If I have an SQLCODE & SQLSTATE, where do I look to get a human...
|
by: John Baro |
last post by:
I need to determine which fonts are human readable.
Webdings, wingdings etc.. are not.
Is there any easy way to accomplish this?
Cheers
JB
|
by: mphanke |
last post by:
Hi,
can somebody tell me how to convert the date from a Paradox .DB to human
readable format?
I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.
Thanks for your help,
| |
by: KenFehling |
last post by:
Hello. I am wondering if there exists a piece of software that takes
multiple .js files that are nicely indented and commented and create
one big tightly packed .js file. I'm hoping the one file would be less
of a burden for the user's browser to download. I guess the final code
output by this hypothetical program could maybe even just be...
|
by: Sanyog Garg |
last post by:
hi
I want to open a binary file that contains information in Ulong, Int and char form. now i want to convert this file into human readable form so that i can read the information contained in this file.
Is it possible to develope a program in JAVa for this purpose???? if yes then please give me some clue for this......
|
by: Rob Weir |
last post by:
On 13 Aug 2008, rkmr wrote:
http://mail.python.org/pipermail/python-list/1999-December/018519.html
is a good start - just need to change the table to something like::
_abbrevs =
(and add a 'B').
--
|
by: August Karlstrom |
last post by:
Hi,
I'm looking for a function that *returns* a human readable string
representation of an array rather than prints it so I can use it with
the error_log procedure. Any clues?
August
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |