Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
16.6k views
in Information Technology by (72.5k points)

Explain the difference between a well-formed and a valid XML documents.

1 Answer

0 votes
by (89.5k points)
selected by
 
Best answer

1. Well-Formed XML Documents

A “well-formed” XML document means that document has the correct XML

syntax.

The XML document that follows XML grammar rules is called well-formed document. A document that includes a sequence of markup characters that cannot be parsed or are invalid cannot be well-formed. The following points are to be kept in mind for a valid XML document:

1. The document must contain at least one element

2. The document must have a root element

A root element is a unique element in the XML document, which contains the complete document.

3. The element must have the opening and the closing tags 

To close a tag, you need to prefix the forward slash with the normal tag.

e.g.

4. XML tags must be closed properly 

There must be a proper closing tag. In XML, empty tags must end with the following slash.

e.g.

5. XML elements must be properly nested 

The parent element has to be opened before the child element and closed after the child element.

This code is not well-formed because the root element (College) is closed before the parent element (Student).

6. XML tags are case sensitive 

XML tags are case sensitive means the opening and ending tags must be in the same case.

e.g.

7. XML attribute values should be in double quotation marks 

The attribute value in an XML document should be enclosed in proper quotes.

e.g.

2. Valid XML Document 

A valid XML document is .not only a well-formed document but as well as they also checked error against a DTD or schema. DTD is a set of rules that define what tags appear, what value those tags may contain and how the tags are related to each other in an XML document. Validation can be done only if the XML document has valid DTD. When an XML document is checked or parsed according to a particular structure or guidelines, the process is known as validation of the document.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...