XML Introduction

duyen

New Member
Reaction score
214
XML Introduction
By Anman64

This introduction teaches you:
  • What XML is
  • Why it's used
  • The basics of storing data with XML

XML is not hard to learn and this tutorial can help you.

What it is
  • XML stands for Extensible Markup Language
  • XML IS NOT a scripting language and you CANNOT make a website solely out of XML

Why it's used

XML is used for storing and transferring data easily and efficiently.

The Basics of Storing Data

With XML, storing data is very simple. Because so, it's easier not to explain, and just show code, so you can get a feeling of how it works.

Here's some example code:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<gamestore>
<game>
<title>SSBB</title>
<console>Nintendo Wii</console>
<cost>$50</cost>
<description>You brawl with people, online or offline</description>
</game>

<game>
<title>Metroid Prime III</title>
<console>Nintendo Wii</console>
<cost>$35</cost>
<description>You shoot things</description>
</game>
</gamestore>

The line "<?xml version="1.0" encoding="ISO-8859-1"?>" is to declare what version of XML this is and how it's encoded.

Link to web page with code.


As you can see, you can just put whatever you want in the <> tags.

This tutorial does not cover how to implement this into your web page, but here's a good tutorial to implement XML into an HTML web page.:
http://www.w3schools.com/xml/xml_to_html.asp


FAQ:


Q: What will happen if I make a syntax error?
A: The XML file will not be able to load, to prevent this I personally recommend this validator.

Q: Is it really that simple?
A: For storing data, aye.
________________________________

I know I didn't cover a lot of things, but what do you guys think?

Probably going to add something on attributes next.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
I get it.
Though I would like to see something on how to pull the data and implement it.
 
Reaction score
333
Good tutorial. Although XML is a really lame, verbose and internally redundant markup language, it's the best we've got (in terms of standard, at least).

Also, in the interest of usability I would not recommend parsing XML with JavaScript. I don't know why such a practice is encouraged at w3schools.
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
Some points:
  • your "example code" is missing the most important part, the XML declaration.
  • if you want to transform XML into something else, please use XSLT and not some JavaScript scriplet you found on a third-class so-called HTML "expert" school
  • and one can make a webpage exclusively out of XML (images aside). That's the goal of XHTML.

As for the missing parts, like DTDs and schemas, namespaces and attributes and all the other things, see Wikipedia for a brief introduction.
 

duyen

New Member
Reaction score
214
.

As for the missing parts, like DTDs and schemas, namespaces and attributes and all the other things, see Wikipedia for a brief introduction.

>if you want to transform XML into something else, please use XSLT and not some JavaScript scriplet you found on a third-class so-called HTML "expert" school

"W3C recommend using XSLT instead."

http://www.w3schools.com/xsl/default.asp

>your "example code" is missing the most important part, the XML declaration.

Added

>and one can make a webpage exclusively out of XML (images aside). That's the goal of XHTML

Sorry, your right, I was talking about a more dynamic website.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top