What is the point in XML?

Discussion in 'Web Design and Development' started by timmillwood, Apr 26, 2007.

  1. timmillwood macrumors 6502a

    Joined:
    Apr 7, 2006
    #1
    I have been set the task in uni to make two sets of static html pages using XSL techniques and multiple XML data source(s).

    I cannot see the point in making static HTML pages in XML, the only use for XML I can see is RSS feeds.

    If you wanna help, feel free...
     

    Attached Files:

  2. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #2
    The purpose of XML is to be a generic, human-readable markup language that serves as a basis for consumption.

    XSL exists to turn one XML doc into another XML doc. For example, take this generic XML, run it through an XSLT and get an HTML page and an RSS feed from it. Or you could use that XSLT to turn it into another XML that some external system might understand, etc.

    The crux of XML is that it's nothing and everything at the same time. By itself it isn't much, but it's an excellent, generic format on which you can build any number of things.
     
  3. GothicChess.Com macrumors regular

    GothicChess.Com

    Joined:
    Apr 6, 2007
    Location:
    Philadelphia, PA
    #3
    And this differs from HTML in what way?
     
  4. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #4
    HTML is a specific markup language for the web. XHTML tries to bring XML-style formatting and rules to HTML, but HTML is web-specific. The DTDs used to validate HTML documents allow you to only use a specific set of elemtns and attributes. XML has no such restriction. You can create whatever elements/attributes you want.

    This thread might help.
     
  5. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #5
    Also, the idea of XML is that it stores concepts and information, in a structured fashion, rather than just laid out text. So the big difference between HTML and XML is that XML can deal with conceptual categories and types of information.
     
  6. dcv macrumors G3

    Joined:
    May 24, 2005
    #6
    In very basic terms: think of XML as "portable data" (or rather a way of describing that data). It's essentially just a markup language for describing anything you like. XSL is the effective "stylesheet" language to transform your XML data into something meaningful. It isn't restricted to just the creation of web pages, as HTML is. I've been using XML/XSL for years, for example publishing information from RDBMS and Domino databases into PDF format.
     
  7. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #7
    I like the "everything and nothing" definition of XML. :) It's definitely getting a lot of hype, some of it undeserved. I have a coworker who thinks it's the next greatest thing to sliced bread, and we use it on our project for all kinds of things including external data representation.

    In some ways you can think of HTML as a specific use of the XML format (although this isn't 100% technically accurate).

    Suppose you're writing a phone book program that will display a list of names and phone numbers. You want to save the phone list to a file on disk. You've got a couple of options for how to do this:

    - One way would be to have C++ or Java just "serialize" the data structure you're using and dump it to a file. You get a binary file that would look like gibberish if you tried to view it in, say, TextEdit.

    - Another way would be to dump the info into a text file, say, name followed by phone number, separated by commas. Or pipe symbols (Bob|555-1212). Or on separate lines. Whatever, it's your program.

    - A third way would be to define an XML file format, that maybe looks like this:

    <phonelist version="1.1">
    <entry>
    <name>Bob</name>
    <number>555-1212</number>
    </entry>
    </phonelist>

    What does that buy you? Well, if you were to open this up in TextEdit, it would make much more sense to you than the binary gibberish or even the plain-text (but proprietery encoding) format. You could edit this file by hand (or with other tools) and your phone book app should still be able to read it. Assuming you make the format rules available, anyone else could make phone book files, so you've suddenly created an open file format. If you can convince other phone book authors to use the same rules, you've got an open standard.

    You've got enough code in there that computer algorithms know how to work with or translate the data into other forms. Your rules allow you to validate the data to confirm the phone list isn't corrupted.

    Within your program, you can use an XML parsing library and "boom" load or save the data in just a couple of steps, as opposed to writing up whole routines to manually parse some other file format.

    But there's no magic to it. It's just a structured way of writing stuff into a text file. So is HTML.
     
  8. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #8
    HTML is a subset of XML. The HTML subset can define how text is to look and can define forms. But here at work we deal with spacecraft telemetry. HTML is not good at all for specifying the format of the telemetry data but XML is well suited to that job.

    At other job we used XML to describe a transaction such as (in our case) the purchase of some metal from a mill. The XML file is what was moved between the buyer's purchasing system and our metals brokerage company.
    The neat thing about XML was that we could transform it into HTML so the order could be read by a human or we could transform in into SQL to the Oracle DBMS could be updated or we could transform it into some funky text based records to feed some 30 year old accounting system at a steel mill.

    There is more to computing than the web. HTML is only good at web pages. Other XML subsets are good at other things.
     
  9. timmillwood thread starter macrumors 6502a

    Joined:
    Apr 7, 2006
    #9
    but if you were making a website to list all of the CDs that you own would you do it in XML or a database.
     
  10. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #10
    You put the CDs in the database, but lots of XML would be flying around in the middleware layer....
     
  11. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #11
    Exactly. Store the info in a database, and have something pull the information out of the DB and into an XMl file. Then use the XML to pass the information from the database to something else (a program, a web service, a webpage, whatever).
     
  12. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #12
    The way I'm starting my website is with the idea of AJAX, XML, PHP, MySQL.

    I will have the user input data, and that's sent to the server to be stored, and then whenever the proper PHP function is called, it'll retrieve it and put it in an XML file so that AJAX can display it all pretty-like. I know there's an easier way of doing this, but that requires me to use XSL (which I do not like).

    Steve
     
  13. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #13
    Have you considered JSON instead of XML? Depending upon how much data you're sending back, the XML overhead may not be necessary.
     
  14. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #14
    XML stitches a lot of formats that were previously unrelated, under one umbrella.

    OS X plist files, web pages, word documents, itunes playlists, etc... All can be handled by XML
     

Share This Page