Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

  

  

  Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

  

  

  

  

 

FAQ

XML Parser ActiveX COM VCL Component

Quick Tutorial

Using Chilkat XML to create, navigate, and manipulate XML data files is easy. There is only one object (ChilkatXml) and this represents a node in an XML document.

To begin, here is some sample XML data:

<contact lastModified="1/20/2002" lastEmailed="1/28/2002">
<name>John Smith</name>
<email>john@chilkatsoft.com</email>
<address>
<street>1700 Pennsylvania Ave.</street>
<city>Wheaton</city>
<state>Illinois</state>
<zip>60187</zip> </address> </contact>

When this XML is loaded with the LoadXml or LoadXmlFile methods, we get a tree of ChilkatXml objects that looks like this:



Each node in the tree above is a ChilkatXml object. Each node has a tag, content, 0 or more attributes, and 0 or more children. (The tags are displayed in the tree above) A Visual Basic program that reads this sample XML data is shown below,and following it is the output produced.

    ' The ChilkatXml component cannot be placed on the Visual Basic form,
    ' and must be created dynamically.
    Dim rootNode As ChilkatXml
    Set rootNode = New ChilkatXml
    
    rootNode.LoadXmlFile ("tutorial.xml")
    
    Dim nameNode As ChilkatXml
    Set nameNode = rootNode.GetChildWithTag("name")
    
    Dim emailNode As ChilkatXml
    Set emailNode = rootNode.GetChildWithTag("email")
    
    Dim addressNode As ChilkatXml
    Set addressNode = rootNode.GetChildWithTag("address")
    
    Dim streetNode As ChilkatXml
    Set streetNode = addressNode.GetChildWithTag("street")
    
    Dim cityNode As ChilkatXml
    Set cityNode = addressNode.GetChildWithTag("city")
    
    Dim stateNode As ChilkatXml
    Set stateNode = addressNode.GetChildWithTag("state")
    
    Dim zipNode As ChilkatXml
    Set zipNode = addressNode.GetChildWithTag("zip")
    
    Text1.Text = "rootNode: tag=[" + rootNode.Tag + _
        "] content=[" + rootNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "  1st attribute: name=[" + _
        rootNode.GetAttributeName(0) + "] value=[" + _
        rootNode.GetAttributeValue(0) + "]" + vbCrLf
    Text1.Text = Text1.Text + "  2nd attribute: name=[" + _
        rootNode.GetAttributeName(1) + "] value=[" + _
        rootNode.GetAttributeValue(1) + "]" + vbCrLf
    Text1.Text = Text1.Text + "nameNode: tag=[" + nameNode.Tag + _
        "] content=[" + nameNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "emailNode: tag=[" + emailNode.Tag + _
        "] content=[" + emailNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "addressNode: tag=[" + addressNode.Tag + _
        "] content=[" + addressNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "streetNode: tag=[" + streetNode.Tag + _
        "] content=[" + streetNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "cityNode: tag=[" + cityNode.Tag + _
        "] content=[" + cityNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "stateNode: tag=[" + stateNode.Tag + _
        "] content=[" + stateNode.Content + "]" + vbCrLf
    Text1.Text = Text1.Text + "zipNode: tag=[" + zipNode.Tag + _
        "] content=[" + zipNode.Content + "]" + vbCrLf

The output for the program above is:

rootNode: tag=[contact] content=[]
  1st attribute: name=[lastModified] value=[1/20/2002]
  2nd attribute: name=[lastEmailed] value=[1/28/2002]
nameNode: tag=[name] content=[John Smith]
emailNode: tag=[email] content=[john@chilkatsoft.com]
addressNode: tag=[address] content=[]
streetNode: tag=[street] content=[1700 Pennsylvania Ave.]
cityNode: tag=[city] content=[Wheaton]
stateNode: tag=[state] content=[Illinois]
zipNode: tag=[zip] content=[60187]

               
 


 

 

 


Privacy Statement. Copyright 2000-2008 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, and Windows 95/98/NT4.