tailieunhanh - XML Step by Step- P7

XML Step by Step- P7:Extensible Markup Language, or XML, is currently the most promising language for storing and exchanging information on the World Wide Web. Although Hypertext Markup Language (HTML) is presently the most common language used to create Web pages, HTML has a limited capacity for storing information. In contrast, because XML allows you to create your own elements, attributes, and document structure, you can use it to describe virtually any kind of information from a simple recipe to a complex database | Chapter 5 Creating Valid XML Documents Using Document Type Definitions 93 The Advantages of Making an XML Document Valid Creating a valid XML document might seem to be a lot of unnecessary bother You must first fully define the document s content and structure in a DTD or XML schema and then create the document itself following all the DTD or schema specifications. It might seem much easier to just immediately add whatever elements and attributes you need as you did in the examples of well-formed documents in previous chapters. If however you want to make sure that your document conforms to a specific structure or set of standards providing a DTD or XML schema that describes the structure or standards allows an XML processor to check whether your document is in conformance. In other words a DTD or XML schema provides a standard blueprint to the processor so that in checking the validity of the document it can enforce the desired structure and guarantee that your document meets the required standards. If any part of the document doesn t conform to the DTD or XML schema specification the processor can display an error message so that you can edit the document and make it conform. Making an XML document valid also fosters consistency within that document. For example a DTD or XML schema can force you to always use the same element type for describing a given piece of information for instance to always enter a book title using a TITLE element rather than a NAME element it can ensure that you always assign a designated value to an attribute for instance hardcover rather than hardback and it can catch misspellings or typos in element or attribute names for instance typing PHILUM rather than PHYLUM for an element name . Making XML documents valid is especially useful for ensuring uniformity among a group of similar documents. In fact the XML standard defines a DTD as a grammar for a class of documents. Consider for example a Web publishing company that needs all its .

TỪ KHÓA LIÊN QUAN