Page 1 of 1

Writing a node to an XML file

Posted: Sat Jul 12, 2003 9:46 pm
by VmusicV
Hi,
I want to write a node or nodes to an existing xml document. I don't need to create a new document, thanks but no thanks.

**** It is sad that php is so far behind Microsoft on XML manipulation ****

Judging from various posted topics I've seen. It appears the php DOM for XML isn't quite there yet and has a lot of bugs. Not only that it takes a few months before web hosters update versions of php.

I tried the pear classes, but they're so poorly documented, there's no examples, there's nobody you can contact at Pear for hlep. If you ask for help on forums, you get no reply's so obviously not many ppl are using these classes.

I wonder..... if there's a push from say mySQL to stall or slow down PHP's functionality for XML?

Any ideas on how to write a node or nodes into an existing XML file..... without a bunch a array manipulation?

Thanks In Advance...
Vmusic


__________________
~Just Say When ~

[/b]

Posted: Sat Jul 12, 2003 10:41 pm
by Stoker
XML in itself is so simple it doesnt require much docs and I think that why PHP in itself doesnt have much docs.. I do agree that the uspport for dynamic manipulation of XML data does not have great support and functioinality in PHP, I think this has to do a lot with that PHP is used a lot more as a web app language than soap servers and such..

With php, your best chance of manipulating a small XML document is to parse the whole thing to a tree, insert your data and write to file. A large/huge document I would sau you need to parse the data from the file while writing to a new one and insert when the point of insertion is reached.
I doubt that MS has any other way of doing the actual work when using XML data from flat files, although they may have a quick parsing/indexing and transparent functions that make the developers work easier..

Posted: Sun Jul 13, 2003 4:08 am
by twigletmac
It's probably not that PHP is so far behind Microsoft in XML implementation, more that Microsoft is so far ahead of anyone in implementing as many proprietory XML DOM functionalities as they can.

Mac

XML manipulation

Posted: Sun Jul 13, 2003 6:58 am
by VmusicV
Hi,
Some interesting comments. However considering that...........the XML 1.0 specification has been out over 3 years. Parsers have been out just as long.
I can understand not fully jumping on a technology ship until you're certain it's going to go somewhere......
for crying out loud XML is essentially worthless if you want to manipulate it with php. Imagine having a database where you couldn't insert a single row or rows into a table if it already had data. Or you couldn't delete a certain row without 100 lines of php code...... Imagine the only thing you could do was read data from tables if it already existed, or create whole new tables

I'm talking common sense here, not rocket science

Surely common sense would seem to say that XML is well..... uh.... data. The same basic functionalities you have need of in RDBMS's you would need in heirarchical data.

Hierarchical Frustration...... :-(

Posted: Sun Jul 13, 2003 1:01 pm
by Stoker
3 years is very young, SGML is an old protocol and there really arent many programming languages that have native built in functionality for SGML document manipulation.. Why? Because the need hasnt been there or not great enough.. Same thing with XML and PHP, the need for XML manipulation in PHP has not been all that great. I bet th 90% of XML use in PHP is either sending OR receiving datafor a certain service, and not often as an XML data manipulation service, and some that do probably do small chunks of data which is easy and quick to manipulate..

If you are in great need of good XML functionality for large amounts of data, PHP is probably not your tool of choice.

Another thing that I disagree with is your comparison of XML and database/rdbms, they really have nothing in common. XML is static flat file representation of any and possibly unstrcutured data, with or without a dtd or schema. There are database engines that natively can store and output with XML, but I don't see it as a replacement for RDBMS, XML is not practical for data storage..

PHP and XML - Not even close....

Posted: Sun Jul 13, 2003 2:07 pm
by VmusicV
I strongly disagree with several things you said.


3 years is a very long time. Entire industries come and go in 3 years. That's the very reason information systems continue to fail to meet the needs of business, we don't understand the need for solutions now, not 3 years from now.

As long as it takes 3 years to add common sense functionality to our development tools, we'll never get it. Right or wrong, MS seems to believe enough in XML to be developing functions for it in ASP or it's dot net framework.

Structured or unstructured data? - Regardless of entity relationships and correct attribution. In every case XML has solid fundamental concepts that make it innately very structured. Every tag must have a closing tag. An element has one and only parent (except for the root). Sure I can take a data element called dog and have it be the parent to a data element called kitten, it doesn't matter. You still have to match the tags and a data element can only have one parent.

It's not rocket science you need to get to be able to both read and write to an XML document within the context of it's data structure....


When we fall short...we need to admit it.

Posted: Sun Jul 13, 2003 4:33 pm
by Stoker
no need to admit anything as there is nothing to admit.. PHP is open source, largely driven by community, is the demand great enough it will be created, if your demand is so great you simply pay someone to create such functionality for you and if the work is good its a good chance the PHP team will include it in future releases...
Microsoft is driven by profit and marketing, if XML functionality helps them sell they will create it. Sort of like MS-Office, it is so full of functions and (annoying) helpful stuff that it is easy to market and sell. The open source office suites does not have so many neat looking things, but for at least 90% of the users its more than good enough, and the rest simply just buys Bill Gates products if they need them.

Posted: Mon Jul 14, 2003 3:44 am
by twigletmac
And it is very important to note that a lot of stuff used in the XML DOM in MSXML is proprietory to Microsoft and doesn't form part of the XML recommendation. There is no guarentee that any of this extra stuff will ever form part of the official recommendation.

Mac