SitePoint Sponsor

User Tag List

Page 1 of 6 12345 ... LastLast
Results 1 to 25 of 142

Hybrid View

  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 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

  4. #4
    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!

  5. #5
    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.

  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 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!

  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 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

  8. #8
    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.

  9. #9
    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

  10. #10
    Web Design Ireland cianuro's Avatar
    Join Date
    Jun 2004
    Location
    Dublin Ireland
    Posts
    914
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jplush76
    the most basic use of XML is for two systems to understand the same piece of data
    For me, that was the best basic explaination ever. Its quite difficult to get a head around what XML is initially.

  11. #11
    SitePoint Guru Galo's Avatar
    Join Date
    May 2005
    Location
    Holland!
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cianuro
    For me, that was the best basic explaination ever. Its quite difficult to get a head around what XML is initially.
    Dont forget the Structure that is holding the data, it's not about the actual concrete data, data often comes from directives who refer to a piece of data which eventualy comes from a database, the structure XML presents is relevant, the data can come from anywhere, even a simple text file.

    I tend to see XML as a IL (Intermediar Language) so different systems can talk the same smalltalk
    Business as usual is off the menu folks, ...

  12. #12
    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.

  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 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!

  14. #14
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    belfast
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Captain Proton
    What is wrong with CSV for data for data exchange?
    Haha, was reading another thread and came across this as a sig:
    Quote Originally Posted by pippo
    "Any fool can write code that a computer can understand.
    Good programmers write code that humans can understand."M.Fowler
    I think this says it all.

    Also, just noteing ... SVG is one area where XML is playing big - just look at Adobes support for this format.

    From what I know google maps uses XML along the same lines as SVG.

    I'd say adopting a DB architecture for that app would have been very difficult to implement.

  15. #15
    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.

  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 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

  17. #17
    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...

  18. #18
    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)

  19. #19
    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...

  20. #20
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    NY, USA
    Posts
    712
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rikshot
    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...
    Not sure what your gettin at, I don't know why the author wrote the book, I'm actaully referring to the site point article of authoring an XML driven CMS. Sorry if I have the wrong thread here. My bad.

    Does he utilize databases in his book, I couldn't begin to tell you because I haven't read it.

    Quote Originally Posted by rikshot
    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...
    I would agree with that sentiment. XML's main purpose is to share data in a "standard" way, regardless of platform, language or whatever. It was never meant to replace the role of a database, especially within an application where the data never leaves the application.

    If data has to be shared across apps, or distributed out to other businesses then XML is a nifty solution.

    Why one would bother with XML to build a fully self sufficient CMS is beyond me... and perhaps I'm missing something here, I certainly don't "know-it-all".

    XML would come into play if you wanted to syndicate your content to outside sources and had no clue how the reicpient would recieve that data.

    Kinda like: http://www.sitepoint.com/syndication/

  21. #21
    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?

  22. #22
    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

  23. #23
    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.

  24. #24
    SitePoint Addict psyon's Avatar
    Join Date
    May 2004
    Location
    Cedar Rapids
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by timvw
    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.
    So why wasnt a universal binary format developed? If most of the parsing is done by computers, it would be easier for a computer to read binary forms, rather than parsing text.

  25. #25
    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 psyon
    So why wasnt a universal binary format developed? If most of the parsing is done by computers, it would be easier for a computer to read binary forms, rather than parsing text.
    Don't blame me for that :P

    Edit: That is why they are trying to push binary xml now, not?

    (I wanted to ask: Why do most linux distros use plain text in /etc instead of a binary register? But that's not completely right because you have a human <-> machine interaction there instead of a machine <-> machine)


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
  •