f



XML or not XML?

I am developing a simple MySQL database editor, and am looking into 
creating an PHP/AJAX app as the GUI.  A lot of this in new ground, and 
much more is dusting off things I haven't used in a while.  My question 
though involves whether or nor to employ XML.  I did some XML a few 
years back, but don't typically bother anymore.  As I see it XML is 
great when I need to have an app with a standard data presentation that 
other developers can easily interface.  I.E. like a bank statement that 
may feed a variety of applications developed by a variety of clients. 
However, if I am developing an integrated solution that doesn't need 
that kind of ubiquity it just seems to add a layer of unnecessary 
complexity without any added benefit.  I would like to hear some 
opinions on the pros and cons of using XML for PHP MySQL apps.
0
noreply941 (318)
12/9/2008 2:54:15 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

6 Replies
2527 Views

Similar Articles

[PageSpeed] 43

On Dec 9, 9:54=A0am, William Gill <nore...@example.com> wrote:
> I am developing a simple MySQL database editor, and am looking into
> creating an PHP/AJAX app as the GUI. =A0A lot of this in new ground, and
> much more is dusting off things I haven't used in a while. =A0My question
> though involves whether or nor to employ XML. =A0I did some XML a few
> years back, but don't typically bother anymore. =A0As I see it XML is
> great when I need to have an app with a standard data presentation that
> other developers can easily interface. =A0I.E. like a bank statement that
> may feed a variety of applications developed by a variety of clients.
> However, if I am developing an integrated solution that doesn't need
> that kind of ubiquity it just seems to add a layer of unnecessary
> complexity without any added benefit. =A0I would like to hear some
> opinions on the pros and cons of using XML for PHP MySQL apps.

JSON is certainly easier to work with from JavaScript. That and XML
are the two main serialization options as far as I know. You should
check out JSON.

Thomas
0
thomasmallen (125)
12/9/2008 4:24:13 PM
William Gill wrote:
> I am developing a simple MySQL database editor, and am looking into 
> creating an PHP/AJAX app as the GUI.  A lot of this in new ground, and 
> much more is dusting off things I haven't used in a while.  My question 
> though involves whether or nor to employ XML.  I did some XML a few 
> years back, but don't typically bother anymore.  As I see it XML is 
> great when I need to have an app with a standard data presentation that 
> other developers can easily interface.  I.E. like a bank statement that 
> may feed a variety of applications developed by a variety of clients. 
> However, if I am developing an integrated solution that doesn't need 
> that kind of ubiquity it just seems to add a layer of unnecessary 
> complexity without any added benefit.  I would like to hear some 
> opinions on the pros and cons of using XML for PHP MySQL apps.

Not knowing details about what you're trying to do, it's impossible to 
answer your question.

The question here is - what are you going to use the XML for?  If you 
have a good reason for using it, great.  If you're searching for a 
reason, maybe it isn't the correct way to go.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
jstucklex (14659)
12/9/2008 4:45:25 PM
Jerry Stuckle wrote:

> Not knowing details about what you're trying to do, it's impossible to 
> answer your question.
> 
> The question here is - what are you going to use the XML for?  If you 
> have a good reason for using it, great.  If you're searching for a 
> reason, maybe it isn't the correct way to go.
> 
Actually I think you did answer my question and confirm my suspicion 
that encapsulating data in an XML document adds unnecessary layers of 
complexity that should be avoided unless there is a compelling 
overriding argument.  For example if the I am developing both the server 
and the client, I can identify fields and data in any way that suits my 
needs.  If however there may be numerous client applications developed 
by any number of developers for any number of platforms, then 
encapsulating the data in a standard, universally recognized tree 
structure like XML may be warranted.

The question, though not very well stated, was generic regarding when 
and if to use XML (one of many "the future of the internet" I have 
encountered over the years) to facilitate data exchange.


0
noreply941 (318)
12/10/2008 2:24:44 PM
William Gill escribi�:
> Actually I think you did answer my question and confirm my suspicion 
> that encapsulating data in an XML document adds unnecessary layers of 
> complexity that should be avoided unless there is a compelling 
> overriding argument.  For example if the I am developing both the server 
> and the client, I can identify fields and data in any way that suits my 
> needs.

Thank God, the availability of tools is no longer an issue. You can 
generate data in most popular formats quite easily with built-in PHP 
functions. You know longer have to write your own XML parser.

If all you need is handling the data transfer in your AJAX app, I 
suggest you take into account how verbose XML is...

	<?xml version="1.0"?>
	<data>
		<result>OK</code>
		<items>
			<item>10</item>
			<item>20</item>
			<item>30</item>
		</items>
	</data>

.... compared with almost everything else:

JSON:

	{"result":"OK","items":[10,20,30]}

Plain text:

	OK
	10
	20
	30
	50




-- 
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://bits.demogracia.com
-- Mi web de humor al ba�o Mar�a: http://www.demogracia.com
--
0
12/10/2008 5:01:37 PM
�lvaro G. Vicario wrote:

