ArticleslgStudy

science

Well-formed document

Well-formed document is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Well-formed document rather than just read about it. In short: A well-formed document in XML is a document that "adheres to the syntax rules specified by the XML 1.0 specification in that it must satisfy both physical and logical structures". Requirements At its base level well-formed documents require that: Content be defined.

Key takeaways

  • Well-formed document belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Well-formed document to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Well-formed document from memory before moving on to harder problems.

Reference excerpt

A well-formed document in XML is a document that "adheres to the syntax rules specified by the XML 1.0 specification in that it must satisfy both physical and logical structures".

Requirements At its base level well-formed documents require that:

Content be defined. Content be delimited with a beginning and end tag Content be properly nested (parents within roots, children within parents) To be a well-formed document, rules must be established about the declaration and treatment of entities. Tags are case sensitive, with attributes delimited with quotation marks. Empty elements have rules established. Overlapping tags invalidate a document. Ideally, a well-formed document conforms to the design goals of XML. Other key syntax rules provided in the specification include:

It contains only properly encoded legal Unicode characters. None of the special syntax characters such as < and & appear except when performing their markup-delineation roles. The begin, end, and empty-element tags that delimit the elements are correctly nested, with none missing and none overlapping. The element tags are case-sensitive; the beginning and end tags must match exactly. Tag names cannot contain any of the characters !"#$%&'()*+,/;<=>?@[\]^`{|}~, nor a space character, and cannot start with -, ., or a numeric digit. There is a single "root" element that contains all the other elements. A valid XML document is defined in the XML specification as a well-formed XML document which also conforms to the rules of a Document Type Definition (DTD). According to JavaCommerce.com XML tutorial, "Well formed XML documents simply markup pages with descriptive tags. You don't need to describe or explain what these tags mean. In other words a well formed XML document does not need a DTD, but it must conform to the XML syntax rules. If all tags in a document are correctly formed and follow XML guidelines, then a document is considered as well formed." An XML processor that encounters a violation of the well-formedness rules is required to report such errors and to cease normal processing. This policy, occasionally referred to as draconian, stands in notable contrast to the behavior of programs that process HTML, which are designed to produce a reasonable result even in the presence of severe markup errors in the spirit of Postel's law ("Be conservative in what you send; be liberal in what you accept").

Importance The concept of a well-formed document allows for a better understanding of the fundamental construction of XML. It helps to clarify XML beyond the typical sense of it. For example, while most XML Document Type Definitions utilize left and right angle brackets as content delimiters, strictly speaking this is not a necessity (though a delimiter should be terse and concise). The left and right angle bracket codes are a convention, albeit clear and distinctive, not an absolute requirement. The concept of well-formed document also allows for the comprehension of the abstract nature of XML. In reality, there is no such thing as XML. Rather, XML is a principle that represents a set of behaviors and practices. It is possible to discuss types of XML, as expressed within a Document Type Definition (DTD). Well-formed documents also bring into focus the issue of valid versus correct XML. According to the W3 Organization, valid documents are those that validate against a DTD. The rules of validity mean that a document complies with the restraints stated within a DTD. Thus, tags or entities must be in conformity to the rules and relations established within a DTD. However, there is no control on whether a tag or entity is correct. Thus a first level head tag could be applied to a second level head object and be valid, while incorrect. The emphasis on well-formed documents has developed within the publishing industry where the use of left and right angle bracket delimited information has become problematic. Emphasis on the well-formed document allows for the definition, delimiting, and nesting of content to be managed within programs that are not XML, per se, but exhibit the characteristics or potential for being well formed. This allows for easier transformation of content along the publishing chain, greater capacity to meet accessibility standards, and the opportunity to deploy computer-based tools to improve outcomes. It is also theorized that approaching content utilizing the theory of well-formed document could help the industry counter the current trend of the reduction in reading.

Validation tools There are several tools available to determine if a given XML document is well formed.

Richard Tobin's XML validator Truugo's XML Validator W3Schools XML Validator

See also XML schemas and validation

References

Worked examples

Example 1 — a first encounter with Well-formed document

Start with the simplest possible case. Write down what Well-formed document claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Well-formed document before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Well-formed document ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Well-formed document

In research
Well-formed document appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Well-formed document in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Well-formed document is common in secondary-school and first-year university syllabi. It links to neighbouring topics XML, so understanding it makes those chapters shorter.
In everyday life
Look for Well-formed document outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Well-formed document” →

How to study Well-formed document in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Well-formed document means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Well-formed document out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Well-formed document in simple terms?

A well-formed document in XML is a document that "adheres to the syntax rules specified by the XML 1.0 specification in that it must satisfy both physical and logical structures". Requirements At its base level well-formed documents require that: Content be defined.

Why does Well-formed document matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Well-formed document?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Well-formed document.

Tags

  • XML

Keep exploring