Kaydet (Commit) 796cdd8a authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

İksemel will be a suitable kit. I rewrite Gurer's iksemel

üst 7774c143
......@@ -28,6 +28,52 @@
# Debug files
#Autotool files
#Configure files
#Iks test files
#Iks compiled files
#Makefile files
#Tex files
#Libtool files
Gurer Ozen <madcat@e-kolay.net>
Bernhard R. Link (code)
Fabien Ninoles (code)
Evan Prodromou (jabberx improvements, project maintenance)
David Yitzchak Cohen (countless bug reports)
Benoit Laniel (mingw port)
Darrell Karbott (ikstransport)
Rafal Piotrowski (SASL auth)
This diff is collapsed.
This diff is collapsed.
iksemel is developed and released under GNU Lesser General Public License.
A copy of the license can be found in the file COPYING. You should read it
before sending patches to the iksemel, since it is implicitly assumed that
your patches are also submitted under the LGPL license.
Main goal of the iksemel is removing complexity from programs using the
library and the library itself. This is the reason why only a subset of XML
is supported. Some things like UTF16, entity definitons, DTDs will be eventually
implemented when we found ways to implement them without adding
too much complexity to the iksemel code. Somewhat external standarts
(XPath, XQuery, XSLT, vs) will probably not make it into the iksemel.
* validation
I think easiest way to add this feature is writing another parser based on the
sax parser which parses a dtd (either from sax parser's markup callback which
needs to be implemented or from an external source via iks_vsax_set_dtd() call)
and checks the arguments of sax callbacks. Using it via dom or stream parsers
can require some clever tricks. there are also xml schemas. they are easy to parse
(it is xml anyway) but can be hard to apply.
* utf16
There are two sides of this. Improving parser to accept utf16 can be relatively
easy. But on the client side things can get confusing. What will be the default
character set used by iks_new(), iks_insert_cdata() and similar functions? and
how they will allow other charsets to be used. Supporting more than utf8 and
utf16 is more difficult. Hopefully there is no immediate need for this. Jabber
uses only utf8 and you can use iconv if you are using another charset in your
application. Btw, there is also byte order issue which is silly. Inventor of BOM
crap must be killed.
* jabber roster
Roster handling generally depends on the UI system used. But I think a generic
roster handler which parses roster result, pushes, presence changes and
allows application to access and display this data can be useful. Challenge
here is making it UI independent and extensible by the application.
File Layout:
* iksemel.texi Documentation in texinfo format.
* common.h Internal header for some common definitions.
* iksemel.h Library API
* finetune.h Default memory allocation sizes.
* ikstack.c Memory management functions.
* utility.c Small string utility functions.
* iks.c XML tree management.
* sax.c SAX parser.
* dom.c DOM parser.
* stream.c Stream parser.
* sha.c SHA1 hash functions.
* jabber.c Jabber utilities.
* filter.c Packet filter for Jabber.
(self test programs)
(varius utility programs)
Basic Installation
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
Installation Names
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
`configure' recognizes the following options to control how it
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
Print a summary of the options to `configure', and exit.
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
This diff is collapsed.
## Process this file with automake to produce Makefile.in
SUBDIRS = include src tools test doc
EXTRA_DIST = HACKING iksemel.pc.in
pkgconfig_DATA = iksemel.pc
$(MAKE) dist distdir=$(PACKAGE)-`date +"%y%m%d"`
mv $(PACKAGE)-`date +"%y%m%d"`.tar.gz ../
cp include/iksemel.h ../
cat include/finetune.h src/utility.c src/ikstack.c src/sax.c src/iks.c src/dom.c >../iksemel.c
V1.4 (2018-02-18)
* Lookuping the codes and start new developing
* Added iks_set_cdata function
* Write a pyiks.c module for using iksemel in python
V1.3 (2007-08-02)
* Project is moved to
there is also a new mailing list at:
Please use those instead of old jabberstudio.org addresses.
* iksemel is now participating in Coverity Inc's free software
quality improvement program (http://scan.coverity.com). As a
first result, a few problems found by Coverity's static analysis
tool in the iks_sasl_challenge() are fixed in this release, and
other than that, iksemel passes from defect test with no problems.
* Extra padding problem in the base64 encoder is fixed. Some servers
were having problems with extra '=' padded SASL digests.
* New dom functions: iks_append(), iks_prepend(), iks_append_cdata(),
iks_prepend_cdata(). You can append/prepend new nodes within the
siblings with them, insert_ functions were only appending at the
last child. Thus editing a tree is much easier now.
* iks_load was giving error on files with multiply of 4Kb sizes, fixed.
V1.2 (2004-08-06)
* SASL authentication.
* SSH connections via gnutls library.
* Socket code abstracted, you can even provide your own transport functions.
* Compiles on Windows with MinGW.
* iks_sha_print() uses lowercase hex numbers to comply with latest jabber.
* New stack implementation, much faster and uses less memory.
Unfortunately API has changed a bit:
iks_stack_strcat, strcatv, print functions removed.
iks_stack_stats modified.
iks_stack_strecat renamed to iks_stack_strcat.
iks_stack_new takes two chunk sizes, one for structures one for strings.
iks_stack_strdup returns (char *).
V1.1 (2003-09-11)
* Minor sax parser speed up.
* iks_string() and dom parser performance is improved greatly.
* iksperf: new tool for measuring iksemel performance.
* ikslint: better error checking. supports stdin. can display tag usage histogram.
* New dom functions: iks_copy(), iks_copy_within(), iks_root(), iks_tree().
* License of the documentation changed to GPL from GNU FDL.
V1.0 (2003-06-29)
* API redesigned.
* iconv interface removed.
* ikslint and iksroster tools.
* Jabber packet filter.
* IPv6 support.
* iks_find_with_attrib, iks_next_tag, iks_prev_tag, iks_first_tag functions.
* Parser improvements (CDATA sections, comments, UTF8 validity checks)
* Memory pools are replaced with object stacks.
V0.1 (2002-10-30)
* First release.
iksemel 1.4
Copyright (c) 2000-2007 Gurer Ozen <madcat@e-kolay.net>
This is an XML parser library mainly designed for Jabber applications.
It provides SAX, DOM, and special Jabber stream APIs. Library is coded
in ANSI C except the network code (which is POSIX compatible), thus
highly portable. Iksemel is released under GNU Lesser General Public
License. A copy of the license is included in the COPYING file.
Libtool, Automake and Autoconf packages are required for compiling cvs
Compiling & Install:
If you got the source from CVS, type
for creating configuration script and files.
Then type
now library is compiled. You can test it with
make check
and install it with
(become root if necessary)
make install
# iksemel
My XML Parser for my personal project.
This project has been forked from Pardus-Linux github repo but original iksemel has been written to use with python2. I have rewritten pyiks.c for using iksemel in python3.
You don't need anything other than an installed Python framework.
iksemel-lite source is included and compiled built-in to the module.
To compile and install: 
python3 setup.py install 
then you can import the iksemel module in your python programs.
===> Module Constants:
These enumeration constants are used to report the type of the Node objects.
===> Module Exceptions
* ParseError
Raised when given string or file contains invalid XML.
* NotTag
Raised when a function accepting a tag node got another type of object.
* NotData
Raised when a function accepting a data node got another type of object.
===> Module Functions:
* parse(filename)
Parses the given XML file, and returns the top level tag's node object.
* parseString(string)
Parses the given XML string and returns the top level tag's node object.
* newDocument(tagname)
Creates a new top level tag node object with given tag name.
===> Module Objects:
* Node
This object represents a node of the XML document tree. If you iterate
over a node object, you'll get the list of its child nodes.
===> Node Object Methods:
* type()
Returns the type of the node.
* data()
Returns character data for data nodes.
* name()
Returns the name of the tag for tag nodes.
* attributes()
Returns a list of node's attribute names. Returns an empty list
if there aren't any.
* getAttribute(attributename)
Returns the value of the given attribute for tag nodes. If such
an attribute doesn't exists, returns None.
* setAttribute(attributename, value)
Sets the given attribute's value for tag nodes. You can give
the value None for deleting an attribute.
* getTag(tagname)
Returns the first tag node child with the given name. If such a child
doesn't exists, returns None.
* getTagData(tagname)
Returns the contained character data from first tag node child with the
given name.
* tags(tagname=None)
Iterates over child tag nodes. If optional tagname is given, only
iterates over tags with the given name.
* firstChild()
Returns the first child node.
* parent()
Returns the parent node.
* root()
Returns the top level node.
* next()
Returns the next node. If this is the last sibling, returns None.
* nextTag(tagname=None)
Returns the next tag node. If optional tagname is given, returns the
next sibling tag node with the given name. Returns None if this is
the last such sibling.
* previous()
Returns the previous node. If this is the first sibling, returns None.
* previousTag(tagname=None)
Returns the previous tag node. If optional tagname is given, returns
the previous sibling tag node with the given name. Returns None if
this is the first such sibling.
* insertTag(tagname)
Inserts a new child tag node with given name to the child nodes.
Returns the newly created tag node object.
* insertData(data)
Inserts given character data to the child nodes. Returns the newly
created data node object.
* setData(data)
Deletes given tag's current child nodes, then inserts the data as
its child.
* insertNode(node)
Inserts given node tree to the child nodes. Returns the newly created
node object.
* appendTag(tagname)
Create a tag node with given name and append it as the next sibling.
Returns the newly created tag node object.
* appendData(data)
Appends given character data as the next sibling. Returns the newly
created data node object.
* prependTag(tagname)
Create a tag node with given name and append it as the previous
sibling. Returns the newly created tag node object.
* prependData(data)
Prepends given character data as the previous sibling. Returns the
newly created data node object.
* hide()
Deletes the node from document tree.
* toString()
Returns the XML string representation of node tree.
* toPrettyString()
Returns the XML string representation of node tree. Line feeds and
tabs are inserted into the document to make it look pretty.
This file contains a simple list of TODO items.
More general ideas can be found in the roadmap part of the file HACKING.
(in order of importance)
* parser: &#1234; and &#xA25F; like entities must be unescaped.
* packet filter or a generic xml filter? something like a simplified xpath?
* a separate utf8 validator function can be useful
* utf8 <-> utf16 conversion functions can be useful
* add python and ruby module files
* add programming support into cpp
anything else? :-)
# Run this to generate the configure script.
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo "Error: You must have 'autoconf' installed on your system in order"
echo " to generate a configure script."
exit 1
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
echo "Error: You must have 'autoheader' installed on your system in"
echo " order to generate a configure script."
echo " (Note that 'autoheader' is part of the 'autoconf' package)"
exit 1
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo "Error: You must have 'libtool' installed on your system in order"
echo " to generate a configure script."
exit 1
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo "Error: You must have 'automake' installed on your system in order"
echo " to generate a configure script."
exit 1
(aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo "Error: You must have 'aclocal' installed on your system in order"
echo " to generate a configure script."
echo " (Note that 'aclocal' is part of the 'automake' package)"
exit 1
srcdir=`dirname $0`
echo "Running libtoolize..."
libtoolize --copy --force --automake
echo "Running aclocal..."
echo "Running autoheader..."
echo "Running automake..."
automake --add-missing --gnu --include-deps
echo "Running autoconf..."
echo "Done!"
echo "Now run $srcdir/configure in order to create Makefiles."
dnl Process this file with autoconf to produce a configure script.
dnl Checks for programs
dnl Checks for header files
AC_CHECK_HEADERS(unistd.h strings.h errno.h)
dnl Checks for typedefs and structures
AC_CHECK_MEMBERS([struct stat.st_blksize])
dnl Special check for windows
case "$host_os" in
AC_CHECK_LIB(wsock32, main, , AC_MSG_ERROR(Winsock is needed for a Win32 build.))