Delphi and XML - XML Syntax (Page 3 of 4 ) It is worth know a few details about this language before we discuss how to use it in Delphi: You can add comments within <!—andmarkers, which are basically ignored by XML processors. There are also directives and processing instructions, enclosed within <? and ?> markers.
White spaces are generally ignored. While human beings must be able to read your XML tags, your applications won't care much about them.
There are a few reserved characters that you cannot use in the text. The only three characters you can never use are the less-than character (or the left angle bracket, <, used to delimit a marker), which is replaced by <, the greater-than character, which is replaced by >, and the ampersand character (&), which is replaced by &. Other optional special characters are ' for the single quote(‘), and " for the double quote(").
To add non XML content (for example, binary information or a script), you can use a CDATA section, enclosed within <![CDATA [and]]>.
It is worth adding that an XML document needs to be well-formed if it is to be used in web browsers or other applications. There are a few extra rules that need to be followed for XML documents to be consideredsyntactically correct. So let’s look at what is meant by syntactically correct: Each XML document must indicate that it is an XML document, which version of XML it complies with, and finally, what type of character encoding it takes:
<?xml version="1.0" encoding="iso-8859-1"?> Encodings can include Unicode character sets such as UTF-8, UTF-16 and UTF-32 and also some ISO encodings such as ISO-1064-xxx or ISO-8859-xxx. The prologue can also include external declarations, the schema used to validate the document, namespace declaration and associated XSL file, and some internal entity declarations. A well-formed XML document will have no problems being loaded into a web browser or any other XML-compliant application.
Next: Using XML with Delphi >>
More Delphi-Kylix Articles More By David Web |