- Shopping Bag ( 0 items )
"...shows how to use XML to improve the interactivity of your Web site, accommodate special or complex data, and take...
Ships from: pembroke pines, FL
Usually ships in 1-2 business days
"...shows how to use XML to improve the interactivity of your Web site, accommodate special or complex data, and take more control over document structure and layout."
In this chapter, we explore the meaning of the terms valid and well formed in relation to XML documents. Then we demonstrate good XML coding techniques. After you master the concept of good coding, you find out how complete XML delivers good structure overall. This leads to a discussion of what well formed really means in an XML document. After you get all that under your hat, you find out how to tell whether you've coded your XML correctly.
You must understand a couple of buzzwords in order to create correctly formatted XML documents: valid and well formed. These two terms are often bantered about whenever techie types discuss XML. In this section, you uncover what these two terms mean -- without the usual jargon.
A well-formed road is a good road
All XML documents must be well formed -- end of story! A well-formed XML document follows a few specific rules to make the document easy for a computer program to read. See the section entitled "Making XML Well-Formed" later in this chapter for the complete scoop on creating well-formed XML.
Although all XML documents must be well formed -- or else they aren't XML -- not all XML documents have to be valid. This doesn't mean you don't want valid XML documents. Validity just adds another layer of structure that can be helpful when you want to use or reuse a document. After all, a structured document is better than one that can contain any old set of tags in any old order.
A valid XML document adheres to a Document Type Definition (DTD). To answer the next inevitable question, a DTD defines a set of rules that specify which tags can legally appear in your document. A DTD also spells out how those tags can appear: It indicates their order and which tags can appear within other tags. Simply put, a DTD tells you what your tags can and cannot do; therefore, a DTD defines the rules that XML markup in a document must follow.
DTDs are not necessary, or required, for every instance of XML. However, they do give your XML documents an extra layer of organizational structure that can make your life easier. DTDs also help developers share expectations about document structures. If you're interested in reading more about DTDs, please see Chapter 5.
Now that you know what to look out for, open your text editor so we can get started.
A declaration for an XML document is simple. It occurs in the first line of your XML document. Currently, a declaration must point to XML version 1.0 -- after all, it's the only version out there. An XML declaration looks like this:
To be honest, you don't have to include an XML declaration in every XML document. If you don't point to a particular version, XML 1.0 is the default. However, we suggest that you get in the declaration habit for all XML documents because when version 2.0 comes out, XML declarations might be required.
You can write fancier declarations for XML documents if you want. For more XML declaration details, see Chapter 2.
If you decide to use a DTD to add organization and structure to an XML document, you must declare that DTD. (Remember that a DTD defines the rules of the game for your XML document. To find out more about creating and using DTDs, consult Chapter 5.) To declare a DTD in an XML document, you need just one simple line:
Document-Name SYSTEM "Document-Name.dtd">
There you have it -- one line of code that says it all for the related DTD!
This section explains how to write good -- that is, well-formed -- XML code to keep others from saying bad things about your work later!
The root of the matter
In HTML, you begin every HTML document with . The . . . tag pair is the root element for an HTML document. With XML, you create elements just like you use predefined HTML tags. The only difference with XML is that you get to choose the name for your root element. For example...
|Pt. I||Why XML Is "eXtreMely cool"||11|
|Ch. 1||Understanding What XML Is - and Why You Should Care||13|
|Ch. 2||Comparing and Combining HTML and XML||25|
|Ch. 3||Getting XML Basics Down Pat||41|
|Pt. II||XML Basics||53|
|Ch. 4||Planning an XML Document That Does Something Great||55|
|Ch. 5||Defining XML Documents||71|
|Ch. 6||Understanding and Using DTDs||77|
|Ch. 7||Creating Custom DTDs||95|
|Ch. 8||Understanding and Using XML Schema||109|
|Ch. 9||Building Custom XML Schemas||125|
|Pt. III||Putting XML to Work||139|
|Ch. 10||DTDs at Work||141|
|Ch. 11||XML Schema at Work||161|
|Ch. 12||Adding Character to XML||179|
|Pt. IV||Using and Delivering XML Content||189|
|Ch. 13||Inside an XML Solution||191|
|Ch. 14||Using XSL with XML||201|
|Ch. 15||Processing XML||221|
|Ch. 16||Viewing XML on the Web||233|
|Pt. V||XML's Lovely Linking Languages||245|
|Ch. 17||The XML Linking Language||247|
|Ch. 18||The XML Path Language||265|
|Ch. 19||The XML Pointer Language||281|
|Pt. VI||XML in the Real World||291|
|Ch. 20||Cool XML Tools and Technologies||293|
|Ch. 21||XML and Web Services||305|
|Ch. 22||XML on the Spot!||317|
|Pt. VII||The Part of Tens||327|
|Ch. 23||Ten Top XML Applications||329|
|Ch. 24||Ten Ultimate XML Resources||337|
|App. A: About the CD||345|
|App. B: Glossary||353|
|Hungry Minds End-User License Agreement||387|
Posted October 30, 2001
Posted December 12, 2000
Posted December 5, 2000
Even though the book assumes that you have at least a moderate understanding of HTML (I don't), I found the book very valuable from the aspect of explaining what XML is all about and it's practical uses. It gives the basics presented in a manner that can be understood by most EDI people. You will be able to participate in an XML discussion and have at least a basic understanding of what all the niose is about.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted August 23, 2000
So far I have gotten about half way through this book and it seems to be a bit vauge. Though it does give a good foundation on the concepts of XML, it seems to lack exercises. Like I said, I'm only half way through the book so maybe it will get better. I suppose it would be a good book for the person who has no idea what XML is about. But before you even think of picking up this book you need to have a strong foundation in HTML.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.