Edit XML like a DB woth web form?
am 03.12.2007 20:04:13 von Pupkin
Hi,
I have a site that takes info from a form and adds it as a record to an
XML file (RSS format), using the XML as a light-weight db.
Now I need to build a web-based management app for the data in the XML
file, where the user can grab a record from the XML file, edit it, and
save the changes back to the XML file.
I've done this same kind of recordset thing with an sql database, but
not with XML. Is there a simple open source app that already does this?
Where all I'd need to modify is the elements in the editing form?
I just need a reference to look at in terms of grabbing the data from
items in the XML and saving it back.
Thanks.
Re: Edit XML like a DB woth web form?
am 04.12.2007 00:54:10 von nc
On Dec 3, 11:04 am, Pupkin wrote:
>
> I have a site that takes info from a form and adds it
> as a record to an XML file (RSS format), using the XML
> as a light-weight db.
I humbly suggest you reconsider. XML is not a data storage format, it
is a data interchange format. If you continue to accumulate records
in your XML file, at some point it is going to cause problems, because
memory required to manipulate it will exceed PHP's memory limit. With
CSV, this problem is solved by sequential reading (1 line = 1 data
record), but with XML, there is no natural breakpoints to sequential
reading...
Cheers,
NC
Re: Edit XML like a DB woth web form?
am 03.01.2008 10:53:29 von Djeemale Dotcom
Try loading the XML file, thus:
if (file_exists('./xml/yourdb.xml')) {
$xml = simplexml_load_file('./xml/yourdb.xml');
} else {
exit('Failed to open yourdb.xml.');
}
Then assign the node data to variables and display in forms for editing
using PHP. Finally write back your XML file like this.
$xml->asXML('./xml/yourdb.xml');
Hope this is of some help.
Pupkin wrote:
> Hi,
>
> I have a site that takes info from a form and adds it as a record to an
> XML file (RSS format), using the XML as a light-weight db.
>
> Now I need to build a web-based management app for the data in the XML
> file, where the user can grab a record from the XML file, edit it, and
> save the changes back to the XML file.
>
> I've done this same kind of recordset thing with an sql database, but
> not with XML. Is there a simple open source app that already does this?
> Where all I'd need to modify is the elements in the editing form?
>
> I just need a reference to look at in terms of grabbing the data from
> items in the XML and saving it back.
>
> Thanks.