Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Delphi Wrapper Classes and XML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Delphi Wrapper Classes and XML
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-11-17

    Table of Contents:
  • Delphi Wrapper Classes and XML
  • XML Properties, Methods, and Interface
  • A Demonstration
  • Second Part of Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Delphi Wrapper Classes and XML - A Demonstration


    (Page 3 of 4 )


    Earlier we created a program that loads an XML document into a memo component. In the following section we will create a program that will load an XML document into a DOM and then show the structure in a treeview, which incidentally is the only control in the component collection of Delphi that I think is useful for this kind of exercise.

    Loading the document is very simple, as you've seen from the previous example, but showing it in a tree is another matter altogether. Place two treeview components on a form and then add two buttons. Call the treeviews tv and tv1 respectively. Then call the first button "Load" and the other one "Exit." On the form, add an opendialog component (available from the dialog tab) and an xmldocument component (available from the Internet tab).

    Below is a listing for the entire application:


    unit Unit1;


    interface


    uses

    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

    Dialogs, xmldom, XMLIntf, msxmldom, XMLDoc, StdCtrls, ComCtrls;


    type

    TForm1 = class(TForm)

    xd: TXMLDocument;

    tv: TTreeView;

    Button1: TButton;

    Button4: TButton;

    od: TOpenDialog;

    tv1: TTreeView;

    procedure Button4Click(Sender: TObject);

    procedure FormCreate(Sender: TObject);

    procedure tv1DblClick(Sender: TObject);

    procedure Button1Click(Sender: TObject);

    private

    procedure DOMShow(Anode: IXMLNode; TNode: TTreeNode);

    { Private declarations }

    public

    fn:string;

    { Public declarations }

    end;

    const

    IMG_NODE_ROOT = 0;

    IMG_NODE_CLOSED = 1;

    IMG_NODE_OPEN = 2;

    IMG_NODE_ROOT2 = 3;

    IMG_NODE_CLOSED2 = 4;

    IMG_NODE_OPEN2 = 5;

    var

    Form1: TForm1;


    implementation


    {$R *.dfm}


    First we start by defining some variables, procedures and functions. The listing also shows the components that is used in the application. It is a good place to verify what components you need to built the application itself:


    procedure TForm1.Button4Click(Sender: TObject);

    begin

    close;

    end;

    More Delphi-Kylix Articles
    More By David Web


     

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







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT