SitePoint Sponsor

User Tag List

Page 1 of 6 12345 ... LastLast
Results 1 to 25 of 142
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is the advantage of XML?

    I just read the sample chapters of the new XML book, and im kinda confused, what is the advantage of XML over plain XHTML?

    The book states that it is easier to display documents in mobile devices using XML, and that is easier to translate content language. But, it doesn't demonstrate either of them, nor gives any other reasons to use XML. I find the XML concept intresting and it could be the next big thing...but currently i cant see why i should use it over XHTML and PHP...

    I'm kinda sure that its very easy to implement a template system and different languagefiles in PHP and XHTML only. And if XHTML is designed to just make it easy to make web documents, I cant see why i should use XML if i dont plan to view my site in mobile devices...

    Anyone care to enlighten me ?

  2. #2
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XML and XHTML do completely different things,

    xhtml is a markup language for displaying web documents.
    xml is a standard for storing/transmitting content/data.

    there is absolutely no presentation data in an xml file.
    xml is converted into a xhtml by an xsl stylesheet.

    the same xml content can be used to display 2 completely views or be used on completely different pages accross the internet.

    example: you can parse an xml file sitting on my server and create your own webpage using the information I've added to my xml file.

    you then convert that xml content into an xhtml document so you can display it as a webpage on your server.

  3. #3
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the most basic use of XML is for two systems to understand the same piece of data. Before XML markup if you wanted to send some data to a java server you would make a comma seperated list of data

    jim,test,data,but,what,does,this,mean

    that format is very fragile, every field needs to be exact, if you add a field in the middle then you break the code. And what data is that string describing?

    xml solves human readability and computer readability by tagging data
    <customer>
    <name>jim</name>
    <addresss>555 oak lane</addresss>
    </customer>

    if you look at that data you know exactly what it does. XML at its basic function is for transmitting data across systems. By adding a schema around this document you create a "contract". Which means you validate the xml you get against the schema to see if it complies with the contract you have with the other party.
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  4. #4
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the most basic use of XML is for two systems to understand the same piece of data. Before XML markup if you wanted to send some data to a java server you would make a comma seperated list of data
    What is wrong with CSV for data for data exchange?

    that format is very fragile, every field needs to be exact, if you add a field in the middle then you break the code.
    If course both parties need to have a common data model. It's no use sending data that the other party does not understand of course.

    xml solves human readability and computer readability by tagging data
    I can understand that it improves human readability, but why is it necessary for humans to be able to read a format that is used to transfer data between two computer applications? How does it improve computer readability? I don't see why computer application would find <bla>bla</bla> more readable than bla,bla,bla.

    if you look at that data you know exactly what it does.
    Data does not "do" anything, it means something. Again why is it necessary for, presumably humans, to be able to figure out what the data means when it is used for exchange between computer applications whose designers have upfront agreed a meaning for the data they send to eachother?
    I once had a problem.
    I thought: "Oh, I know: I'll just use XML!"
    Now I had two problems.

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in simple terms, xml is a human readable, standard, multi-platform, web based storage system.

    xhtml is a markup language for formatting content for a web browser.

  6. #6
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Captain Proton
    How does it improve computer readability? I don't see why computer application would find <bla>bla</bla> more readable than bla,bla,bla.
    jim,84.48,test,3

    what does that data mean to a computer? 4 fields? thats pretty generic

    if I send
    84.48,jim,test,3

    will the computer know the difference? its still 4 fields however I just switched a string with a float

    if you create a schema for your xml document you can state that
    <name> must be a string
    <price> must be a float
    <id> must be an int

    allowing the computer to know what the data is and if something is sent that does not agree on that contract, it is an invalid data stream. Can you please write up how you would be send a complex type using csv? that java could understand from a php data feed?

    XML is built for computers to understand the data they receive, being human readable is a by product of the format.

    Lets not turn this into a discussion of whether XML is just hype, its clearly not, its here, in use, every nanosecond.
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  7. #7
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rikshot
    I just read the sample chapters of the new XML book, and im kinda confused, what is the advantage of XML over plain XHTML?
    Huh?!? XHTML is XML. Which goes to show one of the cool things you can do with XML -- XHTML docs.

    You can also use XML to delimit and describe data such as the example jplush76 shows. The upside as noted is that the description of the data goes with each value. And it is human readable to an extent. The downside of that is that the XML document is much bigger than the delimited one.

    PHP is generator language in that browsers don't understand PHP but the do understand the XHTML or XML that PHP generates.
    Christopher

  8. #8
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is wrong with CSV for data for data exchange?
    Nothing, to a certain point I suppose, but I've always thought of it (CSV) as having no structure. Without structure, you have no means to represent the data, none whatsoever actually.

    but why is it necessary for humans to be able to read a format that is used to transfer data between two computer applications?
    I don't actually feel the format it's self has anything to do with human readability, but what has got to do with human readability, is what you can do with that format? Which kind of backs up my first response from the quote I made of your post.

    The computer is only interested in the data, not what to do with it in other words

    to be able to figure out what the data means when it is used for exchange between computer applications whose designers have upfront agreed a meaning for the data they send to eachother?
    You've said as much yourself... It's about distribution of the data. We have XML as such as the format as it is, because the people of the W3C had the obvious vision of what they, and others that contributed advice and contributed their views, could do with just that format.

    Big business had an invested interest in how XML was developed as a format, and I believe that they made themselves apparantly clear huh?

  9. #9
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Nothing, to a certain point I suppose, but I've always thought of it (CSV) as having no structure. Without structure, you have no means to represent the data, none whatsoever actually.
    First, delimited data obviously has structure. The goal of delimited data files is to provide the minimum structure overhead necessary. Usually that is a single character column delimiter and a single character row delimiter. And it's usually pretty readable and searchable. Plus it is trivially imported into all data manipulation software like databases and spreadsheets.

    One of the questions is about embeded schema information as opposed to external schema information. For example, a database has very little embeded schema. When you fetch rows you get about the same information as delimited data gives you.

    Data with embedded schema like XML excels in systems where the sender and recievers of the data do not want to maintain and syncronize common external schema.
    Christopher

  10. #10
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arborint
    Huh?!? XHTML is XML. Which goes to show one of the cool things you can do with XML -- XHTML docs.

    You can also use XML to delimit and describe data such as the example jplush76 shows. The upside as noted is that the description of the data goes with each value. And it is human readable to an extent. The downside of that is that the XML document is much bigger than the delimited one.

    PHP is generator language in that browsers don't understand PHP but the do understand the XHTML or XML that PHP generates.
    Well i know one thing, XML isnt XHTML. Im still uncertain, in exact, why should i use XML to make a cms system. In the sample chapters of the book, the building starts off with defining what an article consists of. Id, Title, Poster etc. Now why cant you do this with MySQL table? No need for XML pages.

    Then, when the book starts to transfrom the XML page with XSLT to an XHTML page, i get confused again...why use XSLT to transform the page if you cant use CSS over it. He uses html attributes like bgcolor in tags that arent up to the current css designing, where all design is defined in a css file.

    It seems that there is another meta-language for the XML css replacement, XLS-FO, that is similar to css...why? why should i use this, instead of just CSS?

    Atm, i cant see why i should use XML and the other technologies to build websites...

  11. #11
    SitePoint Addict timvw's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Gasolene
    XML and XHTML do completely different things
    They both "do" absolutely nothing.

    Quote Originally Posted by Gasolene
    xhtml is a markup language for displaying web documents.
    xml is a standard for storing/transmitting content/data.

    http://www.w3.org/TR/xhtml1/#xhtml
    http://www.w3.org/TR/2000/REC-xml-20001006
    http://www.w3.org/MarkUp/SGML and ISO8879

    So XHTML is a subset of XML is a subset of SGML

  12. #12
    SitePoint Addict timvw's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jplush76
    xml solves human readability and computer readability by tagging data
    <customer>
    <name>jim</name>
    <addresss>555 oak lane</addresss>
    </customer>

    if you look at that data you know exactly what it does. XML at its basic function is for transmitting data across systems. By adding a schema around this document you create a "contract". Which means you validate the xml you get against the schema to see if it complies with the contract you have with the other party.
    So you already said it yourself, XML doesn't solve the human readability and computer readability.

    With a DTD/XSD you can test if the XML is valid data.

    But the process of making information of that data is not specified. So, XML (even with a DTD/XSD) is not human readable if you don't know how the data should be interpreted.

  13. #13
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by timvw
    So you already said it yourself, XML doesn't solve the human readability and computer readability.

    With a DTD/XSD you can test if the XML is valid data.

    But the process of making information of that data is not specified. So, XML (even with a DTD/XSD) is not human readable if you don't know how the data should be interpreted.
    thanks for the theory lesson


    however I dont think I said that at all. data with no context will always be meaningless so I dont see your point.
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  14. #14
    SitePoint Addict timvw's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the advantage of XML is that virtually every environment has tools to generate/parse XML...

    So instead of defining some (binary) format and writing the code to generate/parse it, you can use the allready available XML tools and spend your time on other parts of the code.

  15. #15
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think anyone mentioned this, but XML also succeded because of RMI (XMLRPC and SOAP). It is flexible enough to define any data structure in a text file that can be transmited over HTTP, avoiding firewalls. This is the main disadvantage of CORBA (which is still in use, especially on the Java platform), and that is why SOAP was looked at as the next best thing (although it appears it has almoust all the disadvantages). Also, it is said XML is human-readable as opposed to CORBA's IDL.

  16. #16
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by timvw
    So you already said it yourself, XML doesn't solve the human readability and computer readability.

    With a DTD/XSD you can test if the XML is valid data.

    But the process of making information of that data is not specified. So, XML (even with a DTD/XSD) is not human readable if you don't know how the data should be interpreted.
    You definitely twisted some concepts together to make a point. There is a difference between readable and interpretable, but you are mixing them together. There is also a difference between solve and improve, and you mix those as well.

    jplush76 was rightly noting that a format with schema information embeded with the data is more "readable" than one that is just data. Interpretation has not been discussed.
    Christopher

  17. #17
    SitePoint Addict timvw's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arborint
    You definitely twisted some concepts together to make a point. There is a difference between readable and interpretable, but you are mixing them together.
    Ok, i mixed readable and interpretable.


    Quote Originally Posted by arborint
    There is also a difference between solve and improve, and you mix those as well.
    I agree there is a difference, but i did not mix them. jplush76 said: xml solves human readability and computer readability by tagging data. And i said: XML doesn't solve the human readability and computer readability.


    Quote Originally Posted by arborint
    jplush76 was rightly noting that a format with schema information embeded with the data is more "readable" than one that is just data.
    I can agree with that.

  18. #18
    SitePoint Addict
    Join Date
    Aug 2005
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think as a developer there are better ways to approach exchanging data. In my case I have more developers say things like... "I'm working in PHP can you deliver content in a different method that uses PHP(s) strenghs instead of sending slow processing XML!"

    I am sort of starting to understand this. Sure XML is a standard but how much does it help the end developer that wishes to deliver the fastest service to his/her's clients! If your the centralized delivery agent then you should gather the feeds that you subscribe to and then make those feeds available to your clients in a different structured document that is better suited for their development language!

    printf

  19. #19
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's what I think is a great implementation of XML.


    The Problem:

    You have an Indian Language in a SQL database online. Not only do you need this online database search able, but you need to create a downloadable cdrom that is also able to search the database.

    The Solution:

    I dump specific text to xml files, and use Flash to search the xml files on the cdrom. It's actuall brilliant and requires nothing more than the flash file, and a directory containing the xml files.

    Perfecto... hehe
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  20. #20
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XML has one big advantage. It is Unicode compatible. At least most of it

  21. #21
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by REMIYA
    XML has one big advantage. It is Unicode compatible. At least most of it
    as any text file written in a unicode capable text editor

    Quote Originally Posted by timvw
    I agree there is a difference, but i did not mix them. jplush76 said: xml solves human readability and computer readability by tagging data. And i said: XML doesn't solve the human readability and computer readability.
    Have you ever worked with CORBA and it's interface definition language ? When being able to describe complex data structures only by using echo, that's what I call human readable.

  22. #22
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    as any text file written in a unicode capable text editor
    Yes but the XML parsers keep in mind that probably, the parsed text is Unicode text

  23. #23
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in simple terms, xml is a human readable, standard, multi-platform, web based storage system.
    XML is a web based storage system? A hard disk is a storage system, something physical that can carry data. Are you saying XML is a physical thing that can carry data?

    One of the questions is about embeded schema information as opposed to external schema information. For example, a database has very little embeded schema.
    If by schema you mean a description of the data (it's attributes and it's data types for example) and integrity constraints, then a database has very much embedded schema. The fact that SQL databases only support some constraints and data types is another matter.

    When you fetch rows you get about the same information as delimited data gives you.
    You get from the DBMS what you asked (queried) for. Would it be very strange to assume that if you specify what you want you also know what answer (or result set if you like) you can expect?

    Data with embedded schema like XML excels in systems where the sender and recievers of the data do not want to maintain and syncronize common external schema.
    So one party is sending the other data that is meaningful to itself but meaningless to the other party (meaning - no pun intended - that the other party does not onderstand that data)? No schema in the world is going to solve that problem.

    I think the advantage of XML is that virtually every environment has tools to generate/parse XML...

    So instead of defining some (binary) format and writing the code to generate/parse it, you can use the allready available XML tools and spend your time on other parts of the code.
    You are correct about the availability of tools is an advantage. However the same can be said for any storage format that has lots of tools available, be it a binary format or 'human readable'. So that argument is not valid.
    I once had a problem.
    I thought: "Oh, I know: I'll just use XML!"
    Now I had two problems.

  24. #24
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    NY, USA
    Posts
    712
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rikshot
    Im still uncertain, in exact, why should i use XML to make a cms system. In the sample chapters of the book, the building starts off with defining what an article consists of. Id, Title, Poster etc. Now why cant you do this with MySQL table? No need for XML pages.
    Exactly, the notion of using a bunch of XML files to store data for a CMS, is not what XML was meant for, and a poor approach to application design. XML was not meant to take away the job of a database. Yes it CAN be employed in this manner... but just because you can doesn't make it sensible to do so.

    XML is not meant for data storage as much as a data exchange. It's great in that regard. It is better than using comma delimited files or other ways to pass data, IMHO. XML files can take a data source, and present it in a meaningful way where the data is organized and descriptive for the recipient regardless of platform.

    XML has it's place, and it is definitely here to stay. But I would not use it for anything beyond what it's meant for... the transfer of data in a generic way that all other platforms can understand and use and parse. You don't need to know or care who's accessing the data and what their platform is. That's why we have this standard, that's pretty much the whole point.

    As for the handling and storage of data within your own application, there are a few (but very few) reasons in my experience to employ XML to retrieve data and move it around. That is the job of your database. Someone mentioned (can't remeber if it was this thread or another)... the benefit of simply moving XML files should your app move to another platform. Well, if you have your database access layer properly abstracted from your business logic... this is pretty much a non-issue.

    To summarize
    XML = a standard for data sharing and exchange regardless of platform.
    Database = data storage and retrieval within your own apps. (still)

  25. #25
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cringer
    Exactly, the notion of using a bunch of XML files to store data for a CMS, is not what XML was meant for, and a poor approach to application design. XML was not meant to take away the job of a database. Yes it CAN be employed in this manner... but just because you can doesn't make it sensible to do so.
    Um, then why did the author wrote the book? As far as ive read the sample chapters, he doesnt utilize databases at all? Or does he in the full book? The book seems to be a complete waste of time, if it uses XML to make a CMS when XML is not ment to be used like that...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •