RAD Studio
ContentsIndex
PreviousUpNext
Working with XML documents
Name 
Description 
XML (Extensible Markup Language) is a markup language for describing structured data. It is similar to HTML, except that the tags describe the structure of information rather than its display characteristics. XML documents provide a simple, text-based way to store information so that it is easily searched or edited. They are often used as a standard, transportable format for data in Web applications, business-to-business communication, and so on.
XML documents provide a hierarchical view of a body of data. Tags in the XML document describe the role or meaning of each data element, as illustrated in the following document, which... more 
The Document Object Model (DOM) is a set of standard interfaces for representing a parsed XML document. These interfaces are implemented by a number of different third-party vendors. If you do not want to use the default vendor that ships with Delphi, there is a registration mechanism that lets you integrate additional DOM implementations by other vendors into the XML framework.
The XMLDOM unit includes declarations for all the DOM interfaces defined in the W3C XML DOM level 2 specification. Each DOM vendor provides an implementation for these interfaces.
  • To use one of the DOM vendors for which Delphi already... more 
The VCL defines a number of classes and interfaces for working with XML documents. These simplify the process of loading, editing, and saving XML documents.
To use the XML classes for examining or editing an XML document you start by setting up an instance of TXMLDocument. You can then work with the nodes of the XML document component to examine or edit the body of the XML document. 
The starting point for working with an XML document is the TXMLDocument component. 
Once an XML document has been parsed by a DOM implementation, the data it represents is available as a hierarchy of nodes. Each node corresponds to a tagged element in the document. For example, given the following XML:  
It is possible to work with an XML document using only the TXMLDocument component and the IXMLNode interface it surfaces for the nodes in that document, or even to work exclusively with the DOM interfaces (avoiding even TXMLDocument). However, you can write code that is much simpler and more readable by using the XML Data Binding wizard.
The Data Binding wizard takes an XML schema or data file and generates a set of interfaces that map on top of it. For example, given XML data that looks like the following:  
 
Once the wizard has generated a set of interfaces and implementation classes, you can use them to work with XML documents that match the structure of the document or schema you supplied to the wizard. Just as when you are using only the built-in XML components, your starting point is the TXMLDocument component that appears on the Internet category of the Tool Palette
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!