> If all you need is handling the data transfer in your AJAX app, I 
> suggest you take into account how verbose XML is...

Another good argument.  I guess I'll stick with my own serialization 
techniques, or take a closer look at JSON.

0
noreply941 (318)
12/11/2008 2:26:48 AM
William Gill wrote:
> I am developing a simple MySQL database editor, and am looking into 
> creating an PHP/AJAX app as the GUI.  A lot of this in new ground, and 
> much more is dusting off things I haven't used in a while.  My question 
> though involves whether or nor to employ XML.  I did some XML a few 
> years back, but don't typically bother anymore.  As I see it XML is 
> great when I need to have an app with a standard data presentation that 
> other developers can easily interface.  I.E. like a bank statement that 
> may feed a variety of applications developed by a variety of clients. 
> However, if I am developing an integrated solution that doesn't need 
> that kind of ubiquity it just seems to add a layer of unnecessary 
> complexity without any added benefit.  I would like to hear some 
> opinions on the pros and cons of using XML for PHP MySQL apps.

They really simple (and obvious) answer is, only put it in if you really 
need it. As in, you are sure.

Wasting your time otherwise.
0
awec (9)
12/11/2008 4:06:32 AM
Reply:

Similar Artilces:

XML to XML
I have a gnucash file that I'm trying to transform into an identical XML file without the invoices. I've been at this for a while now. The gnucash file is in XML and the element I'm looking into is: <gnc:transaction> I want to ignore those that contain <slot:key>gncInvoice</slot:key> which is a child of slot which is a child of slots which is a child of transactions. Any help you're willing to provide would be greatly appreciated. Thanks. Classic application for XSLT. Start with the identity transformation, then add a template which matches the ones yo...

To XML or not to XML?
Ok, it has been a while since I've needed to make an involved web page. Coming back on the scene now is a bit confusing, what with all the cool stuff to use like XML, PHP, MySQL, etc... So here is my question. I'm in search of a good dynamic way to generate web pages which separates content from presentation. I am seeking to create a web site that, to put it succinctly, has a list of users and sets of information corresponding to each user. I am familiar with how to do this using PHP, MySQL, and regular old HTML. I maintain the user database in MySQL and dynamically present it and th...

embedding xml in xml as non-xml :)
Hi all, I have an application that logs in xml. Assume <xmlLog></xmlLog>. In this element the app logs anything it gets from foreign hosts. Now if the host sends xml data, the structure of the document changes. ie. <xmlLog><somTag></somTag></xmlLog>. This will cause problems with my log reader, because it assumes that <xmlLog/> contains non-xml data. My question is, is there a way to treat the data in the <xmlLog/> element as non xml data. Something I can do that would treat anything this element contains as a literal? Any help or ...

Parsing XML with PHP
I am not really sure how to parse files with PHP XML other than DOM XML. Unfortunetely, I have run into a few problems with size and was told that for the type of parsing I am doing I would be better using event driven parsing like SAX. Below I have a simple example of XML similar (although much much smaller) to the one I am using for real. XML: <?xml... <root> <name age="25">Martyn</name> <name age="24">Neil</name> <name age="24">Robbie</name> </root> All I want to do is to output them as: Martyn (25) ...

Cocoon XML to XML
Hello. I want t know if it's possible to use cocoon to run xml to xml pipeline without publishing anyelse, just pipeling ? Has somebody tried this ? Thanks ! 8:0) Cram TeXeD -- "La r�alit�, c'est ce qui refuse de dispara�tre quand on a cess� d'y croire." (Philip K.Dick) <http://texed75.free.fr> ...

[XML] Is there an XML group?
Hi, I've typed an XML source which calls a CSS source, the result should be a page displayed in IE6, instead I see the XML source. That's pretty logical since there a no XHTML tags for IE6 to interpret. I'm looking for a discussion group like'comp.lang.xml' but I can't find one. Please help me. The first task is to see the Blue Jay. universalbitmapper wrote: > I'm looking for a discussion group like'comp.lang.xml' but I can't find > one. There's a comp.text.xml, which might be what you're looking for. Note that I don't read it,...

XML to XML Transformation
I was thrust into XML about 2 weeks ago and don't know much yet. From another department in the corp I am receiving an XML file which concatenates nodes all on one line i.e. <car><make>ford</make><color>red</color><year>2001</year></car><car><make><mb> etc. etc. etc. Some lines are over 300 characters long. I need to translate this spagetti XML into something which is humanly readable. I probably need to use XSL however I'm not sure what I need to do. Any help will be much appreciated. "Will" <william...

XML to Canonical XML
I'm trying to find a Ruby package that will convert valid XML into canonical XML. I found the genx4r gem, but that just generates canonical XML. Any pointers appreciated. Gary Wright On Feb 12, 2008 11:47 AM, Gary Wright <gwtmp01@mac.com> wrote: > I'm trying to find a Ruby package that will convert valid XML into > canonical XML. > Define "canonical XML" James [Note: parts of this message were removed to make it a legal post.] http://www.w3.org/TR/xml-c14n On Feb 12, 2008 10:51 AM, James Britt <james.britt@gmail.com> wrote: > On Feb 12, ...

