|Page (1) of 1 - 04/19/10||email article||print page|
Real World XML - Part 1 of 12Reviewing XML
Let's begin by taking a quick review of XML, what it is and what it looks like.
Now if you haven't seen XML before or if you are new to the subject, then I suggest you take a look at another lynda.com title that's available in the (Lynda.com) Training Library 5 called XML Essential Training and I do that title as well. It's really a foundational title. So if you are new to this and you haven't seen it before, I highly suggest you go check that title out first because that will provide the foundational knowledge that you will need to get through the rest of this title.
In this course, we'll be using concepts that are introduced in XML Essential Training. So you are going to want to make sure that you have those concepts and ideas under your belt before you tackle a title like this one.
XML is the Extensible Mark-Up Language. It's tag-based like HTML is. So if you are familiar with HTML code, then XML will look very familiar to you. XML is used to describe data and the structure of that data. Because XML is extensible, you get to make your own tags up.
The benefits of XML are numerous. I have called out a few here. First, XML allows you to separate the content of a document from how it's presented. XML does not contain by itself any notion of how data should be presented to the person reading it or consuming it.
You can also create tag sets that target specific problems. In fact, we'll take a look at how to do that in this course. XML stores information in a way that people can easily understand. So even though XML may be intended to be consumed by another computer system, or a machine, it's still in a format that a person can read and understand with some time and depending on how large the XML file is.
XML allows you to exchange data among disparate systems using technologies, for example, like web services. So two systems that may never have been designed to talk to each other can use XML to exchange data among them.
Finally, XML is an open format and it's text based. So it can be processed by any program that happens to be aware of XML. Now that's not to say that XML doesn't have some drawbacks. XML, for example, is not good for storing large amounts of data.
Click Play or press spacebar to start or stop video
In some cases, performance can also be slower than other methods of storing and retrieving data, so binary format, for example. If you were to store say a Photoshop file as an XML file, that file would probably be a lot less efficient than the binary format that you could store the image in. XML might not be the best format for representing certain kinds of data, audio, video, that kind of binary stuff.
Finally, some parts of XML, like namespaces, are kind of difficult to understand and hard to work with. Now XML documents must be what's known as well-formed. They always have a single root tag, just like HTML does, and tags have to be properly nested.
In other words, you have to have an A tag completely inside of a B tag or to take an HTML example, you can't have a tag that's like bold and then italic and then close bold, and then close italic. The XML parser won't let you get away with that.
Unlike regular HTML, empty tags always have to end with a slash inside the closing angle bracket, just like in XHTML for example. Attributes have to be inside quotes and they can't be minimized. If you are using XHTML, you're already familiar with these concepts.
XML documents can be what's known as valid. In other words, you can take an XML document and validate it against a schema or Document Type Definition to make sure it confirms to certain rules. This is a sample XML file. In fact, we'll be using this sample XML file a couple of times in this course.
Now looking at the sample XML file, you can see that I have defined a few tags, like BusinessCard and name. So this is an XML file that represents the contact you might find on a business card. Here we have some phone numbers and an e-mail address. The phones have certain attributes.
So you can see that XML can be used to mark-up tag sets that solve a particular type of problem. In this case, we needed a way to represent contact data on a business card. Later on in the course, we'll see how to do something like this in a real life web setting.
Okay, so that's a quick review of XML. Again, if you are new to all this, I highly encourage you to go check out the XML Essential Training title that's also available at lynda.com before continuing further.
www.lynda.com is an award-winning provider of educational materials, including Hands-On Training instructional books, the Online Training Library, CD- and DVD-based video training, and events for creative designers, instructors, students, and hobbyists.
The lynda.com Online Training Library and CD-ROM titles include such subjects as Photoshop, Flash, Dreamweaver, Illustrator, Office, digital photography, Web design, digital video, and many others. lynda.com's all-star team of trainers and teachers provides comprehensive and unbiased movie-based training to an international membership of tens of thousands of subscribers. Considering the speed at which technology evolves, the Online Training Library is a great solution for keeping your skills current. Library subscriptions begin as low as $25 a month, with no long-term commitment required.
Joe Marini is the director for Microsoft's Visual Studio Industry Partner program, and has been active in the Web and graphics industries for more than 15 years. He was an original member of the Dreamweaver engineering team at Macromedia, and has also held prominent roles in creating products such as QuarkXPress, mFactory's mTropolis, and Extensis QX-Tools. He is regularly a featured speaker at industry conferences and has authored or co-authored several books on Web development. His book The Document Object Model is widely regarded as the definitive resource for working with the DOM.
Related Keywords:xml, Extensible Mark-Up Language, xml training, xml tutorial, xml techniques, xml design, web design, web site design