This is a discussion on PHP & XML within the PHP Language forums, part of the PHP Programming Forums category; Hello guys, I intend to write a (very) simple todo application using an XML file to store the details of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello guys,
I intend to write a (very) simple todo application using an XML file to store the details of each task. I wondered if anyone had any experience of using the various XML extensions in PHP 5, and could say which are more suited to reading AND writing XML, which are more likely to be present on more hosts, and which are easier to get to grips with, etc. The reason for this is a lack of database on my host and it seemed like a good thing to do. Alternatively, if anyone has any snippets of/recommendations for a lightweight, flat-file/XML, PHP todo list I'd be very grateful. I realise there are sites like tadalist.com but I had hoped to learn more about PHP as a result of the exercise! Apologies in advance if any of this is truly obvious. Cheers, Tom |
|
|||
|
..oO(tomas)
>I intend to write a (very) simple todo application using an XML file to >store the details of each task. I wondered if anyone had any experience >of using the various XML extensions in PHP 5, and could say which are >more suited to reading AND writing XML, which are more likely to be >present on more hosts, and which are easier to get to grips with, etc. DOM SimpleXML Micha |
|
|||
|
On Tue, 20 May 2008 21:37:33 +0200, tomas <tomas@fictional.com> wrote:
> Hello guys, > > I intend to write a (very) simple todo application using an XML file to > store the details of each task. I wondered if anyone had any experience > of using the various XML extensions in PHP 5, and could say which are > more suited to reading AND writing XML, which are more likely to be > present on more hosts, and which are easier to get to grips with, etc. > > The reason for this is a lack of database on my host and it seemed like > a good thing to do. Alternatively, if anyone has any snippets > of/recommendations for a lightweight, flat-file/XML, PHP todo list I'd > be very grateful. I realise there are sites like tadalist.com but I had > hoped to learn more about PHP as a result of the exercise! > > Apologies in advance if any of this is truly obvious. As Micha stated. However, why are you planning to use XML? Are there other apps running that might need it's info? If not, and you want to avoid setting up a real database, might I suggest SQLite? -- Rik Wasmus ....spamrun finished |
|
|||
|
Michael Fesser wrote:
> .oO(tomas) > >> I intend to write a (very) simple todo application using an XML file to >> store the details of each task. I wondered if anyone had any experience >> of using the various XML extensions in PHP 5, and could say which are >> more suited to reading AND writing XML, which are more likely to be >> present on more hosts, and which are easier to get to grips with, etc. > > DOM > SimpleXML > > Micha Thanks Micha, will take a look. |
|
|||
|
Rik Wasmus wrote:
> On Tue, 20 May 2008 21:37:33 +0200, tomas <tomas@fictional.com> wrote: > >> Hello guys, >> >> I intend to write a (very) simple todo application using an XML file >> to store the details of each task. I wondered if anyone had any >> experience of using the various XML extensions in PHP 5, and could say >> which are more suited to reading AND writing XML, which are more >> likely to be present on more hosts, and which are easier to get to >> grips with, etc. >> >> The reason for this is a lack of database on my host and it seemed >> like a good thing to do. Alternatively, if anyone has any snippets >> of/recommendations for a lightweight, flat-file/XML, PHP todo list I'd >> be very grateful. I realise there are sites like tadalist.com but I >> had hoped to learn more about PHP as a result of the exercise! >> >> Apologies in advance if any of this is truly obvious. > > As Micha stated. However, why are you planning to use XML? Are there > other apps running that might need it's info? If not, and you want to > avoid setting up a real database, might I suggest SQLite? Rik, I guess I was thinking about learning to deal with XML in case RSS came up in a future project. Also, though it might well be trivial on so simple an application, XML is more "organised" than flat-file and it made sense to be more organised for a todo app, even if it's only cosmetic! I know very little of SQLite -- will any PHP-enabled (with the appropriate extensions if any) server allow me to use an SQLite database file, though it lacks MySQL support? Many thanks, Tom |
|
|||
|
On 2008-05-20, tomas <tomas@fictional.com> wrote:
> > I know very little of SQLite -- will any PHP-enabled (with the > appropriate extensions if any) server allow me to use an SQLite database > file, though it lacks MySQL support? Being so new to even html and php, I'm still trying to figure out the "why" of xml in general. If you're not using a db, why xml at all? BTW, it appears you are using a *nix OS. It's easy to load a db. I'm not really asking you a question, just adding my 2 cents worth of food for thought: http://www.codinghorror.com/blog/archives/001114.html nb |
|
|||
|
notbob wrote:
> On 2008-05-20, tomas <tomas@fictional.com> wrote: >> I know very little of SQLite -- will any PHP-enabled (with the >> appropriate extensions if any) server allow me to use an SQLite database >> file, though it lacks MySQL support? > > Being so new to even html and php, I'm still trying to figure out the "why" > of xml in general. If you're not using a db, why xml at all? BTW, it > appears you are using a *nix OS. It's easy to load a db. I'm not really > asking you a question, just adding my 2 cents worth of food for thought: > > http://www.codinghorror.com/blog/archives/001114.html > > nb The 'coding horror' example at the site you site has more to do with soap horrors that XML. There are lots of promising new and largely unexplored XML frontiers. I spent a few years experimenting with XML databases (SleepyCat and Exist mostly). Hierarchical databases offer a lot. GUI screens can built from a menu (choose a checkbox widget, choose a dropdown menu widget, choose a container widget of some kind, where the container widget can contain other widgets.....the resulting data structure can be instantly and automatically instantiated as BOTH a point an click GUI AND a schema. You can now (repeatedly) fill out that newly instantiated GUI an save data that goes into an XML database. That same GUI can be instantly transformed into a query builder. Click which of the descriptive widgets you want to use and boom, you have a query GUI that can spit out complex XPath and/or XQuery statements, complete with parentheses and compound conditions, that return ghats-ass accurate results. XML does NOT have to be normalized as tediously as relational data, because "who modifies what" relationships are built into the hierarchical structure. Foreign keys (although not officially supported by either SleepyCat or Exist just yet) can be implemented (we did) where one descriptive XML file refers to another. Junction-link heirarchies that join two or more XML hierarchies into a many-to-many relationship cannot be fully automated.....queries at that point do cross an automatable boudary, and do (at that point) require some expert knowledge of the underlying schema. But what *can* be done automatically with XML is far beyond anything possible with relational schemas, hibernate and ruby on rails not withstanding. There is a lot of XML chafe out there that does (like corba) need to be discarded. But there is a lot of exciting stuff yet to do, and to take advantage of. XML can do things still impossible with relational organization. |
|
|||
|
roadman wrote:
> There is a lot of XML chafe out there that does (like corba) need to be > discarded. But there is a lot of exciting stuff yet to do, and to take > advantage of. XML can do things still impossible with relational > organization. Think of relational tables as miniature, columnar spread sheets, where one and only one column has a dominant role (the primary key) and all other column labels MUST modify the primary key at an equal level, else the data become ambiguous. Now think of relational tables transformed into miniature hierarchies. Now you can have a larger, more complex and richer set of modifiers, without loss of accuracy. The hierarchy defines who modifies what. A complex relational schema modeling a business, for instance, that might require 300 or more relational tables, can be modeled with perhaps 20 or fewer hierarchies, with no increase in ambiguity. |
|
|||
|
notbob wrote:
> On 2008-05-20, tomas <tomas@fictional.com> wrote: >> I know very little of SQLite -- will any PHP-enabled (with the >> appropriate extensions if any) server allow me to use an SQLite database >> file, though it lacks MySQL support? > > Being so new to even html and php, I'm still trying to figure out the "why" > of xml in general. If you're not using a db, why xml at all? BTW, it > appears you are using a *nix OS. It's easy to load a db. I'm not really > asking you a question, just adding my 2 cents worth of food for thought: > > http://www.codinghorror.com/blog/archives/001114.html > > nb nb, I am using a *nix, but my current host isn't, and has no DB support -- I realise I can develop on a local server but that's only so useful once the thing's done (until I've saved some cash!) :-) I read the post from the link and many of the comments. It seems XML comes under fire for not being instantly human-readable, bloated almost. I do understand this point and given all I want to do for my todo list is read a task, a due date and whether it's done, a delimited flat file seems to be a simpler choice. Thanks for the $0.02! Tom |
|
|||
|
On 2008-05-21, tomas <tomas@fictional.com> wrote:
> realise I can develop on a local server but that's only so useful once > the thing's done (until I've saved some cash!) :-) I can relate, tomas, as I too am looking for a LAMP based web host I can afford. Dig a little deeper and you will discover there are web hosts out there that bill monthly instead of 1-2yr contracts and some even accept paypal. nb |