• Hey Guest. Check out your NeoGAF Wrapped 2025 results here!

XML Question

Status
Not open for further replies.

pnjtony

Member
I've been making websites for myself and friends for the past few years. I never learned HTML. I just used PageMil and then Dreamweaver for everything and have gotten by quite well for myself as far as simple sites go.

I've got the itch to expand a little bit and thought XML might be something interesting and usefull and hopfully not too complicated. I decided to do some HTML tutorials to familierize myself with the syntax so when I view source, it makes sense and also because whenever I've seen an XML tutorial they strongly suggest HTML. As I've looked through some XML tutorials though, I get the feeling that for it to be of any real use I also need PHP, ASP or Java knowledge.

Is this true or can I use XML with HTML effectivly without being able to code PHP?
 
XML and HTML are markup languages. Think of XML more as a flat file database than web based content. It's going to be more useful combined with a scripting language like PHP. You can still do some neat stuff with XSLT (xml stylesheets) to create some cool content based features.

I don't really see the point or usefulness of XML without some non markup language coding behind it.
 
sefskillz said:
XML and HTML are markup languages. Think of XML more as a flat file database than web based content. It's going to be more useful combined with a scripting language like PHP. You can still do some neat stuff with XSLT (xml stylesheets) to create some cool content based features.

I don't really see the point or usefulness of XML without some non markup language coding behind it.

yeah, but when using XML with XSLT you're more or less using it like a somewhat limited scripting language anyway. It's real usefulness is with a web-based scripting language (ASP, Javascript, PHP, etc).
 
In order to be able to use XML for anything such as transforming it into a web page, you will indeed need to pair it with some other programming language. XML itself is not a programming language - just a specification for how to build 'self describing' data formats in a human readable format.

XSLT is a templating language that can transform the data contained in XML into another format. Traditionally this has been HTML, but there is no such requirement that it be HTML. Java, Javascript, C# and .Net clan, PHP, Perl, etc. all have libraries for being able to easily read, parse, and do useful stuff with XML as XML by itself is just a data format.
 
So HTML and XML aren't enough...gotta include PHP right? I single out PHP cause that's what I'm most likely going to buckle down and learn.
 
XML describes content. It's a method for marking up content -- it doesn't define any display behaviors as HTML does. Its primary pupose is data markup, not style. An XML "document" is not a program or a script, but more of a visual-friendly text-based "packet" of information with tags used to identify specific information within it.

The XML tags are defined by their schemas, which are declared using DTD or XSD files. The organization and structure of these tags and the attributes you can set on them are defined in these files.

You can transform XML using XSLT to a display- or style-driven format, like HTML. XSLT templates describe how to transform a specific XML tag into another format -- for example, it could describe how to transform an XML blob containing customer information into a HTML table.

One doesn't really learn XML. There ain't much to learn about it, syntactically, since the practical behavior is defined by its schema(s) -- it's just angle brackets and quotes and equals signs and CDATA blocks. What one DOES learn is:

DTD and/or XSD, which are used to declare the tags, attributes and structure within an XML document;

XPath, the query format used to discover hierarchical data within an XML document and traverse the Document Object Model (DOM, which is a tree representing all of the nodes in the document as well as the attributes and entities), and which enables you to effectively use the following:

XSLT, which allows you to use XPath queries to apply templates to the data selected by your XPath queries in an ordered fashion;

and XML parsers, such as MSXML, which enable to you to traverse XML documents from within your application and collect the data in it for processing, or to create new XML documents to pass to other applications.
 
Why are companies shifting to XML for file formats? Like Office, and the fact that Premiere Pro currently uses it? A project file I'm working on now is 40.2 megs of just plain text in XML data. It compresses about 95%. It seems pointless.
 
goodcow said:
Why are companies shifting to XML for file formats? Like Office, and the fact that Premiere Pro currently uses it? A project file I'm working on now is 40.2 megs of just plain text in XML data. It compresses about 95%. It seems pointless.


Because its an open format that anyone with a brain can describe therefore there is a 0% chance for vendor lockin and even if the person providing the XML file blows up in a nuclear accident, you can get any programming fool off the street to maintain that file format or change it into something else you can use.

Compare that with the .doc format which Microsoft has taken companies to court over trying to reverse engineer features of, wants to encrypt to office and Windows proper in the name of 'trusted documents' etc.

XML levels the playing field and keeps everyone honest and via XSL you can convert that XML document format into a PDF, DOCBOOK, HTML, Flash, or even Microsoft bastard XML Office format.
 
Phoenix said:
Because its an open format that anyone with a brain can describe therefore there is a 0% chance for vendor lockin and even if the person providing the XML file blows up in a nuclear accident, you can get any programming fool off the street to maintain that file format or change it into something else you can use.

Compare that with the .doc format which Microsoft has taken companies to court over trying to reverse engineer features of, wants to encrypt to office and Windows proper in the name of 'trusted documents' etc.

XML levels the playing field and keeps everyone honest.


It's not very space efficent at all though. And doesn't parsing a 40 meg file take a lot longer?
 
goodcow said:
It's not very space efficent at all though. And doesn't parsing a 40 meg file take a lot longer?


Its all relative. When the average user has gigabytes of hard drive storage space, a 40meg file is trivial... not to mention that it can be compressed into a .zip or whatever to be a lot smaller.

In terms of processing - yes it is slower, but it is still so fast that even on an aging G4/400 I can open read and transform a 12 meg XML file describing a database in less than a second. So that too is relative.
 
Status
Not open for further replies.
Top Bottom