jump to navigation

Well-formed and valid XML documents May 16, 2008

Posted by fofo in XML.

Let’s start by saying this:

If an XML document is valid then by default it is well-formed. Unfortunately the reverse is not always true.  Well-formed XML documents do not necessarily have to be valid.

According to XML specification we must follow certain rules to create XML documents. Some of them are

  • having exactly one root element
  • close all opening tags
  • using single/double quotes for attribute values

If an XML document abides by these rules, it is a well-formed XML document.

DTD is primarily used for the expression of a schema via a set of declarations that conform to a particular markup syntax. It describes the structure and content of a document, in terms of constraints on the structure of that document. In DTD we find information such as:

  • the parent-child relationship details
  • attribute lists
  • data type information
  • value restrictions

If a document is well formed and also follows the rules in its associated DTD, it is a valid XML document.



1. sandrar - September 10, 2009

Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: