Home arrow Delphi-Kylix arrow Page 2 - 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 / 6
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

Delphi and XML - XSL example
(Page 2 of 4 )


As you can see, each tag describes its contents very clearly. For example, the <title> tag describes the title, the description tag shows the description, and so on. Below is an example of an XSL style sheet:


<?xml version="1.0" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="iso-8859-1" omit-xml-declaration="yes" indent="yes"/>

<xsl:template match="*">

<table border="1" width="600" align="center">

<tr><td valign="top" align="center" class="title" bgcolor="silver" >

<a>

<xsl:attribute name="href">

<xsl:value-of select="*[local-name()='channel']/*[local-name()='link']"/>

</xsl:attribute>

<xsl:attribute name="target">

<xsl:text>top</xsl:text>

</xsl:attribute>

<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']" disable-output-escaping="yes"/>

</a>

<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

<xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"/>

</td></tr><tr><td valign="top" bgcolor="ghostwhite" class="headlines" >

<ul>

<xsl:for-each select="//*[local-name()='item']">

<li>

<a>

<xsl:attribute name="href">

<xsl:value-of select="*[local-name()='link']"/>

</xsl:attribute>

<xsl:attribute name="target">

<xsl:text>top</xsl:text>

</xsl:attribute>

<xsl:value-of select="*[local-name()='title']" disable-output-escaping="yes"/>

</a>

<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

<xsl:value-of select="*[local-name()='description']" disable-output-escaping="yes"/>

</li>

</xsl:for-each>

</ul>

</td></tr>

</table>

</xsl:template>

<xsl:template match="/">

<xsl:apply-templates/>

</xsl:template>

</xsl:stylesheet>


XML has a few disadvantages as well. The biggest disadvantage is that, without a formal description, a document is worth little. If you want to exchange documents with another company, for example, you will have to agree on every single point, starting from what each tag means; you will also have to agree on the semantic meaning of the content.

Another disadvantage is that XML documents are a great deal larger than most text files. On top of that, the repeated opening and closing tags use a lot of space. On the other hand. XML compresses well.

Now you have some idea of what the Extensible Markup Language is all about. Letís take a look at the syntax.


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...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




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