Tutorial XML Introduction

duyen

New Member
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
Staff member
I get it.
Though I would like to see something on how to pull the data and implement it.
 
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
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
.

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.
  • Ghan Ghan:
    We did!
  • Ghan Ghan:
    The old shoutbox wasn't supported anymore. We updated xenForo, so it had to be replaced.
  • jonas jonas:
    let's see if everyone finds it... the nice thing about the shoutbox was I could check on it even while logged out, but the existence of this one is hidden when you're not logged in
  • Ghan Ghan:
    We can fix that.
  • Ghan Ghan:
    Chat should show on the sidebar when not logged in now.
  • Ghan Ghan:
    (You'll still need to log in to post messages)
  • Ghan Ghan:
    Test!
  • tom_mai78101 tom_mai78101:
    I must be in a test server.
  • tom_mai78101 tom_mai78101:
    Nice, Twitter tweets embedding now works
  • Wizard Wizard:
    Yup.
  • Ghan Ghan:
    Excellent.
  • Ghan Ghan:
    @tom_mai78101 Hello there.
  • Ghan Ghan:
    Tagging works in the chat too.
  • tom_mai78101 tom_mai78101:
    @Ghan Missed it.
  • Wizard Wizard:
    Still fixing things here and there. Added widgets to the portal, will make it match the ones here on the forum index tomorrow.
  • Ghan Ghan:
    The venerable World Editor Tutorials site has been converted to HTTPS at last.
  • jonas jonas:
    cool
  • jonas jonas:
    and I can even edit my messages, nice
  • seph ir oth seph ir oth:
    GENERAL CHIT CHAT, YOU ARE A BOLD ONE
  • Ghan Ghan:
    Hello there
  • The Helper The Helper:
    this new chatbox is great and the forum software update is great too
    +1
  • The Helper The Helper:
    upgrade has fixed forum registration spam problem
  • tom_mai78101 tom_mai78101:
    Something tells me we might be able to customize the chatbox a bit, considering that there's a gap under every message.
  • Wizard Wizard:
    Going to deploy a fix soon, just had to take some time for myself this weekend.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top