Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML im a little confused 1

Status
Not open for further replies.

dougiep

Technical User
Sep 30, 2006
2
US
Can somone explain to me exactly what is xml and how is it used on everyday webpages? A lot of clients i worked with say that xml is very complicated, is it a programming language or more similar to html? Any xml experts in the house?
 
XML is eXtensible Markup Language. It's like HTML (HyperText Markup Language), but you can define the tags yourself.

It's very easy to output an XML file. It's just a text file (and human readable at that) with an XML header line, and tags of the form <tag>data</tag>. Tags may be nested and/or have attributes (<tag attrib1="stuff" attrib2="morestuff">) associated with them. One proviso, you must have one tag which "wraps" all the other tags.

For example, if you're doing a book database, your wrapper tag might be <library>, like this:
Code:
<library>
   <book> </book>
   <book> </book>
   <book> </book>
</library>

Depending on what language you're using to read an XML file, that process can be easy or hard. Languages such as PHP have libraries that you just pass a filename, and it builds a data structure ready for you to manipulate. There's even a language, XSLT, which exists purely to manipulate XML files. On the other hand, if you're using an ancient C compiler, you may have to find a copy of the Expat library and learn about push vs. pull and other concepts which aren't relevant with modern DOM (Document Oriented Model) methods.

For "everyday" webpages, XML is pretty much unnecessary.

What XML can help you do: eCommerce. Data driven web pages which aren't complex enough to require SQL.

Give me some guidance here or I'll babble for ages...
 
Thanks Miros! How can xml be used on blogs? I find the source code to lets say blogger accounts to be very confusing. Are xml and atom languages written in xml?
 
XML could be used for a startup blogger site. However, unless you've got a very small user base, you'd be moving to SQL very quickly.

The problem with allowing formatting of almost any kind in user-entered text is that people could put stuff in that would mess up the predefined parts of your pages, either accidentally or maliciously. You really are better off using an existing system (maybe Mambo) that you'd only have to configure. I'm sure you can find an existing, mature product that will fill your needs.


 
dougiep,

You may well have noticed a little orange "XML" button on a lot of web pages. This is what is called a RSS (Rich Site Summary/Really Simple Syndication) feed. Basically, frequently changing web content is provided as an RSS feed by site authors so that users who are interested in seeing the latest news headlines/latest blog writings, for example, can use an "aggregator" (which can be a standalone program or built into a web browser) to retrieve RSS feeds at regular intervals and display them in a nice interface.

Hope this helps you to see another application of XML on the Web.

Actually, just as an extra point you can use XML instead of HTML to author your site's data/content and use a CSS/XSL file to style it, so as to achieve true separation of content and style. As I recall, I think this does work in newer versions of IE and FF. But the standard approach supported by all browsers is obviously HTML, so don't abandon it just yet!

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Sorry, I forgot to add the following:
I see XML primarily as a data transmission format. One of its big strengths is that it is self-describing and, when accompanied by an XSD file (an XML Schema), it can be self-validating too.

I have been using XML recently to provide web services from a server to many clients using a technique called XML-RPC which stands for Remote Procedure Calling (where one PC, the client, basically runs some code on a remote computer, the server). It's really powerful because you can provide procedures for interrogating a database to clients - which opens up myriad of potential applications.

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top