Subject: RE: [xsl] This can't be right, XML with no root element: Saxon & XT vs. Xalan From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxx> Date: Fri, 27 Jul 2001 12:09:40 +0100 (BST) |
Dylan Walsh wrote at 27 Jul 2001 11:12:59 +0100: > To clarify: the syntax for a "text declaration" is exactly the same as > an XML declaration e.g.: > > <?xml version="1.0" encoding="utf-8"?> > > Is that correct? It is not correct that a text declaration has exactly the same syntax as an XML declaration. An XML declaration is used for the document entity, and it has three parts: version information, encoding declaration, and standalone document declaration. A fully-featured XML declaration looks like this: <?xml version="1.0" encoding="utf-8" standalone="yes"?> The version information tells to which version of XML the document conforms. If there is an XML declaration at the start of the document, it has to have the version information. The encoding declaration tells the encoding of the characters making up the current parsed entity (i.e. the current file in most cases). It is optional if the encoding is UTF-8 or UTF-16 (since all XML processors must be able to handle both UTF-8 and UTF-16 and the requirement that parsed entities in UTF-16 allows the XML processor to reliably distinguish between UTF-8 and UTF-16). It is required if the encoding is not UTF-8 or UTF-16. The standalone document declaration tells whether anything in the external subset of the document's DTD affects what the XML processor passes to the application. Its value is either "yes" (the document does stand alone) or "no" (the external DTD subset changes things). It is optional, and if it is not present, "no" is assumed (unless there is no external DTD subset, in which case the standalone document declaration can be safely ignored). An example of when standalone="yes" is required is when the external DTD subset declares a default value for an attribute of an element. Without the information in the external subset, if an element in the document doesn't have that particular attribute, no information about the attribute will be passed to the application. With the information in the external subset, if an element does not have that attribute, the default value will be supplied by the XML processor as if the attribute with its default value had been present on that element. The entire XML declaration can be omitted if the document entity is in either UTF-8 or UTF-16. If the document entity is not in one of those two encodings, the XML declaration has to be present because you have to identify the encoding. A text declaration is used for external parsed entities, and it has two parts: version information and encoding declaration. It doesn't need a standalone document declaration because external parsed entities don't have separate DTDs. A fully-featured text declaration looks like this: <?xml version="1.0" encoding="utf-8"?> The version information has the same meaning as in the XML declaration, except this time the version information is optional. The encoding declaration has the same meaning as in the XML declaration, except this time the encoding declaration is required. The text declaration can be omitted if the external parsed entity is in either UTF-8 or UTF-16. If the external parsed entity is not in one of those two encodings, the text declaration has to be present because you have to identify the encoding. Regards, Tony Graham ------------------------------------------------------------------------ Tony Graham mailto:tony.graham@xxxxxxxxxxxxxxx Sun Microsystems Ireland Ltd Phone: +353 1 8199708 Hamilton House, East Point Business Park, Dublin 3 x(70)19708 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] This can't be right, XML , David Carlisle | Thread | RE: [xsl] This can't be right, XML , Michael Kay |
Re: [xsl] This can't be right, XML , David Carlisle | Date | Re: [xsl] xpath question, Robert Koberg |
Month |