summaryrefslogtreecommitdiff
path: root/src/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib')
-rw-r--r--src/contrib/README5
-rw-r--r--src/contrib/crypt/how1
-rw-r--r--src/contrib/crypt/md5.cpp295
-rw-r--r--src/contrib/crypt/md5.h59
-rw-r--r--src/contrib/crypt/md5crypt.cpp187
-rw-r--r--src/contrib/xml/README504
-rw-r--r--src/contrib/xml/tinyxml.cpp1453
-rw-r--r--src/contrib/xml/tinyxml.h1655
-rw-r--r--src/contrib/xml/tinyxmlerror.cpp76
-rw-r--r--src/contrib/xml/tinyxmlparser.cpp1581
10 files changed, 0 insertions, 5816 deletions
diff --git a/src/contrib/README b/src/contrib/README
deleted file mode 100644
index 873f114..0000000
--- a/src/contrib/README
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory includes source code which has been included directly into yChat but is not
-programmed by the yChat project explicitly which means the source code here is from extern.
-
-Used versions:
-tinyxml 2.3.2
diff --git a/src/contrib/crypt/how b/src/contrib/crypt/how
deleted file mode 100644
index d60c94b..0000000
--- a/src/contrib/crypt/how
+++ /dev/null
@@ -1 +0,0 @@
-hash = md5::MD5Crypt(this->password.c_str(), salt);
diff --git a/src/contrib/crypt/md5.cpp b/src/contrib/crypt/md5.cpp
deleted file mode 100644
index 1f74478..0000000
--- a/src/contrib/crypt/md5.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-/*:*
- *: File: ./src/contrib/crypt/md5.cpp
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-#include <string.h> /* for memcpy() */
-#include "md5.h"
-
-namespace md5
-{
-
-#ifndef HIGHFIRST
-#define byteReverse(buf, len) /* Nothing */
-#else
-void byteReverse(unsigned char *buf, unsigned longs);
-
-#ifndef ASM_MD5
-/*
-* Note: this code is harmless on little-endian machines.
-*/
-void
-byteReverse(unsigned char *buf, unsigned longs)
-{
- uint32 t;
- do
- {
- t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
- ((unsigned) buf[1] << 8 | buf[0]);
- *(uint32 *) buf = t;
- buf += 4;
- }
- while (--longs);
-}
-#endif
-#endif
-
-/*
- * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
- * initialization constants.
- */
-void
-MD5Init(struct MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-}
-
-/*
- * Update context to reflect the concatenation of another buffer full
- * of bytes.
- */
-void
-MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
-{
- uint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t)
- {
- unsigned char *p = (unsigned char *) ctx->in + t;
-
- t = 64 - t;
- if (len < t)
- {
- memcpy(p, buf, len);
- return;
- }
- memcpy(p, buf, t);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64)
- {
- memcpy(ctx->in, buf, 64);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memcpy(ctx->in, buf, len);
-}
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-void
-MD5Final(unsigned char digest[16], struct MD5Context *ctx)
-{
- unsigned count;
- unsigned char *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8)
- {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset(p, 0, count);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset(ctx->in, 0, 56);
- }
- else
- {
- /* Pad block to 56 bytes */
- memset(p, 0, count - 8);
- }
- byteReverse(ctx->in, 14);
-
- /* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
-
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- byteReverse((unsigned char *) ctx->buf, 4);
- memcpy(digest, ctx->buf, 16);
- memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */
-}
-
-#ifndef ASM_MD5
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. MD5Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-void
-MD5Transform(uint32 buf[4], uint32 const in[16])
-{
- register uint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-#endif
-}
diff --git a/src/contrib/crypt/md5.h b/src/contrib/crypt/md5.h
deleted file mode 100644
index 9ac8a49..0000000
--- a/src/contrib/crypt/md5.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*:*
- *: File: ./src/contrib/crypt/md5.h
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-#ifndef MD5_H
-#define MD5_H
-
-namespace md5
-{
-#ifdef __alpha
-typedef unsigned int uint32;
-#else
-
-typedef unsigned long uint32;
-#endif
-
-struct MD5Context
-{
- uint32 buf[4];
- uint32 bits[2];
- unsigned char in[64];
-};
-
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
- unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
-void MD5Transform(uint32 buf[4], uint32 const in[16]);
-
-
-char *
-MD5Crypt(const char *pw, const char *salt);
-/*
- * This is needed to make RSAREF happy on some MS-DOS compilers.
- */
-typedef struct MD5Context MD5_CTX;
-}
-#endif /* !MD5_H */
diff --git a/src/contrib/crypt/md5crypt.cpp b/src/contrib/crypt/md5crypt.cpp
deleted file mode 100644
index 1e30c88..0000000
--- a/src/contrib/crypt/md5crypt.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*:*
- *: File: ./src/contrib/crypt/md5crypt.cpp
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- */
-
-/*
- * Ported from FreeBSD to Linux, only minimal changes. --marekm
- */
-
-#include <unistd.h>
-/* #include <stdio.h> */
-#include <string.h>
-#include "md5.h"
-
-namespace md5
-{
-
-static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
- "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static void
-to64(char *s, unsigned long v, int n)
-{
- while (--n >= 0)
- {
- *s++ = itoa64[v&0x3f];
- v >>= 6;
- }
-}
-
-/*
- * UNIX password
- *
- * Use MD5 for what it is best at...
- */
-
-char *
-MD5Crypt(const char *pw, const char *salt)
-{
- static const char *magic = "$1$"; /*
- * This string is magic for
- * this algorithm. Having
- * it this way, we can get
- * get better later on
- */
- static char passwd[120], *p;
- static const char *sp,*ep;
- unsigned char final[16];
- int sl,pl,i,j;
- MD5_CTX ctx,ctx1;
- unsigned long l;
-
- /* Refine the Salt first */
- sp = salt;
-
- /* If it starts with the magic string, then skip that */
- if (!strncmp(sp,magic,strlen(magic)))
- sp += strlen(magic);
-
- /* It stops at the first '$', max 8 chars */
- for (ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
- continue;
-
- /* get the length of the true salt */
- sl = ep - sp;
-
- MD5Init(&ctx);
-
- /* The password first, since that is what is most unknown */
- MD5Update(&ctx,(const unsigned char*)pw,strlen(pw));
-
- /* Then our magic string */
- MD5Update(&ctx,(const unsigned char*)magic,strlen(magic));
-
- /* Then the raw salt */
- MD5Update(&ctx,(const unsigned char*)sp,sl);
-
- /* Then just as many characters of the MD5(pw,salt,pw) */
- MD5Init(&ctx1);
- MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
- MD5Update(&ctx1,(const unsigned char*)sp,sl);
- MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
- MD5Final(final,&ctx1);
- for (pl = strlen(pw); pl > 0; pl -= 16)
- MD5Update(&ctx,final,pl>16 ? 16 : pl);
-
- /* Don't leave anything around in vm they could use. */
- memset(final,0,sizeof final);
-
- /* Then something really weird... */
- for (j=0,i = strlen(pw); i ; i >>= 1)
- if (i&1)
- MD5Update(&ctx, final+j, 1);
- else
- MD5Update(&ctx, (const unsigned char*)pw+j, 1);
-
- /* Now make the output string */
- strcpy(passwd,magic);
- strncat(passwd,sp,sl);
- strcat(passwd,"$");
-
- MD5Final(final,&ctx);
-
- /*
- * and now, just to make sure things don't run too fast
- * On a 60 Mhz Pentium this takes 34 msec, so you would
- * need 30 seconds to build a 1000 entry dictionary...
- */
- for (i=0;i<1000;i++)
- {
- MD5Init(&ctx1);
- if (i & 1)
- MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
- else
- MD5Update(&ctx1,final,16);
-
- if (i % 3)
- MD5Update(&ctx1,(const unsigned char*)sp,sl);
-
- if (i % 7)
- MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
-
- if (i & 1)
- MD5Update(&ctx1,final,16);
- else
- MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
- MD5Final(final,&ctx1);
- }
-
- p = passwd + strlen(passwd);
-
- l = (final[ 0]<<16) | (final[ 6]<<8) | final[12];
- to64(p,l,4);
- p += 4;
- l = (final[ 1]<<16) | (final[ 7]<<8) | final[13];
- to64(p,l,4);
- p += 4;
- l = (final[ 2]<<16) | (final[ 8]<<8) | final[14];
- to64(p,l,4);
- p += 4;
- l = (final[ 3]<<16) | (final[ 9]<<8) | final[15];
- to64(p,l,4);
- p += 4;
- l = (final[ 4]<<16) | (final[10]<<8) | final[ 5];
- to64(p,l,4);
- p += 4;
- l = final[11] ;
- to64(p,l,2);
- p += 2;
- *p = '\0';
-
- /* Don't leave anything around in vm they could use. */
- memset(final,0,sizeof final);
-
- return passwd;
-}
-
-}
diff --git a/src/contrib/xml/README b/src/contrib/xml/README
deleted file mode 100644
index c03aaad..0000000
--- a/src/contrib/xml/README
+++ /dev/null
@@ -1,504 +0,0 @@
-ATTENTION:
-
-This version of TinyXML has ben very little modified by
-Paul C. Buetow in 2004 to fit the yChat project.
-
-To get the original source go to
-http://www.sourceforge.net/projects/tinyxml
-
-/** @mainpage
-
-<h1> TinyXml </h1>
-
-TinyXml is a simple, small, C++ XML parser that can be easily
-integrating into other programs.
-
-
-<h2> What it does. </h2>
-
-In brief, TinyXml parses an XML document, and builds from that a
-Document Object Model (DOM) that can be read, modified, and saved.
-
-XML stands for "eXtensible Markup Language." It allows you to create
-your own document markups. Where HTML does a very good job of marking
-documents for browsers, XML allows you to define any kind of document
-markup, for example a document that describes a "to do" list for an
-organizer application. XML is a very structured and convenient format.
-All those random file formats created to store application data can
-all be replaced with XML. One parser for everything.
-
-The best place for the complete, correct, and quite frankly hard to
-read spec is at <a href="http://www.w3.org/TR/2004/REC-xml-20040204/">
-http://www.w3.org/TR/2004/REC-xml-20040204/</a>. An intro to XML
-(that I really like) can be found at
-<a href="http://skew.org/xml/tutorial/">http://skew.org/xml/tutorial</a>.
-
-There are different ways to access and interact with XML data.
-TinyXml uses a Document Object Model (DOM), meaning the XML data is parsed
-into a C++ objects that can be browsed and manipulated, and then
-written to disk or another output stream. You can also construct an XML document from
-scratch with C++ objects and write this to disk or another output
-stream.
-
-TinyXml is designed to be easy and fast to learn. It is two headers
-and four cpp files. Simply add these to your project and off you go.
-There is an example file - xmltest.cpp - to get you started.
-
-TinyXml is released under the ZLib license,
-so you can use it in open source or commercial code. The details
-of the license are at the top of every source file.
-
-TinyXml attempts to be a flexible parser, but with truly correct and
-compliant XML output. TinyXml should compile on any reasonably C++
-compliant system. It does not rely on exceptions or RTTI. It can be
-compiled with or without STL support. TinyXml fully supports
-the UTF-8 encoding, and the first 64k character entities.
-
-
-<h2> What it doesn't do. </h2>
-
-It doesnt parse or use DTDs (Document Type Definitions) or XSLs
-(eXtensible Stylesheet Language.) There are other parsers out there
-(check out www.sourceforge.org, search for XML) that are much more fully
-featured. But they are also much bigger, take longer to set up in
-your project, have a higher learning curve, and often have a more
-restrictive license. If you are working with browsers or have more
-complete XML needs, TinyXml is not the parser for you.
-
-The following DTD syntax will not parse at this time in TinyXml:
-
-@verbatim
- <!DOCTYPE Archiv [
- <!ELEMENT Comment (#PCDATA)>
- ]>
-@endverbatim
-
-because TinyXml sees this as a !DOCTYPE node with an illegally
-embedded !ELEMENT node. This may be addressed in the future.
-
-<h2> Code Status. </h2>
-
-TinyXml is mature, tested code. It is very stable. If you find
-bugs, please file a bug report is on the sourceforge web site
-(www.sourceforge.net/projects/tinyxml).
-We'll get them straightened out as soon as possible.
-
-There are some areas of improvement; please check sourceforge if you are
-interested in working on TinyXml.
-
-
-<h2> Features </h2>
-
-<h3> Using STL </h3>
-
-TinyXml can be compiled to use or not use STL. When using STL, TinyXml
-uses the std::string class, and fully supports std::istream, std::ostream,
-operator<<, and operator>>. Many API methods have both 'const char*' and
-'const std::string&' forms.
-
-When STL support is compiled out, no STL files are included whatsover. All
-the string classes are implemented by TinyXml itself. API methods
-all use the 'const char*' form for input.
-
-Use the compile time #define:
-
- TIXML_USE_STL
-
-to compile one version or the other. This can be passed by the compiler,
-or set as the first line of "tinyxml.h".
-
-Note: If compiling the test code in Linux, setting the environment
-variable TINYXML_USE_STL=YES/NO will control STL compilation. In the
-Windows project file, STL and non STL targets are provided. In your project,
-its probably easiest to add the line "#define TIXML_USE_STL" as the first
-line of tinyxml.h.
-
-<h3> UTF-8 </h3>
-
-TinyXml supports UTF-8 allowing to manipulate XML files in any language. TinyXml
-also supports "legacy mode" - the encoding used before UTF-8 support and
-probably best described as "extended ascii".
-
-Normally, TinyXml will try to detect the correct encoding and use it. However,
-by setting the value of TIXML_DEFAULT_ENCODING in the header file, TinyXml
-can be forced to always use one encoding.
-
-TinyXml will assume Legacy Mode until one of the following occurs:
-<ol>
- <li> If the non-standard but common "UTF-8 lead bytes" (0xef 0xbb 0xbf)
- begin the file or data stream, TinyXml will read it as UTF-8. </li>
- <li> If the declaration tag is read, and it has an encoding="UTF-8", then
- TinyXml will read it as UTF-8. </li>
- <li> If the declaration tag is read, and it has no encoding specified, then
- TinyXml will read it as UTF-8. </li>
- <li> If the declaration tag is read, and it has an encoding="something else", then
- TinyXml will read it as Legacy Mode. In legacy mode, TinyXml will
- work as it did before. It's not clear what that mode does exactly, but
- old content should keep working.</li>
- <li> Until one of the above criteria is met, TinyXml runs in Legacy Mode.</li>
-</ol>
-
-What happens if the encoding is incorrectly set or detected? TinyXml will try
-to read and pass through text seen as improperly encoded. You may get some strange
-results or mangled characters. You may want to force TinyXml to the correct mode.
-
-<b> You may force TinyXml to Legacy Mode by using LoadFile( TIXML_ENCODING_LEGACY ) or
-LoadFile( filename, TIXML_ENCODING_LEGACY ). You may force it to use legacy mode all
-the time by setting TIXML_DEFAULT_ENCODING = TIXML_ENCODING_LEGACY. Likewise, you may
-force it to TIXML_ENCODING_UTF8 with the same technique.</b>
-
-For English users, using English XML, UTF-8 is the same as low-ASCII. You
-don't need to be aware of UTF-8 or change your code in any way. You can think
-of UTF-8 as a "superset" of ASCII.
-
-UTF-8 is not a double byte format - but it is a standard encoding of Unicode!
-TinyXml does not use or directly support wchar, TCHAR, or Microsofts _UNICODE at this time.
-It is common to see the term "Unicode" improperly refer to UTF-16, a wide byte encoding
-of unicode. This is a source of confusion.
-
-For "high-ascii" languages - everything not English, pretty much - TinyXml can
-handle all languages, at the same time, as long as the XML is encoded
-in UTF-8. That can be a little tricky, older programs and operating systems
-tend to use the "default" or "traditional" code page. Many apps (and almost all
-modern ones) can output UTF-8, but older or stubborn (or just broken) ones
-still output text in the default code page.
-
-For example, Japanese systems traditionally use SHIFT-JIS encoding.
-Text encoded as SHIFT-JIS can not be read by tinyxml.
-A good text editor can import SHIFT-JIS and then save as UTF-8.
-
-The <a href="http://skew.org/xml/tutorial/">Skew.org link</a> does a great
-job covering the encoding issue.
-
-The test file "utf8test.xml" is an XML containing English, Spanish, Russian,
-and Simplified Chinese. (Hopefully they are translated correctly). The file
-"utf8test.gif" is a screen capture of the XML file, rendered in IE. Note that
-if you don't have the correct fonts (Simplified Chinese or Russian) on your
-system, you won't see output that matches the GIF file even if you can parse
-it correctly. Also note that (at least on my Windows machine) console output
-is in a Western code page, so that Print() or printf() cannot correctly display
-the file. This is not a bug in TinyXml - just an OS issue. No data is lost or
-destroyed by TinyXml. The console just doesn't render UTF-8.
-
-
-<h3> Entities </h3>
-TinyXml recognizes the pre-defined "character entities", meaning special
-characters. Namely:
-
-@verbatim
- &amp; &
- &lt; <
- &gt; >
- &quot; "
- &apos; '
-@endverbatim
-
-These are recognized when the XML document is read, and translated to there
-UTF-8 equivalents. For instance, text with the XML of:
-
-@verbatim
- Far &amp; Away
-@endverbatim
-
-will have the Value() of "Far & Away" when queried from the TiXmlText object,
-and will be written back to the XML stream/file as an ampersand. Older versions
-of TinyXml "preserved" character entities, but the newer versions will translate
-them into characters.
-
-Additionally, any character can be specified by its Unicode code point:
-The syntax "&#xA0;" or "&#160;" are both to the non-breaking space characher.
-
-
-<h3> Streams </h3>
-With TIXML_USE_STL on,
-TiXml has been modified to support both C (FILE) and C++ (operator <<,>>)
-streams. There are some differences that you may need to be aware of.
-
-C style output:
- - based on FILE*
- - the Print() and SaveFile() methods
-
- Generates formatted output, with plenty of white space, intended to be as
- human-readable as possible. They are very fast, and tolerant of ill formed
- XML documents. For example, an XML document that contains 2 root elements
- and 2 declarations, will still print.
-
-C style input:
- - based on FILE*
- - the Parse() and LoadFile() methods
-
- A fast, tolerant read. Use whenever you don't need the C++ streams.
-
-C++ style ouput:
- - based on std::ostream
- - operator<<
-
- Generates condensed output, intended for network transmission rather than
- readability. Depending on your system's implementation of the ostream class,
- these may be somewhat slower. (Or may not.) Not tolerant of ill formed XML:
- a document should contain the correct one root element. Additional root level
- elements will not be streamed out.
-
-C++ style input:
- - based on std::istream
- - operator>>
-
- Reads XML from a stream, making it useful for network transmission. The tricky
- part is knowing when the XML document is complete, since there will almost
- certainly be other data in the stream. TinyXml will assume the XML data is
- complete after it reads the root element. Put another way, documents that
- are ill-constructed with more than one root element will not read correctly.
- Also note that operator>> is somewhat slower than Parse, due to both
- implementation of the STL and limitations of TinyXml.
-
-<h3> White space </h3>
-The world simply does not agree on whether white space should be kept, or condensed.
-For example, pretend the '_' is a space, and look at "Hello____world". HTML, and
-at least some XML parsers, will interpret this as "Hello_world". They condense white
-space. Some XML parsers do not, and will leave it as "Hello____world". (Remember
-to keep pretending the _ is a space.) Others suggest that __Hello___world__ should become
-Hello___world.
-
-It's an issue that hasn't been resolved to my satisfaction. TinyXml supports the
-first 2 approaches. Call TiXmlBase::SetCondenseWhiteSpace( bool ) to set the desired behavior.
-The default is to condense white space.
-
-If you change the default, you should call TiXmlBase::SetCondenseWhiteSpace( bool )
-before making any calls to Parse XML data, and I don't recommend changing it after
-it has been set.
-
-
-<h3> Handles </h3>
-
-Where browsing an XML document in a robust way, it is important to check
-for null returns from method calls. An error safe implementation can
-generate a lot of code like:
-
-@verbatim
-TiXmlElement* root = document.FirstChildElement( "Document" );
-if ( root )
-{
- TiXmlElement* element = root->FirstChildElement( "Element" );
- if ( element )
- {
- TiXmlElement* child = element->FirstChildElement( "Child" );
- if ( child )
- {
- TiXmlElement* child2 = child->NextSiblingElement( "Child" );
- if ( child2 )
- {
- // Finally do something useful.
-@endverbatim
-
-Handles have been introduced to clean this up. Using the TiXmlHandle class,
-the previous code reduces to:
-
-@verbatim
-TiXmlHandle docHandle( &document );
-TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).Element();
-if ( child2 )
-{
- // do something useful
-@endverbatim
-
-Which is much easier to deal with. See TiXmlHandle for more information.
-
-
-<h3> Row and Column tracking </h3>
-Being able to track nodes and attributes back to their origin location
-in source files can be very important for some applications. Additionally,
-knowing where parsing errors occured in the original source can be very
-time saving.
-
-TinyXml can tracks the row and column origin of all nodes and attributes
-in a text file. The TiXmlBase::Row() and TiXmlBase::Column() methods return
-the origin of the node in the source text. The correct tabs can be
-configured in TiXmlDocument::SetTabSize().
-
-
-<h2> Using and Installing </h2>
-
-To Compile and Run xmltest:
-
-A Linux Makefile and a Windows Visual C++ .dsw file is provided.
-Simply compile and run. It will write the file demotest.xml to your
-disk and generate output on the screen. It also tests walking the
-DOM by printing out the number of nodes found using different
-techniques.
-
-The Linux makefile is very generic and will
-probably run on other systems, but is only tested on Linux. You no
-longer need to run 'make depend'. The dependecies have been
-hard coded.
-
-<h3>Windows project file for VC6</h3>
-<ul>
-<li>tinyxml: tinyxml library, non-STL </li>
-<li>tinyxmlSTL: tinyxml library, STL </li>
-<li>tinyXmlTest: test app, non-STL </li>
-<li>tinyXmlTestSTL: test app, STL </li>
-</ul>
-
-<h3>Linux Make file</h3>
-At the top of the makefile you can set:
-
-PROFILE, DEBUG, and TINYXML_USE_STL. Details (such that they are) are in
-the makefile.
-
-In the tinyxml directory, type "make clean" then "make". The executable
-file 'xmltest' will be created.
-
-
-
-<h3>To Use in an Application:</h3>
-
-Add tinyxml.cpp, tinyxml.h, tinyxmlerror.cpp, tinyxmlparser.cpp, and tinystr.cpp to your
-project or make file. That's it! It should compile on any reasonably
-compliant C++ system. You do not need to enable exceptions or
-RTTI for TinyXml.
-
-
-<h2> How TinyXml works. </h2>
-
-An example is probably the best way to go. Take:
-@verbatim
- <?xml version="1.0" standalone=no>
- <!-- Our to do list data -->
- <ToDo>
- <Item priority="1"> Go to the <bold>Toy store!</bold></Item>
- <Item priority="2"> Do bills</Item>
- </ToDo>
-@endverbatim
-
-Its not much of a To Do list, but it will do. To read this file
-(say "demo.xml") you would create a document, and parse it in:
-@verbatim
- TiXmlDocument doc( "demo.xml" );
- doc.LoadFile();
-@endverbatim
-
-And its ready to go. Now lets look at some lines and how they
-relate to the DOM.
-
-@verbatim
-<?xml version="1.0" standalone=no>
-@endverbatim
-
- The first line is a declaration, and gets turned into the
- TiXmlDeclaration class. It will be the first child of the
- document node.
-
- This is the only directive/special tag parsed by by TinyXml.
- Generally directive targs are stored in TiXmlUnknown so the
- commands wont be lost when it is saved back to disk.
-
-@verbatim
-<!-- Our to do list data -->
-@endverbatim
-
- A comment. Will become a TiXmlComment object.
-
-@verbatim
-<ToDo>
-@endverbatim
-
- The "ToDo" tag defines a TiXmlElement object. This one does not have
- any attributes, but does contain 2 other elements.
-
-@verbatim
-<Item priority="1">
-@endverbatim
-
- Creates another TiXmlElement which is a child of the "ToDo" element.
- This element has 1 attribute, with the name "priority" and the value
- "1".
-
-Go to the
-