XML

XML Declaration

Posted on 18th February 2014

XML declaration is used to define the version, character encoding and standalone attributes of the XML document. This declaration is optional, but when used it should be the first line of a XML document. You cannot have any comments or whitespaces before the declaration.

XML declaration start with the delimiter <?xml and ends with ?> The attributes and their values are specified between these delimiters.

Version Attribute

Version attribute is used to declare the version of XML used in the document. Version can be "1.0" or "1.1"

Encoding Attribute

Encoding attribute is used to define the character encoding used in the XML document. The default is UTF-8 if this attribute is omitted.

Standalone Attribute

Standalone attribute tells the XML parser if there are any Doc Type Declarations (DTDs) in an external file that is required to parse this document. The value of the attribute can be "yes" or "no". The default value is "no" if this attribute is omitted.

XML Declaration Example

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

Post a comment

Comments

Nothing yet..be the first to share wisdom.