Expression web XML

Extensible Mark-up Language (XML) may look like complicated stuff but broken down you can see just how easy it is to create and use. A basic understanding of how to use xml in expression web will open up your web building capabilities and have you building web sites in a way you never thought possible.

How is an xml file made up?

Apart from a couple of basic criteria, you are at liberty to create xml tags in anyway you want. Unlike html, there are no set tags in xml, you basically call a tag what you like: Lets make an example of a news headline xml file - that will display a news headline, a news description, a link to another page and an image to display with the news should we want to. All sounds a little complicated but here's how.

Create a new xml file: File/new/page/xml

A new page is created by expression web, the page is blank bar one line of code as follow:

<?xml version="1.0" encoding="utf-8" ?>

So we now need to build our xml file.

Rather like html our xml must be in a tag rather like the <body> tag although we call it <dataroot></dataroot> our xml goes between the <dataroot> tags furthermore our news content must go into some tags and this is where our free reign starts. So lets make up the rest of the tags.

<dataroot>
<sitenews>
<headline></headline>
<newsitem></newsitem>
<link></link>
<image></image>
</sitenews>
</dataroot>

Any of the tags between the <dataroot> tags can be called anything you want.

Now we have the basic containing tags for our XML file, we can put some content into the tags.

<dataroot>
<sitenews>
<headline>Xml Tutorial in Expression Web</headline>
<newsitem>Create an XML file and learn how you can use it anywhere on your web site. A simplistic look at the amazing powers of XML</newsitem>
<link>http://www.expression-web-help.com</link>
<image>http://www.expression-web-help.com/Tutorials/images/tablesite.jpg</image>
</sitenews>
</dataroot>

And that is a very simple xml file - in fact they don't have to be over complicated. Think about what data your want to display and write some tags for it. In the next part of the tutorial, i explain what we can do with the xml file.

Part 2