Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
02-17-2004, 01:27 AM #1
Is this the right useage of xml? Plus benefits of xml
I am completely baffled with xml, I dare admit it.
I've looked at tutorials for xml and xsl(i think it's called that), but I fail to see any difference between that and say xhtml and using html markup.
My main question is, is it suitable to use an xml document for use as a template in php? or should I just stick to xhtml instead?
I really can't see the benefits of xml, but I'm hoping someone can show me. Why xml and not xhtml with a serverside language supporting it?
02-17-2004, 03:28 PM #2
- Join Date
- Feb 2003
- UmeŚ, Sweden
- Thanked 83 Times in 74 Posts
Well, first of all, I'd like to say you're confusing things. XML ans XSL are both XML. In fact, XHTML is one of the best examples of XML you will find. The question is rather what XML gives over tagsoup or SGML.
XML is clean. The syntax is consistent, the well-formedness and grammar rules are pretty unambigous, and the validity rules are clearly separated from the syntax rules. SGML is not as clean, but more powerful. In contrary to modern belief SGML has grammar and well-formedness rules as well, but the language is not at all as unambigous as XML is. Tagsoup is less consistent, has error correction for pretty much anything, and uses no validity system.
So, what does that mean XML gives that SGML or Tagsoup doesn't?
Well, it's far easier to parse. It doesn't allow grammar errors or well-formedness errors, so when you test your documents you see those types of errors quickly. Because there is no ambiguity XML makes sure that all user agents will build the same internal representation of the structure. That means it's reliable across user agents. Then there's the associated languages and tools that only works with XML, not SGML or Tagsoup.
Well, back to XHTML and XML. As said, XHTML is XML. I've tried to describe what XML is in a few posts on this forum. Why don't you search for those posts and read them through, and then ask again for clarifications or further explanations?
02-24-2004, 08:23 AM #3
- Join Date
- Jul 2002
- Thanked 0 Times in 0 Posts
Nightfire, I don't know much about XML, but I think I know the difference between XML and XSL and if I tell ya that XSL is itself written by XML then I think you get more confused! I only started learning XML because I was hearing its name a lot and I thought it's better I go and learn it! The first thing I did was searching kazza for a book and I found XML by Examle that's free to download as well! So, I grabbed the book and now that I'm around page 150 I really think that I have no problem with XML concept and I can understand its value (before that I always used to hear that XML is good, it's great, it can do lots of things, it let us communicate with other sites and ..), so, I think it's better that you go and get that book too, because most of the times reading articles at the beginning when we know nothing doesn't help that much, it only adds to our confusion!
As for as XSL: Extensible Styling Language, it's a styling language! We have two sort of styles, one that works with the formation of document, like it says the color of document should be red for example or the fonts should be 12px. Yes, it's something like CSS. But the other thing that's prettier and more important is XSLT or XSL Transformation, do you know what it does?! It's exactly like preg_replace in PHP! We can give it a XML document and this is the XSLT that defines for example tag <para> should be replaced with tag <p>. In this way you can write your own document in XML and change it whenever you like to any language (HTML for example) or even plain text! You can use this method to make a newsletter in XML and then make several copies of it in HTML, text, WML or whatever! You can also use RSS: Really Simple Syndication from the other sites to get their contents and show it in any style that you like in your site to any device! This is a whole new world! I LOVE XML!
02-28-2004, 04:06 PM #4
Originally posted by ConfusedOfLife
- Join Date
- Oct 2003
- London, UK
- Thanked 1 Time in 1 Post
The first thing I did was searching kazza for a book and I found XML by Examle that's free to download as well!