Ruby Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
SFTP
SMTP
Socket / SSL
Spider
SSH
SSH Key
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
LZW

 

 

 

 

 

 

 

XML in Japanese

Downloads for Windows/Linux and Install Instructions

Example ruby script handling an XML document with Japanese tags and content.

# file: xmlJapanese.rb
# 
# Demonstrates how to work with Japanese XML documents

require 'rubygems'
require 'chilkat'

# The Chilkat XML parser for Ruby is freeware.  The code demonstrated in this
# example can be used in both commercial and non-commercial applications without 
# restriction.  

# Some Chilkat XML Ruby examples utilize these online XML data samples:
# http://www.chilkatsoft.com/xml-samples/bookstore.xml
# http://www.chilkatsoft.com/xml-samples/nutrition.xml
# http://www.chilkatsoft.com/xml-samples/pigs.xml
# http://www.chilkatsoft.com/xml-samples/plants.xml
# http://www.chilkatsoft.com/xml-samples/japanese.xml
# http://www.chilkatsoft.com/xml-samples/hamlet.xml
    
# This example works with japanese.xml
xml = Chilkat::CkXml.new()
xml.LoadXmlFile("japanese.xml")

# This source file is Shift_JIS encoded...
# Loop over nodes having this tag: 業務名
strTag = Chilkat::CkString.new()
strTag.appendEnc("業務名","Shift_JIS")

# Indicate that string inputs should be utf-8
xml.put_Utf8(true)
strContent = Chilkat::CkString.new()
node = xml.SearchForTag(nil,strTag.getUtf8())
while (node != nil) 
	node.get_Content(strContent)
	# Redirect this output to a file.  DOS windows do not display utf-8 correctly.
	printf "%s: %s\n",strTag.getUtf8(),strContent.getUtf8()
	node = xml.SearchForTag(node,strTag.getUtf8())
end







 

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