LanguagesXMLXML for Beginners, Part 5: Content

XML for Beginners, Part 5: Content

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.


Preface

I have authored numerous online articles on XML.  These articles cover the waterfront from introductory to advanced.  I maintain a consolidated index of hyperlinks to all of my XML articles at my personal website so that you can access earlier articles from there.


Introduction

This is the next installment in a series of articles designed to explain XML to beginners.

Experts skip this article

Those of you who already know all about XML can skip ahead to something more challenging, such as some of my articles on XSL.  You will find links to all of my articles at my personal website.

Beginners, keep reading

Those of you who are just getting your feet wet in this area (and may have found the XML water to be a little deep), keep reading.

What is XML?

In an earlier article, I provided the following brief description of XML.
 

XML gives us a way to create and maintain structured documents in plain text that can be rendered in a variety of different ways.

A primary objective of XML is to separate content from presentation.

Since then, I have been working to break down the jargon into plain English and have provided some examples of structured documents and rendering.

What we have learned so far?

So far in this series on XML for Beginners, I have introduced you to tags, elements, content, and attributes.

I have discussed tags, attributes, and elements in detail. I will discuss content in detail in this article.

What is content?

Of the four terms mentioned above, content is the easy one.

Sandwiched in between the start tag and the end tag of an element, we find the information (content) that the XML document is designed to convey.

Content is the raw information

This is where we put the information for which the document was created.

An XML newspaper

For example, if the XML document is being used for creation and maintenance of material for a newspaper, the content is the news.

A Java programming textbook

If the XML document is being used for creation and maintenance of a Java programming textbook, the content contains the information about Java programming that we want to present to the student.

Tags, attributes, and elements define structure

The content is the raw information. The tags, attributes, and elements define the structure into which we insert that information.

Why do we need structure?

One of the primary objectives of XML is to separate content from presentation.

If we insert the raw material as content into a structure defined by the tags, elements, and attributes, then that raw material can be presented in a variety of ways.

Same content, different renderings

For example, an XML document can be used to represent a newspaper.

Then that document can be presented as an ordinary hard-copy newspaper by printing the content on newsprint in a format defined by the structure.  Typically, we would use a rendering engine designed for that purpose.

The same XML document can be used to present the same information in a completely different rendering on a computer screen. Again, we would probably use a rendering engine designed for that purpose.

Rendering engine formats the content

In both cases, the rendering engine would examine the structure defined by the tags, elements, and attributes and would then format and present the news (content) in a format appropriate for the presentation media being used.

What does the future hold for XML?

Obviously, I believe that XML has a very bright future.  Otherwise, I wouldn’t be making the kind of substantial investment in time and energy that I am making in order to understand XML.

I base this belief on the fact that many large companies, including Microsoft and IBM have adopted XML as an important part of their future.

XML will grease the skids of electronic commerce

For example, here are some of the things that Simon Phipps, IBM’s chief XML and Java evangelist had to say recently in his keynote speech at the Software Development East conference.
 

“Because it allows companies to share information with customers or business partners without first negotiating technical details, Extensible Markup Language (XML) will grease the skids of electronic business and become the assumed data format at the end of 2001.”

XML provides vendor independence

Phipps went on to say:
 

“Other successful Internet technologies let people run their systems without having to take into account another company’s own computer systems, notably TCP/IP for networking, Java for programming, and Web browsers for content delivery. XML fills the data formatting piece of the puzzle.”

“These technologies do not create dependencies. It means you can build solutions that are completely agnostic about the platforms and software that you use.”

XML can reduce system costs

In the speech, entitled “Escaping Entropy Death” Phipps noted that users are reaching the point where the cost of simply owning some systems is exceeding the value they provide.
 

“The key benefit to IT managers that adopt XML and other non-proprietary standards is that they will greatly reduce the cost of maintaining a computer’s systems and will allow them to extend existing systems.”

“In the next decade, you can’t just ask when can you have [a new application]. You also have to ask how much will it cost to own.”

No more vendor-imposed standards

According to Phipps:
 

“The solution, interestingly enough, is not constant innovation. You have to redeem the best of the parts you have and combine them with the best of the future.”

Phipps contended that the IT industry has moved on from the era of “vendor-imposed standards.”

This is an interesting observation by a representative from IBM.  I grew up on computers during an era when IBM was the vendor who imposed the standards.

Some would say that the role of imposing standards has now been assumed by Microsoft (much to the dismay of IBM management).

What about Microsoft and XML?

Microsoft is making a huge investment in XML.  For example, as of this writing, Microsoft’s IE5.0 browser is the only major browser that knows how to render XML documents.

Rendering XML using CSS

You can find links to several articles that I have previously written discussing the rendering (by IE5) of XML documents using Cascading Style Sheets at my personal website.

Rendering XML using XSL

In addition, I have a series of articles in the works where IE5 is a major player in the rendering of XML documents using the Extensible Stylesheet Language (XSL).

The XSL Debugger from Microsoft

XSL is complex (much more complex than XML).  Designing an XSL stylesheet, to be used by a rendering engine to properly render an XML document, can be a daunting task.

To help us in that regard, Microsoft has developed an XSL debugger, and has made it freely available for downloading.  I will discuss the debugger, and will provide the URL for downloading it in my articles on XSL.

Check out XML in MS Word

If you happen to have a copy of Word 2000 around, use it to create a simple HTML file.  Load that file into your HTML browser and view the source.

When you do, you will find XML appearing at various locations in the control information created by Word in that HTML document.


What’s next?

In future articles in this series, I will be discussing such topics as well-formed documents, valid documents, and the DTD.

Copyright 2000, Richard G. Baldwin.  Reproduction in whole or in part in any form or medium without  express written permission from Richard Baldwin is prohibited.

About the author:

Richard Baldwin is a college professor and private consultant whose primary focus is a combination of Java and XML. In addition to the many platform-independent benefits of Java applications, he believes that a combination of Java and XML will become the primary driving force in the delivery of structured information on the Web.

Richard has participated in numerous consulting projects involving Java, XML, or a combination of the two.  He frequently provides onsite Java and/or XML training at the high-tech companies located in and around Austin, Texas.  He is the author of Baldwin’s Java Programming Tutorials, which has gained a worldwide following among experienced and aspiring Java programmers. He has also published articles on Java Programming in Java Pro magazine.

Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories