
|
View Full Version : What so good about XML?
eskuek 09-06-2004, 12:08 PM Hi,
I'm new to this language. I hear that this language is an upcaoming language. The next big thing. I was wondering WHat's the advantages of XML over other languages, for eg HTML, XHTML,etc
Thanks!
xelav 09-16-2004, 05:34 AM XML - universal languadge, created for transferring different data.
First you can see http://w3c.org/XML/ for more information
Ricardob 10-09-2004, 06:16 PM not being picky here, but XML is not a programming language.
It's a standard to describe data.
In it's simplest form it's a series of tags that describe the data
Ex:
<Employee>
<Name>John Smith</Name>
<Adresss>.....</Adress>
</Employee>
<Employee>
<Name>John Greene</Name>
<Address>...
you get the idea, it can of course be a lot more complex than that and some times you need and .xsd file to describe the data structure.
Not very technical but can't be bother looking for definitions :cool:
One advantage with XML is that you can easily parse it with any common programming language.
BigHostCompany 11-10-2004, 05:31 AM Yeah, XML is not a programming language. It allows to structure data. and it can be used with any programming languages or scripts.
XSL is also good for style sheets.
Akyriel 11-10-2004, 05:16 PM XML is one of the building blocks for Web Services - the others being WSDL, UDDI, SOAP, and perhaps XSL-T or XSL-FO. These are the tools future applications will be built with, so it behooves one to learn as much as possible.
BTW, there's lots of confusion about what exactly a Web Service is.
To be brief, a web service is NOT a .NET application or a program written with VB.NET, C# or J2EE for that matter. A Web Service is a programming API using the above listed technologies that allow programs to interact in a completely platform agnostic way (i.e. the programming lanuage, operating system, hosting platform, physical location is completely transparent to both the calling and listening applications.
XML is the format by which the data is transferred and assimilated (parsed) into each program.
Devin.B 11-17-2004, 10:52 PM I really dislike XML for some reason. Looks to much like html to me.
Azavia 01-10-2005, 04:58 PM Originally posted by Devin.B
I really dislike XML for some reason. Looks to much like html to me.
HTML is basically XML that formats data. XML focuses on structure, while HTML focuses on format and appearance.
Terng 01-11-2005, 03:31 AM Thats right, XML is not a programming language and neither is HTML. These are standards used for two different purposes, HTML for describing how your webpage should look like and XML an accepted standard of describing data so that it could be understood no matter what the system. (Plus it was created to solve the issue of developers storing data in their own custom formats which makes it impossible, or atleast very difficult, to read later on without documentation, especially when you want to migrate systems)
InternetArmy 01-14-2005, 06:38 AM The reason XML was created was in an effort to much easier allow applications to use and share data seamlessly with one another without the need for special plugins nor proprietary APIs.
Previously, people used flat file text files or were forced to impliment technology solutions in order to meet the special requirements of connecting to the sources databases and etc.
In addition, you can set things like data types and etc for use in validation and much more.
Application data can be easily communicated across networks, applications and organizations.
XMl is pretty great, but it is simply a storage/communication mechanism and not an actual programming language. XML has no application logic.
silhouette 03-13-2005, 07:07 AM for trivial script/site that requires some storing of a little data. I use xml doc . rather than using a over-kill db. comes in pretty handy
dnguyen 04-07-2005, 10:48 PM XML is cool
Elliot A 04-08-2005, 12:21 AM XML just describes data.
It is really cool, because you can use it in conjunction with XSL to transform data into what ever format you need.
This allows an application to just produce the data and not have to worry about its presentation, for example in a web application. It would only have to generate the data in an XML format and let the XSL worry about creating a HTML page out of it. This allows the application to concentrate on processing and not having to jump between html and code every couple of lines.
Ivan-Funio 04-08-2005, 11:20 AM I used XML to do a list contact in a Chat in Java It's very simple to create that kind of files.
And I used to do an agenda in Flash too.
It's easy because you can invent your tags
<user sex="Male">
<name>John Smith </name>
<address>With Pocahontas</address>
<email>jsimith@theforest.com</email>
<phone>555555555</phone>
</user>
mfonda 04-08-2005, 02:39 PM XML is simply a language to store and describe data.
It is very good at what it does, and is easily parsed by many different languages. It can be used for nearly anything, from web services to data storage to configuration settings.
More recently, web services have been using XML. It provides a uniform method to send and retrieve data. SOAP and XML-RPC are a few examples of XML Web Services.
Also, many websites and blogs use RSS (a type of xml) to syndicate the content, so the sites can easily be read from other programs, and users will be informed with all of the latest updates.
XML is also being used for configuration a lot lately, which is starting to replace previous formats such as ini.
It is also good for keeping things available in mulitple formats and styles. Say I were to write a book call "XML", I would probably write the book in XML.
Here is a little example:
<book>
<title>XML</title>
<author>Matthew Fonda</author>
<toc>
<item>Introduction</item>
<item>etc.</item>
<item>etc.</item>
</toc>
<chapter title="Introduction" number="1">Welcome to XML....</chapter>
<index> ... </index>
<glossary>
<item name="some word">definition of some word</item>
</glossary>
</book>
This would allow me to easily format the book however I want it, and if it were to be published, the publishers could easily manipulate the format. This is better than say writing it in a word processor and applying all formatting, it would be a pain to try and change the format of the entire book, but by having it in XML, it can be done in seconds.
mosey 04-08-2005, 05:06 PM One of the big deficiencies I've begun to feel is javascript's lack of capable XML parsers, even in newer browser releases. This is, I think, going to become more and more of an issue as more people add the XML HTTP object, which allows javascript to fetch documents over HTTP after a page loads, to their javascript code.
Roy@ENHOST 04-08-2005, 08:42 PM OK, I don't get this XML hype too.
XML = Overhyped Technology?
Its like every men and his dogs doing the XML thing.
A lot of people are just doing it coz its cool.
I mean its sounds more cool if you say "My appplication is XML based".
I think serialized array can pretty much do everything that XML can do. It is also more convenient to parse and easier to code.
I see a lot of people asking how to unserialize an XML string but Ive never seen one asking how to unserialize a serialized array.
I have asked this question many times "Why are you using XML?"
People will just blabber away about it as a paradigm in data exchange. Nothing solid and I have no idea what they are talking about and suspect they are doing it coz everyones doing it but don't want to admit it.
Can anyone shed some light?
mfonda 04-08-2005, 10:26 PM Originally posted by Roy@ENHOST
OK, I don't get this XML hype too.
XML = Overhyped Technology?
Its like every men and his dogs doing the XML thing.
A lot of people are just doing it coz its cool.
I mean its sounds more cool if you say "My appplication is XML based".
I think serialized array can pretty much do everything that XML can do. It is also more convenient to parse and easier to code.
I see a lot of people asking how to unserialize an XML string but Ive never seen one asking how to unserialize a serialized array.
I have asked this question many times "Why are you using XML?"
People will just blabber away about it as a paradigm in data exchange. Nothing solid and I have no idea what they are talking about and suspect they are doing it coz everyones doing it but don't want to admit it.
Can anyone shed some light?
XML is far superior when it comes to web services, especially things like SOAP, there is really no better way to do it. I can see your point in most cases, but it is clearly the best solution for web services.
Dan L 04-09-2005, 09:26 AM As I see it, XML is just a step further in separating content from presentation. With XML, you give your user a list of hierarchically stored data, and use XSLT to make presentation an afterthought.
Now that you have just XML, you can also syndicate it easily, et cetera.
dnguyen 04-16-2005, 10:11 PM What's So Great About XML?
Easy Data Exchange
Growth of propietary data formats
Conversion Programs (Applications, versions ..)
Data and markup are stored as text
Avoid store simple data in huge files
What's So Great About XML? (2)
Customizing Markup Languages
Banking Industry Technology Secretariat (BITS)
Financial Exchange (IFX)
Schools Interoperability Framework (SIF)
Common Business Library (CBL)
Electronic Business XML Initiative (ebXML)
The Text Encoding Initiative (TEI)
What's So Great About XML? (3)
Self-Describing Data
<?xml version="1.0" encoding="UTF-8"?>
<DOCUMENT>
<GREETING>Hello from XML</GREETING>
<MESSAGE>Welcome to Programing XML in Java</MESSAGE>
</DOCUMENT>
What's So Great About XML? (4)
Structured and Integrated Data
<?xml version="1.0"?>
<SCHOOL>
<CLASS type="seminar">
<CLASS_TITLE>XML In The Real World</CLASS_TITLE>
<CLASS_NUMBER>6.031</CLASS_NUMBER>
<SUBJECT>XML</SUBJECT>
<START_DATE>6/1/2002</START_DATE>
<STUDENTS>
<STUDENT status="attending">
<FIRST_NAME>Edward</FIRST_NAME>
<LAST_NAME>Samson</LAST_NAME>
</STUDENT>
<STUDENT status="withdrawn">
<FIRST_NAME>Ernestine</FIRST_NAME>
<LAST_NAME>Johnson</LAST_NAME>
</STUDENT>
</STUDENTS>
</CLASS>
</SCHOOL>
InternetArmy 04-17-2005, 04:44 PM XML just rocks. I use it for all application to application communication.
gogocode 04-19-2005, 12:38 AM XML has it's place. but developers must be careful that they don't use XML when a simpler, faster and equally adequate method works just fine.
I can't count the times when somebody has used XML for such silly things as interprocess communication where both processes are written in house and never will interact with other stuff, and even if they did it would be trivial to generate XML at that time should it be required.
Recently somebody saw a system I had written that passed back a ready made javascript structure from PHP to the browser though XMLHTTPRequest and the browser eval()'d it (like the Google Suggest thingee does), and they said that I should make it so that PHP writes XML out, and then javascript parses the XML and makes that into a structure and then uses that structure. Why?! What would the point of that be, going from PHP -> Javascript to PHP -> XML -> Javascript just adds in a pointless layer of abstraction. And yet, short sighted developers on the XML bandwagon do this <all/> <the/> <time/> .
Too many people see XML as some sort of panacea that should be applied to everything liberally, but they don't see the problems with XML when it's used incorrectly, or in silly circumstances. If a *human* is going to edit the data directly, then XML *can* be useful (but not in all cases), if a human is never going to see the raw file then there are generally better, more efficient, ways of representing data.
And as for XSL, oh boy, if that's not the crowning glory of misuse of XML I don't know what is. Programming, in XML, aijiji, that makes my head and fingers hurt just thinking about it.
Roy@ENHOST 04-19-2005, 12:54 AM Exactly my sentiment.
That's why I got pissed.
A lot of people seriously "abused" technology by using them for every single thing except washing the dishes.
Some guy "I created an XML based counter . how cool is that? "*snort* *snort* "It opens the XML file, unserialize , increment , serialize then write to file"
Me open the XML file.
<?xml version="1.0"?>
<name>counter</name>
<counter>3</counter>
Me "Why don't you use a plain text file?That way you dont have to serialize/unserializing the data?"
Him "But with XML-RPC, I can pull the count and display it on my other side. How cool is that? Now thats what I call server to server communication *snort* *snort* "Oh wait, Roy. Dya think I should use SOAP instead? It is becoming de facto standard if not already so"
Me "I repeat myself.Why don't you use a plain text file? You can still accomplish the same thing without complicating stuff"
He gave me a blank look, apparently dumbfounded followed by a period of silence. I changed the topic "So hows your car?".
I would like to add that more than 80% of the XML usage can be replaced with array or serialized array. Need interserver communication? You can Base64 the serialized array for that purpose. "
To illutrate my point,
Let's take nguyen's XML example:
<SCHOOL>
<CLASS type="seminar">
<CLASS_TITLE>XML In The Real World</CLASS_TITLE>
<CLASS_NUMBER>6.031</CLASS_NUMBER>
<SUBJECT>XML</SUBJECT>
<START_DATE>6/1/2002</START_DATE>
<STUDENTS>
<STUDENT status="attending">
<FIRST_NAME>Edward</FIRST_NAME>
<LAST_NAME>Samson</LAST_NAME>
</STUDENT>
<STUDENT status="withdrawn">
<FIRST_NAME>Ernestine</FIRST_NAME>
<LAST_NAME>Johnson</LAST_NAME>
</STUDENT>
</STUDENTS>
</CLASS>
</SCHOOL>
We can represent that XML with array:
Array
(
[SCHOOL] => Array
(
[CLASS attr] => Array
(
[type] => seminar
)
[CLASS] => Array
(
[CLASS_TITLE] => XML In The Real World
[CLASS_NUMBER] => 6.031
[SUBJECT] => XML
[START_DATE] => 6/1/2002
[STUDENTS] => Array
(
[STUDENT] => Array
(
[0 attr] => Array
(
[status] => attending
)
[0] => Array
(
[FIRST_NAME] => Edward
[LAST_NAME] => Samson
)
[1 attr] => Array
(
[status] => withdrawn
)
[1] => Array
(
[FIRST_NAME] => Ernestine
[LAST_NAME] => Johnson
)
)
)
)
)
)
Or serialized array:
a:1:{s:6:"SCHOOL";a:2:{s:10:"CLASS attr";a:1:{s:4:"type";s:7:"seminar";}s:5:"CLASS";a:5:{s:11:"CLASS_TITLE";s:21:"XML In The Real World";s:12:"CLASS_NUMBER";s:5:"6.031";s:7:"SUBJECT";s:3:"XML";s:10:"START_DATE";s:8:"6/1/2002";s:8:"STUDENTS";a:1:{s:7:"STUDENT";a:4:{s:6:"0 attr";a:1:{s:6:"status";s:9:"attending";}i:0;a:2:{s:10:"FIRST_NAME";s:6:"Edward";s:9:"LAST_NAME";s:6:"Samson";}s:6:"1 attr";a:1:{s:6:"status";s:9:"withdrawn";}i:1;a:2:{s:10:"FIRST_NAME";s:9:"Ernestine";s:9:"LAST_NAME";s:7:"Johnson";}}}}}}
Or Base64 of serialized array:
YToxOntzOjY6IlNDSE9PTCI7YToyOntzOjEwOiJDTEFTUyBhdHRyIjthOjE6e3M6NDoidHlwZSI7czo3OiJzZW1pbmFyIjt9czo1OiJDTEFTUyI7YTo1OntzOjExOiJDTEFTU19USVRMRSI7czoyMT oiWE1MIEluIFRoZSBSZWFsIFdvcmxkIjtzOjEyOiJDTEFTU19OVU1CRVIiO3M6NToiNi4wMzEiO3M6NzoiU1VCSkVDVCI7czozOiJYTUwiO3M6MTA6IlNUQVJUX0RBVEUiO3M6ODoiNi8xLzIwMDIi O3M6ODoiU1RVREVOVFMiO2E6MTp7czo3OiJTVFVERU5UIjthOjQ6e3M6NjoiMCBhdHRyIjthOjE6e3M6Njoic3RhdHVzIjtzOjk6ImF0dGVuZGluZyI7fWk6MDthOjI6e3M6MTA6IkZJUlNUX05BTU UiO3M6NjoiRWR3YXJkIjtzOjk6IkxBU1RfTkFNRSI7czo2OiJTYW1zb24iO31zOjY6IjEgYXR0ciI7YToxOntzOjY6InN0YXR1cyI7czo5OiJ3aXRoZHJhd24iO31pOjE7YToyOntzOjEwOiJGSVJT VF9OQU1FIjtzOjk6IkVybmVzdGluZSI7czo5OiJMQVNUX05BTUUiO3M6NzoiSm9obnNvbiI7fX19fX19
Another advantage of not using XML, way more people can use array then serialize/unserialize XML.
Originally posted by gogocode
XML has it's place. but developers must be careful that they don't use XML when a simpler, faster and equally adequate method works just fine.
I can't count the times when somebody has used XML for such silly things as interprocess communication where both processes are written in house and never will interact with other stuff, and even if they did it would be trivial to generate XML at that time should it be required.
Recently somebody saw a system I had written that passed back a ready made javascript structure from PHP to the browser though XMLHTTPRequest and the browser eval()'d it (like the Google Suggest thingee does), and they said that I should make it so that PHP writes XML out, and then javascript parses the XML and makes that into a structure and then uses that structure. Why?! What would the point of that be, going from PHP -> Javascript to PHP -> XML -> Javascript just adds in a pointless layer of abstraction. And yet, short sighted developers on the XML bandwagon do this <all/> <the/> <time/> .
Too many people see XML as some sort of panacea that should be applied to everything liberally, but they don't see the problems with XML when it's used incorrectly, or in silly circumstances. If a *human* is going to edit the data directly, then XML *can* be useful (but not in all cases), if a human is never going to see the raw file then there are generally better, more efficient, ways of representing data.
And as for XSL, oh boy, if that's not the crowning glory of misuse of XML I don't know what is. Programming, in XML, aijiji, that makes my head and fingers hurt just thinking about it.
Roy@ENHOST 04-19-2005, 01:10 AM By the way can I check out your XMLHTTP script? :D
fusionrays 04-19-2005, 08:33 AM Originally posted by Roy@ENHOST
Exactly my sentiment.
That's why I got pissed.
A lot of people seriously "abused" technology by using them for every single thing except washing the dishes.
I agree that xml being used for simple counters in overkill. However this doesn't mean that it is overhyped.
XML is text. The advantage of using XML over text is that there is a standard, and there are parsers that will parse the text into an array or other format.
If we were all to use our own text files to represent data, then we wouldn't have things like RSS feeds etc. If everyone did their own thing, you would not be able to use the same program to syndicate all the feeds.
XML has other features as well, it makes server to server communication possible between servers that do not share the same backend. One server could be using perl and the other php. In this case storing the array in a text file is pointless. Could the data be stored in a text file instead of XML? Sure. But why bother, when XML bring a standard, you can use DTDs to validate your data and there are parsers readily available to parse the xml. The text alternative being that you make your own standard, and you code your own parser to meet that standard, and then you have to get others to code to your standard if you want to share that data.
With regards to XSL, XSL is powerful when you want to represent the XML data as something different.
You can process the same xml data with different stylesheets to produce different documents. And the XSL is not limited to the data in the xml file, it also is coded to a standard which will transform any xml file that meets that standard.
Another cool thing you can do with XSL is :
Represent all your data in XML, detect which browser is accessing that data, and then transform the XML with the appropriate XSL to display the data in a way that is specific to that browser, you can have a XSL stylesheet for IE, Mozilla, Opera, WAP etc etc...
So my opinion is that XML is extremely useful for reprensenting/transforming data. :)
folsom 04-19-2005, 10:32 AM xml doesn't make anything possible; it is standards that make things possible.
Take edi for example. Edi has been in use for years, and it is human readable. Companies do just fine exchanging documents and making things happen automatically. At my company, we receive an edi order from a customer, it automatically enters an order in our erp, if the order matches a set of rules, an edi document is automatically sent to our shipping/warehouse company which automatically sends an edi document to our customer when the order ships. What makes this possible are the standards.
fusionrays 04-19-2005, 12:39 PM Originally posted by folsom
xml doesn't make anything possible; it is standards that make things possible.
Agreed, XML is just text after all.
Roy@ENHOST 04-19-2005, 05:41 PM I have a PHP and Perl code that communicate to each other using the method I illustrated. Base64 serialized arrays. :D
Originally posted by fusionrays
XML has other features as well, it makes server to server communication possible between servers that do not share the same backend. One server could be using perl and the other php.
fusionrays 04-19-2005, 07:28 PM Originally posted by Roy@ENHOST
I have a PHP and Perl code that communicate to each other using the method I illustrated. Base64 serialized arrays. :D
You know what I meant! :hammer:
fusionrays 04-19-2005, 07:36 PM Originally posted by Roy@ENHOST
I have a PHP and Perl code that communicate to each other using the method I illustrated. Base64 serialized arrays. :D
XML is human readable as well (as long as the standard supports it).
Base64 can't use the benefits of XSL transformation either. ;)
MattF 04-21-2005, 05:50 AM Roy,
I see where you're coming from, but XML is self describing and with the use of DTD I can validate the data is in correct form, this is good when you might not have contact with the developer of the remote script such as live currency checks. I completely agree about the counter, but when describing complexed classes which often has variable length collections (rather than 1 to 1) in themselves things become complexed. Testing/debugging is also much easier when using XML.
|