Home arrow Delphi-Kylix arrow Delphi and the DOM
DELPHI-KYLIX

Delphi and the DOM


Welcome to the second part of a four-part series on Delphi and the DOM. In the first article, we discussed Delphi and XML. Now that you have some idea of the core elements of XML documents, we can talk about how to manipulate them in Delphi.

Author Info:
By: David Web
Rating: 4 stars4 stars4 stars4 stars4 stars / 4
November 10, 2008
TABLE OF CONTENTS:
  1. · Delphi and the DOM
  2. · Coding with the DOM in Delphi
  3. · XMLDOM.pas Unit continued
  4. · Even More XMLDOM.pas Unit

print this article
SEARCH DEVARTICLES

Delphi and the DOM
(Page 1 of 4 )

XML Documents and Delphi

There are two ways in which you can manipulate XML documents:

  • Using the Document Object Model interface

  • Using the Simple API for XML or SAX

The two techniques could not be more different from each other.

  • The Document Object Model loads the entire document into a hierarchical tree of nodes, allowing you to read them and manipulate them to change the document. For this reason, the Document Object Model is suitable when you want to navigate the XML structure in memory and edit it, or for creating new documents from scratch.

  • The Simple API for XML or SAX parses the document, firing an event for each element without building a structure in memory. Once parsed by the Simple API for XML, the document is lost, but this operation is generally much faster than the construction of the Document Object Model tree. Using the Simple API for XML is good for reading an XML document once, i.e if you are looking for a portion of its data.

There is another way to manipulate or to create XML documents: string management. Creating a document by adding strings is the fastest operation, particularly if you can do a single pass (and don't need to modify nodes already generated). Reading documents by strings is very fast, but can become difficult for complex structures.

Delphi provides two more methods you should know about. The first is the definition of interfaces that map the document structure; this method is used to access the document instead of the generic DOM interface. This approach makes for faster coding and more robust applications.The second approach is the development of transformations that enable you to read a generic XML document into a ClientDataSet component or save the dataset into an XML file for a given structure.

Which of these two is better? Well, that you will have to decide based on your needs. So how do we code for DOM in Delphi? That is what we will be looking at next.


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