FoxPro Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
Socket
Spider
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
DKIM / DomainKey
NTLM
RSS
Atom
Byte Array
Service
PPMD
Deflate
DH Key Exchange
DSA
FileAccess
Bzip2
LZW

 

Non-Chilkat Links
Text and String Handling

AddAttribute - Insert New Attribute in XML Node

Demonstrates adding an name=value attribute to an XML tag.

This example uses the XML sample file sample1.xml. The sample1.xml file contains this content:

Download Chilkat XML ActiveX

LOCAL loXml
LOCAL lnSuccess
LOCAL lnBFound
LOCAL lnNumChildren
LOCAL i

loXml = CreateObject('Chilkat.Xml')

lnSuccess = loXml.LoadXmlFile("sample1.xml")
IF (lnSuccess <> 1) THEN
    ? loXml.LastErrorText
    QUIT
ENDIF

*  Navigate to the "books" node:

lnBFound = loXml.FindChild2("books")
IF (lnBFound = 0) THEN
    ? "No books child found!"
    QUIT
ENDIF

lnNumChildren = loXml.NumChildren

FOR i = 0 TO lnNumChildren - 1

    *  Navigate to the Nth book (we'll assume success...)
    lnBFound = loXml.GetChild2(i)

    *  Display the book title:
    ? loXml.GetAttrValue("title")

    *  Add a new integer attribute:
    *  Should never fail..
    lnSuccess = loXml.AddAttributeInt("bookId",i)

    *  Add a new unread="yes" attribute:
    lnSuccess = loXml.AddAttribute("unread","yes")

    *  Navigate back up to the parent:
    lnSuccess = loXml.GetParent2()

NEXT

*  Navigate back to the document root:
loXml.GetRoot2()

*  Save the updated document:
lnSuccess = loXml.SaveXml("modified.xml")
IF (lnSuccess <> 1) THEN
    ? loXml.LastErrorText
    QUIT
ENDIF

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · ASP Mail Component · XML Parser