Wednesday, October 17, 2012

What Are Well-Formed XML Documents?

Definition: XML with correct syntax is well-formed XML. Parsers check XML documents for well-formedness. If a document is not well formed, the parser discontinues processing and returns an error message that indicates where the malformed syntax occurred. XML declaration is included, it must appear on the very first line.

An XML declaration looks like this: To date, the version attribute is always equal to “1.0,” although W3C issued a Candidate Recommendation of the XML 1.1 specification in October 2002 and expects to issue a finalized Recommendation in 2003. Other optional attributes of the XML declaration include the following:
Encoding—specifies the character set used in the document. Defaults to UTF-8. A document may also use Unicode sets such as UCF-2 and UCF-4 or ISO character sets such as ISO-8859–1 (Latin-1/West European).

Standalone—specifies whether the document requires an external file. Setting standalone to “yes” means that the
XML document does not require an external DTD or schema or any other external file. We would set this to “no” if you were referencing an external DTDor schema file. DTDs and schemas are discussed in the next section of this chapter.
Besides the XML declaration, the prolog may contain additional processing instructions. Processing instruction tags start with . Processing instructions are directives to the XML processor, or parser—the application that reads and interprets our XML. Any processing instructions that we use must be understood by our parser; they are not built into the XML Recommendation.

Here is an example of a commonly used processing instruction that links a stylesheet to the XML document. It is understood by parsers in both Internet Explorer 5 and Netscape 6: href="myStyle.css"?> The prolog may contain three more things: comments and white space, which are discussed in Syntax, below, and the document type definition (DTD), which is discussed in the next section of this chapter.

The Root Element. The first element that comes after the prolog is known as the root element. All XML documents
must have root elements. The root element consists of a tag pair and includes everything between its starting tag and its ending tag. All other elements in the XML document are nested between the starting and ending tags of the root element. In the simple XML example shown at the beginning of this chapter, is the starting tag of the root element and is the ending tag. It’s like saying, “This document is a payroll.”

Miscellaneous Parts. Optional miscellaneous elements in an XML document may consist of comments, processing instructions, and white space. We have already met processing instructions in the prolog. There are other processing instructions that may be used anywhere in an XML document. Again, the constraint is that the processing instruction must be understood by the parser.

Syntax
W3C specifies that a well-formed XML document must conform to the following syntax rules. Tags are delimited by “greater than” and “less than” brackets.

BIO:
Brents Lyons is an IT professional from Exam key. Are you really looking for this a00-280 exam assistance? Move ahead to take the benefit of vca410-dt exam question and pass your exam easily .

No comments:

Post a Comment