Click to See Complete Forum and Search --> : XML'S Purpose?


Mistshade
04-23-2006, 03:23 PM
What is the point of XML? Every single tutorial said that "xml does nothing." Can anyone give me an example of what XML can do?

Ultimater
04-23-2006, 03:43 PM
http://en.wikipedia.org/wiki/XML
XML I find to be most-useful because many langagues both client side and server side, including PHP and JavaScript, both support XML parsing to make it easier to manage the data. Although you can use any text-based data structure string when passing data from one program to another XML RSS feeds seems to be more a convention that follows standards than a langauge. I generally think of XML as a pseudo code used for the purpose of passing data from one application or program to another. People generally tend to confuse XHTML with XML and XHTML with HTML. HTML is a language to take your code and render a screen for the user. XML is a "language", I'd rather call it a generally accepted conventional structure of data, and nothing BUT a bunch of data which doesn't render a screen for the user because it isn't executed. XML became so popular that newer modern languages started writting methods to handle XML data structure and parse them much eaiser to save the programmer the time and the effort. The programmer doesn't have to use XML as his/her data structure for parsing and could have used any made-up structure he/she desires. An advantage to using the XML structure of data is many languages support XML strutured data parsing to make it easier for the programmer to work with the data while coding in their favorite programming language.

HTML takes the programmer's code and gives the user a screen.
XML is a convential structure of data just like a TXT file on your desktop that doesn't do anything but "sit" there until requested.
XHTML is a language that combines HTML and XML taking programmer's code and giving the user a screen in addition taking upon itself the standards and shortcuts of XML which can be useful in saving the user typing. Structured coding is very important and XHTML offers a few more coding features to better orginize your code. I perfer HTML over XHTML, however.

NogDog
04-23-2006, 06:10 PM
XML is a means of storing data in a organized manner by way of a text file. XML by itself does not "do" anything with that data. However, because it is stored in a format that can be read by essentially any operating system and is structured as per an open-source standard, it is very portable and can be accessible to virtually any application (if you add the necessary code to that application, of course).

So if you combine a XML file with a XSLT file, a modern web browser can transform that XML into XHTML which can then be displayed like any normal web page. But much more important is the fact that you could also write a [pick programming language of choice] application that reads the XML data, manipulates it, crunches it, mangles it, and whatver else you want to do with it, then output the results - which might include XML data being sent back to the originating system.

felgall
04-23-2006, 06:25 PM
The latest version of Microsoft Office uses XML as the format for storing all of your documents. XML is just a file format but one that follows certain standards that means that its use if far more flexible than proprietary formats.

So if XML does nothig then the lastest Office also does nothing and prior Office versions do less than nothing. Obviously this isn't true as all versions of Office can do lots of things. With your documents stored in the XML format used by Office you can also use them for lots of other things that don't involve Office.

rayhab
04-25-2006, 01:37 PM
so can XML be used in place of a database for webpages?

russell
04-25-2006, 03:14 PM
It can, but is usually a poor *replacement* for a database. It makes a nice transport mechanism from your db to application at times. The 2 things that make xml so powerful (though it "does nothing" by itself are (1) it is hierarchical in nature and (2) it is self describing data. There are many data structures that make more sense in a "tree" style format than a tabular one.

Ultimater
04-26-2006, 02:19 AM
You could make a database out of a flat TXT file however as each entry appends the file, the file will get larger and larger and the parsing time gets longer and longer. Just imagine every time you made a post on webdeveloper.com that the forums got slower and slower. One day the forums will take 20 seconds to load, the next day 30 seconds to load.... 5 minutes to load. You get the picture. The reason why a database is used to stash data, and database languages like MySQL are used and worth learning, is because the data doesn't have to be parsed because the computer stores the info in a 2nd virtual dimention like an array. Since a TXT file is a bad replace for a database, so would be an XML file. That's all XML is, a bunch of text orginized in a conventional way.

felgall
04-26-2006, 03:27 AM
There are several different sorts of databases.

1. Flat file.
2. Heirarchical
3. Network
4. Relational (eg. mySQL)
5. Object Oriented

Each of these is progressively more advanced in the structures and lookup methods that it uses compared to the ones higher in the list. I would be surprised if there were not already an object oriented database that uses XML to pass data from and to the database (or at least one currently under development).

russell
04-26-2006, 02:49 PM
true, and as stated xml is an excellent transport. it is a poor replacement for an rdbms which is what is generally meant by "database" in the context of questions like these.