Home arrow Delphi-Kylix arrow Page 3 - Delphi and XML
DELPHI-KYLIX

Delphi and XML


Extensible Markup Language, or XML, is a simplified version of SGML. It is currently receiving a lot of attention. XML is essentially a markup language, meaning that it uses symbols to describe its own content. It also enables you to identify and organize your information in a more accurate and flexible way. This article is the first in a four-part series that introduces you to using XML with Delphi and the DOM.

Author Info:
By: David Web
Rating: 4 stars4 stars4 stars4 stars4 stars / 4
November 03, 2008
TABLE OF CONTENTS:
  1. · Delphi and XML
  2. · XSL example
  3. · XML Syntax
  4. · Using XML with Delphi

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
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 &lt;,  the greater-than character, which is replaced by &gt;, and the ampersand character (&), which is replaced by &amp;. Other optional special characters are &apos; for the single quote(‘), and &quot; 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]]>.

  • All markers are enclosed by angle brackets, < and >. Markers (or tags) are case sensitive.


  • For each opening marker there must be a matching closing marker denoted by a initial slash character: <node>value</node>


  • Markers must not overlap; they must be properly nested.


  • If a marker has no content (but is needed), you can replace the opening and closing markers with a single marker that includes a trailing slash:<node/>


  • Markers can have attributes, using multiple embedded tags and only one block of text representing the value of the node. XML nodes can have either a textual value or embedded tags, but not both.


  • A node can have multiple child nodes with the same tag; tags do not have to be unique. Attributes, however, have to be unique for each node.


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.


blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials