When starting an XML document, the first line must contain an XML declaration that indicates the version of XML used in the document. To write a valid XML document, a document type definition (DTD) before the first element in the document must be associated. An example of XML document that would be validated:
<?xml version="1.0"?>
<!DOCTYPE greetingxml SYSTEM "greeting.dtd">
<body>
<greeting>Hello World!</greeting>
</body>
The first line defines the version of XML being used. If an XML document does not conform to the version specified then this document has an error hence will not be processed by the intended application.
Second line indicates the name of the DTD "greeting" and identifies the URL of the DTD as "greeting.dtd" which is found in the same directory as the XML document. This line must be needed if someone wants the XML document be validated against an intended DTD.
<?xml version="1.0"?>
<!DOCTYPE greetingxml SYSTEM "greeting.dtd">
<body>
<greeting>Hello World!</greeting>
</body>
The first line defines the version of XML being used. If an XML document does not conform to the version specified then this document has an error hence will not be processed by the intended application.
Second line indicates the name of the DTD "greeting" and identifies the URL of the DTD as "greeting.dtd" which is found in the same directory as the XML document. This line must be needed if someone wants the XML document be validated against an intended DTD.
No comments:
Post a Comment