xml from 2 xml
Hi to everybody, would I like to create a consequential xml from the elaboration of two files xml using xslt, but is it possible to give in input to a trasform 2 files xml? thanks for the possible answers I have already found from me the answer: the function document('file2.xml') matatu ha scritto: > Hi to everybody, > > would I like to create a consequential xml from the elaboration of two > files xml using xslt, but is it possible to give in input to a trasform > 2 files xml? > > thanks for the possible answers ...

Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser)
Hello Usenet. I'm subject to some confusion with XML and UTF8. I'm working with XML-Simple and I try to decode some XML with with german umlauts (ISO-8859-1). The first XML line declared the encoding correct (see code below). But I'm getting different results using XML-Simple with the default XML parser named XML::Sax and a second parser named XML::Parser. The following code tries to decode the mini XML file and prints the UTF8 flags of the resulting strings. Can someone run this code on his machine and post the results? Thanks. The results on my machine are this: ���ä...

XML to XML conversion
Hello, I vageuly remember a standard that allowed for an XML document using one tag vocabulary to be translated to a diffirent XML document using a diffirent tag vocabulary using the information provided in a kind of dictionary XML pointed to in an URL present in the original XML file. I am very interested in trying it out for various applications, but I can't find anything on the internet about it, since I don't remember it's name, only the general appearance. Can anyone help me with this? What I remember, approximately: The idea is that you have one XML file, in which th...

Adressing node element when parsing xml with PHP and simple XML
I need to get the elements under this XML top structure using simplexml: <PKT> - <Result Name="GetTopWinnersForLastXMinutes" Success="1"> - <Returnset> - <Winner> I am trying to get the elements, associate them in one variable and foreach them under <Winner> like this: foreach($xml->Result.Returnset.Winner as $Winner) But the resulting page is blank. Could anyone please give me a hint? On 28 Nov 2009, Nosferatum <john.olav.o@gmail.com> wrote: > I need to get the elements under this XML top st...

PHP XML-XML curl function not working. Please help
Hi Everyone, I'm trying to get the following php script to work with an ebay API. It sends XML and then returns XML and formats it into links. THing is it doesn;t work, and I'm not sure why. Can anyone see where I'm going wrong? Thank you in advance, Raj <?php $query = 'ipod'; $endpoint = 'http://open.api.ebay.com/shopping?'; $resp = simplexml_load_string(constructPostCallAndGetResponse($endpoint, $query)); if ($resp) { $results = ''; foreach($resp->Item as $item) { $link = $item->ViewItemURLForNaturalSearch; $tit...

[rfc-dist] RFC 6207 on The Media Types application/mods+xml, application/mads+xml, application/mets+xml, application/marcxml+xml, and application/sru+xml
A new Request for Comments is now available in online RFC libraries. RFC 6207 Title: The Media Types application/mods+xml, application/mads+xml, application/mets+xml, application/marcxml+xml, and application/sru+xml Author: R. Denenberg, Ed. Status: Informational Stream: IETF Date: April 2011 Mailbox: rden@loc.gov Pages: 11 Characters: 18090 Updates/Obsoletes/SeeAlso: None I-D Tag: draft-denenberg-m...

Web resources about - XML or not XML? - comp.lang.php

XML - Wikipedia, the free encyclopedia
including RSS , Atom , SOAP , and XHTML . XML-based formats have become the default for many office-productivity tools, including Microsoft Office ...

Native XML Database
(by Conor O'Mahony) If you want to learn more about XML indexes in DB2, including the XML index enhancements in DB2 10 , join the DB2 pureXML ...

XML From the Inside Out XML development, XML resources, XML specifications
XML.com, where the XML community shares XML development resources and solutions, features timely news, opinions, features, and tutorials; the ...

XML developer news from XMLhack: by and for the XML community
XML developer news from XMLhack: by and for the XML community

XML Design Patterns
XMLPatterns.com - Designing Good XML Structure with Patterns.

Create your Google Sitemap Online - XML Sitemaps Generator
... Google Sitemap Generator You will be redirected to the generated sitemap details page, including number of pages, broken links list, XML file ...

The XML C parser and toolkit of Gnome
"Programmingwith libxml2 is like the thrilling embrace of an exotic stranger." MarkPilgrim Libxml2 is the XML C parser and toolkit developed ...

Legislative Documents in XML at the United States House of Representatives
Official site for XML at the United Steates House of Representatives for legislative documents

faroo_p2p: Our Web Search API now supports cross domain access for JSON, XML and RSS via CORS (Cross-Origin ...
faroo_p2p: Our Web Search API now supports cross domain access for JSON, XML and RSS via CORS (Cross-Origin Resource Sharing). http://t.

XML and JSON — Advantages and Disadvantages?
... Notation (JSON), and after looking it up, it seems like it's becoming rather popular as an alternative to the Extensible Markup Language (XML). I ...

Resources last updated: 2/7/2016 4:17:02 PM