Well-Formed
and Valid Documents
Not all XML documents are the
same. In particular, two specific descriptions can be applied to XML documents
to describe the content contained within them. XML docu-ments can be well
formed, and they can also be valid. Validity implies “well-formed-ness,” but
not vice versa. That’s because a valid XML document is a more strict form of a
well-formed XML document. It’s like saying that a square is a rectangle, but
not vice versa.
Well-Formed
Documents
An XML document is well
formed if it follows all the preceding syntax rules of XML. On the other hand,
if it includes inappropriate markup or characters that cannot be processed by
XML parsers, the document cannot be considered well formed. It goes without
saying that an XML document can’t be partially well formed. And, by definition,
if a document is not well formed, it is not XML. This means that there is no
such thing as an XML document that is not well formed, and XML processors are
not required to process these documents.
Valid
Documents
Although the property of
“well-formedness” is a matter of making sure the XML docu-ment complies to
syntactical rules, the property of validity is a different ballgame. A
well-formed XML document is considered valid only if it contains a proper
Document Type Declaration and if the document obeys the constraints of that
declaration. In most cases, the constraints of the declaration will be
expressed as a DTD or an XML Schema. Well-formed XML documents are designed for
use without any constraints, whereas valid XML documents explicitly require
these constraint mechanisms. In addition to con-straining the possible elements
and the ordering of those elements in a document, valid XML documents can take
advantage of certain advanced features of XML that are not available to merely
well-formed documents due to their lack of a DTD or XML Schema. Some of these
advanced features include linking mechanisms, value and range bounding, and
data typing.
Although the creation of
well-formed XML is a simple process, the use of valid XML documents can greatly
improve the quality of document processes. Valid XML docu-ments allow users to
take advantage of content management, business-to-business trans-actions,
enterprise integration, and other processes that require the exchange of
constrained XML documents. After all, any document can be well formed, but only
spe-cific documents are valid when applied against a constraining DTD or
schema.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.