Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
I'd like to give you an overview of the benefits of using XML, but first off, I would like to talk about what XML is. Well, it stands for eXtensible Markup Language, which just means that it's very flexible and really easy to read and use. In fact, there is many different technologies that can create and understand this XML format. So whether you're using PHP or a database, those different technologies can read and write XML file formats and XML content.
But what it is is basically structured information that you define, and that's what makes it flexible. I can define what it contains, and what the different tags are. It's usually contained in a text document, as you can see by that icon, but in general, it is tag-based, like HTML. So if you're familiar with HTML, XML should be even easier to understand. But what are the differences? Well, HTML has predefined tags. So you can see in this example, there can be a heading 1 tag in HTML.
That's a predefined tag like for bold, any of that sort of thing, say the
title is again, predefined, and what it does is it defines how the data is being displayed.
So it has to deal with the visual display of the content.
Well, XML is more flexible in that, because the tags aren't predefined.
You define your own.
So whether I want to have a tag that says
So it was basically designed to carry this data not necessarily to display the data. So it really does separate the content from the visual aspect of your content. It plays really nice with Flash. So XML content can easily be displayed in Flash. It really does separate that content from the design, and it really allows your content to be external outside of your Flash file. So updating your site is a cinch, because all I need to do is open up that XML file in a simple text editor and edit it.
So, what can XML be used for? Well, you can define the data, so it could contain News updates, maybe Schedules, Personnel Information, or even Portfolio content, but since you define the data you can determine what's in it, and how it's being used. The great thing is it's separate from the Flash file. So I would like to take a look at an XML file right now. In the Exercise Files folder, in the Assets folder, in the design folder, clear down in here in the portfolio folder, here is a portfolio.xml file, because that's what this XML file contains, all the portfolio information.
So I'm just going to open that up in a simple text editor.
I'm using TextEdit.
You can use whatever you want, Dreamweaver.
It's really up to you, but in general, this is the structure of this XML file.
It does define it as an XML file, and then I have this tag that contains all of
this portfolio information.
Again, I've created this tag that says
It's actually an HTML comment, but I've just defined that this is Image 1, which contains the title of this image. It gives a description of the image. It gives the path for the largeImage, and then a path for the thumbnail image for this image, and it works out really well. But I do want to focus on the description, because notice how this does say CDATA and that means character data. So anything that I want to put within these two brackets will not mess up my code, because there are some cases where if I put a real interesting character, whatever that might be, it might tend to say, break the code.
And if it'll ever breaks your code, then wrap it in CDATA, just like that, and close with those two brackets, because what's going on even for this description is I have these quotes. I want to make sure that this line doesn't break anything. So just wrap it in CDATA. But other than that, I've defined the tags, I've defined the content within those tags, and now this is ready to go. So I can close that, and I won't worry about saving it. But all my content is right in here, and it's going to be external from my Flash files.
So if I need to update my portfolio, all I need to do is update that XML, and my website is pretty much automatically updated.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.