0% found this document useful (0 votes)
9 views

Lab 6

An XML document is well-formed if it follows the basic syntactic rules of XML, such as having one root element, properly nested tags, and closed tags. A valid XML document is well-formed and also conforms to the constraints of its associated schema (DTD, XML Schema). To be valid, the document must only contain elements and attributes allowed by the schema. Well-formedness ensures proper parsing while validity checks semantics against the schema.

Uploaded by

Tooba Aamir
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Lab 6

An XML document is well-formed if it follows the basic syntactic rules of XML, such as having one root element, properly nested tags, and closed tags. A valid XML document is well-formed and also conforms to the constraints of its associated schema (DTD, XML Schema). To be valid, the document must only contain elements and attributes allowed by the schema. Well-formedness ensures proper parsing while validity checks semantics against the schema.

Uploaded by

Tooba Aamir
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Engineering for Internet Applications Lab 6 Tooba Aamir - 396447

University of Melbourne (Semester-2 2011) Department of Computer Science and Software Engineering

Course title Engineering for Internet Applications

Submitted by: Tooba Aamir 396447

Dated September, 16 2011

Engineering for Internet Applications Lab 6 Tooba Aamir - 396447 1. Explain in your report what is meant by XML being "well-formed" and XML being "valid". Well-formed XML Document has to follow several generic rules and meets the syntactic requirements of the language. It means XML Document may only have one root element and not missing any closing tags, i.e. having all singleton tags use pair <text> </text> instead of just <text>, and having closing tags in the right order. Also Tags never overlap otherwise such arrangement would produce an error such as:<author><name>...</author></name>. It is important to make an XML Document well-formed. In fact, W3C doesn't consider an XML Document to be XML unless it is well-formed. Where as, Valid XML is XML that uses a DTD and complies with all its requirements. So if an attribute is used improperly, this violate the DTD and file isn't valid. A valid XML Document, in addition to being well-formed, conforms to all the constraints imposed by a schema (e.g., a DTD, Relax NG Schema, Schematron Schema or an XML Schema). In other words, it does not contain any tags that are not permitted by the schema, and the order of the tags conforms to the schema's specifications. If XML isn't well-formed it can't be properly parsed - parsers will simply throw an exception or report an error. This is generic and it doesn't matter what XML contains. Only once it is parsed can it be checked for validity so it means that an XML document cannot be valid until it is well-formed. All
XML documents are held to the same standard for well-formedness (an RFC put out by the W3). Also one XML document can be valid against some schemas, and invalid against others. There are a number of schema languages, many of which are themselves XML-based. So in other words, validity refers to semantics and well-formedness refers to syntax.

You might also like