summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS17
-rw-r--r--COPYING0
-rw-r--r--COPYING.LIB481
-rw-r--r--ChangeLog883
-rw-r--r--Copyright27
-rw-r--r--INSTALL0
-rw-r--r--Makefile.am37
-rw-r--r--NEWS0
-rw-r--r--README0
-rw-r--r--TODO30
-rwxr-xr-xautogen.sh50
-rw-r--r--configure.in35
-rwxr-xr-xinstall-sh250
-rwxr-xr-xmissing134
-rwxr-xr-xmkinstalldirs40
-rw-r--r--result/dav130
-rw-r--r--result/dav108
-rw-r--r--result/dav1125
-rw-r--r--result/dav126
-rw-r--r--result/dav1320
-rw-r--r--result/dav1417
-rw-r--r--result/dav1525
-rw-r--r--result/dav1610
-rw-r--r--result/dav1726
-rw-r--r--result/dav1810
-rw-r--r--result/dav1922
-rw-r--r--result/dav229
-rw-r--r--result/dav323
-rw-r--r--result/dav421
-rw-r--r--result/dav522
-rw-r--r--result/dav626
-rw-r--r--result/dav720
-rw-r--r--result/dav818
-rw-r--r--result/dav922
-rw-r--r--result/p3p26
-rw-r--r--test/dav124
-rw-r--r--test/dav105
-rw-r--r--test/dav1122
-rw-r--r--test/dav123
-rw-r--r--test/dav1317
-rw-r--r--test/dav1410
-rw-r--r--test/dav1522
-rw-r--r--test/dav165
-rw-r--r--test/dav1723
-rw-r--r--test/dav185
-rw-r--r--test/dav1919
-rw-r--r--test/dav226
-rw-r--r--test/dav320
-rw-r--r--test/dav416
-rw-r--r--test/dav515
-rw-r--r--test/dav623
-rw-r--r--test/dav717
-rw-r--r--test/dav815
-rw-r--r--test/dav919
-rw-r--r--test/p3p23
-rw-r--r--tester.c102
-rw-r--r--xml_entities.c353
-rw-r--r--xml_entities.h58
-rw-r--r--xml_parser.c1183
-rw-r--r--xml_parser.h61
-rw-r--r--xml_tree.c731
-rw-r--r--xml_tree.h113
62 files changed, 5320 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..c9ccf105
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,17 @@
+Seth Alves (seth@hungry.com)
+Radek Doulik <doulik@karlin.mff.cuni.cz>
+Miguel de Icaza <miguel@kernel.org>
+Szekeres Istvan (Pista) <szekeres@cyberspace.mht.bme.hu>
+Tim Janik <timj@gimp.org>
+Michael K. Johnson <johnsonm@redhat.com>
+Elliot Lee <sopwith@cuc.edu>
+Federico Mena <quartic@gimp.org>
+Molaro Paolo <lupus@dei.unipd.it>
+Jens Christian Restemeier <jchrr@hrz.Uni-Bielefeld.DE>
+Tom Tromey <tromey@cygnus.com>
+Marius Vollmer <mvo@zagadka.ping.de>
+Eckehard Berns <eb@berns.prima.ruhr.de>
+George Lebl <jirka@5z.com>
+Owen Taylor <owt1@cornell.edu>
+Tuomas Kuosmanen <tigert@gimp.org>
+Jaka Mocnik <jaka.mocnik@kiss.uni-lj.si>
diff --git a/COPYING b/COPYING
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/COPYING
diff --git a/COPYING.LIB b/COPYING.LIB
new file mode 100644
index 00000000..eb685a5e
--- /dev/null
+++ b/COPYING.LIB
@@ -0,0 +1,481 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 00000000..8e909b66
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,883 @@
+Wed Jul 22 16:47:14 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-config.c (_gnome_config_get_int_with_default):
+ Used wrong sense in previous change. Duh.
+ (_gnome_config_get_float_with_default): Likewise.
+ (_gnome_config_get_bool_with_default): Likewise.
+
+ * libgnome/gnome-config.c (_gnome_config_get_int_with_default): It
+ isn't an error if the key is not found.
+ (_gnome_config_get_float_with_default): Likewise.
+ (_gnome_config_get_bool_with_default): Likewise.
+ (_gnome_config_get_translated_string_with_default): Removed legacy
+ "C" locale code.
+
+Sat Jul 18 20:18:57 1998 John Ellis <johne@bellatlantic.net>
+
+ * libgnome/gnome-dentry.[ch] (gnome_desktop_entry_load_unconditional):
+ new function necessary for loading/editing 'broken' .desktop entries.
+
+1998-07-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * configure.in: Added gnome-canvas-line and gnome-canvas-util to
+ the sources.
+
+1998-07-15 Raja R Harinath <harinath@cs.umn.edu>
+
+ * acconfig.h (NEED_DECLARATION_GETHOSTNAME): New tag.
+
+ * configure.in (jpeglib.h): Undef a few more symbols to prevent
+ preprocessor symbol clashes. In this case, jpeglib.h defines
+ HAVE_STDDEF_H and HAVE_STDLIB_H.
+
+1998-07-14 Raja R Harinath <harinath@cs.umn.edu>
+
+ * configure.in (AM_PATH_GLIB): New test.
+ (LIBGNOME_LIBS): List `-lglib' too.
+ Based on suggestion from
+ Manish Vachharajani <mvachhar@vger.rutgers.edu>.
+
+ * gnome-config.in: Make sure library ordering is preserved, when
+ removing duplicates.
+
+ * Makefile.am (AUTOMAKE_OPTIONS): Require automake 1.3.
+
+1998-07-13 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (built_SUBDIRS): Add `test-suite'.
+
+1998-07-12 Raja R Harinath <harinath@cs.umn.edu>
+
+ * configure.in (dlopen): Test directly for the function.
+ (dlerror): Include $DL_LIB in $LIBS before testing.
+ From James Michael Mastros <spare@jennifer-unix.dyn.ml.org>.
+
+mar jul 7 10:13:44 ART 1998 Horacio J. Peña <horape@compendium.com.ar>
+
+ * libgnomeui/gnome-client.h: Added gnome_client_save &
+ gnome_client_restart_session.
+ * libgnomeui/gnome-client.c: Added gnome_client_save &
+ gnome_client_restart_session.
+
+1998-07-06 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * configure.in: Added gnome-canvas-image files.
+
+Tue Jul 7 00:01:19 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-parse.c: Don't include <malloc.h>.
+
+Sun Jul 5 18:21:31 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-exec.h: Declare gnome_execute_async_with_env.
+ * libgnome/gnome-exec.c (gnome_execute_async_with_env): New function.
+ (gnome_execute_async): Use it.
+
+1998-07-05 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * configure.in: Added gnome-canvas-text.[ch].
+
+1998-07-04 Stuart Parmenter <pavlov@pavlov.net>
+
+ * libgnomeui/gnome-mdi.c
+ (child_list_menu_remove_item): added a check
+ to see if the menu existed... this may not be a good idea, but since
+ gnome-mdi's documentation isn't all that, it made sense:)
+ (child_list_menu_add_item): same thing
+
+1998-07-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/Makefile.am (dns_helper_LDADD): Cosmetic cleanups.
+
+Tue Jun 30 16:12:55 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-config.c: Removed backwards-compatibility hack.
+ (_gnome_config_get_translated_string_with_default): Handle
+ language specs like `pt_PT@foo'.
+
+ * libgnome/gnome-i18n.c: Include libgnomeP.h.
+ * libgnome/gnome-help.c: Include gnome-i18nP.h, sys/wait.h.
+ * libgnome/gnomelib-init.c: Include gnome-i18nP.h.
+ * libgnome/gnome-mime.c: Include libgnomeP.h.
+ * libgnome/gnome-config.c: Include libgnomeP.h.
+ * libgnome/Makefile.am (noinst_HEADERS): Added libgnomeP.h.
+ * libgnome/libgnomeP.h: New file.
+
+1998-06-29 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-config.c (gnome_config_pop_prefix,
+ gnome_config_remove_prefix_list): Removed. If any application
+ relied on this stuff it was broken. That is what push/pop prefix
+ are for.
+
+Mon Jun 29 00:18:10 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-config.c (_gnome_config_set_float): Use %.17g
+ format, to ensure full precision.
+
+1998-06-28 Raja R Harinath <harinath@cs.umn.edu>
+
+ New, improved, gnome-config script. (Not related to
+ libgnome/gnome-config.[ch]).
+ * Makefile.am (gnome-config): Move generation to ...
+ * configure.in (AC_SUBST): ... here.
+ (GNOME_LIBDIR,GNOME_INCLUDEDIR): Use ${..}, not $(..) for variable
+ substitution.
+ * gnome-config.in: Rehaul.
+
+1998-06-26 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
+
+ * configure.in (ALL_LINGUAS): Added Poruguese translation.
+
+Thu Jun 18 23:52:07 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.[ch]: made it possible to call, set and
+ sync handlers, this is usefull for autosyncing that can be
+ done in libgnomeui .. or any toolkit specific lib
+
+Thu Jun 18 00:24:21 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.[ch]: added two calls, _remove_prefix_list
+ and _set_prefix_list, these functions can be used by routines
+ which want to set it's own prefix stack, but don't wanna corrupt
+ the prefix stack for the rest of the application.
+
+ * libgnome/gnome-i18n.c: added #include <string.h>
+
+Tue Jun 16 15:24:46 1998 Havoc Pennington <hp@pobox.com>
+
+ * libgnome/gnome-util.h, gnome-util.c (gnome_dirrelative_file):
+ make char * args const.
+ (gnome_datadir_file, gnome_libdir_file, gnome_pixmap_file,
+ gnome_unconditional_pixmap_file, gnome_unconditional_libdir_file,
+ gnome_unconditional_datadir_file): const char *
+ (g_filename_pointer): Return a pointer to the last part of a
+ path. Maybe this should replace g_filename_index.
+ (g_extension_pointer): Return a pointer to the filename extension.
+ (g_copy_vector): Copy char **. const isn't right, needs fixing.
+ (g_flatten_vector): Make a vector into a single string.
+ (g_is_image_filename): Determine if a filename's extension
+ suggests an image file.
+
+ * libgnome/gnome-dentry.h, gnome-dentry.c
+ (gnome_is_program_in_path): put const on the char * arg. Shouldn't
+ this function go in gnome-util?
+ (gnome_desktop_entry_load): const char *
+ (gnome_desktop_entry_load_flags): const char *
+ (gnome_desktop_entry_copy): copy the struct. I guess I didn't end
+ up using this, but here it is anyway.
+
+Sun Jun 14 18:03:14 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-exec.c (gnome_execute_async): Removed redundant
+ exit (report_errno never returns). Set errno after waitpid, not
+ before it.
+ (gnome_execute_shell): Added cast to avoid warning.
+
+Sun Jun 14 19:16:00 1998 Manish Vachharajani <mvachhar@vger.rutgers.edu>
+
+ * libgnome/gnome-exec.c gnome_execute_async: We need to call
+ waitpid, even on failure, since if the second child fails to exec,
+ the first will become a zombie until the SIGCHLD is handled via
+ waitpid. Also, if the second child fails to exec, exit, don't
+ fall through.
+
+Sun Jun 14 13:33:50 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/Makefile.am (INCLUDES): Look in ../intl. Don't look in
+ ../support (the need for this is discovered by configure).
+
+Sun Jun 14 09:34:36 1998 Dick Porter <dick@cymru.net>
+
+ * configure.in tweak for libgif
+
+Thu Jun 11 09:55:25 1998 Radek Doulik <gis@academy.cas.cz>
+
+ * libgnome/gnome-help.h: added GNOME_DECLS
+ * libgnome/gnome-string.h: added GNOME_DECLS
+
+1998-06-11 Raja R Harinath <harinath@cs.umn.edu>
+
+ * configure.in: Remove stuff relating to `build_CC'.
+
+Wed Jun 10 19:24:07 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * changed things to use GTK_HAVE_ACCEL_GROUP instead of
+ HAVE_DEVGTK... installed headers depending on config.h
+ stuff is bad.
+
+Wed Jun 10 14:19:39 EDT 1998 Gregory McLean <gregm@comstar.net>
+
+ * YES! gnome-libs as a whole now compiles against gtk 1.0.x (on my
+ machine atleast) Now I hope I can get back to work.
+
+Wed Jun 10 00:47:12 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-parse.c (our_options): New global.
+ (help_parser): New global.
+ (gnome_parse_arguments): Register help_parser.
+ (GROUP): New define.
+
+Tue Jun 9 22:55:20 EDT 1998 Gregory McLean <gregm@comstar.net>
+
+ * macros/gnome-x-checks.m4: quick and dirty check for devel gtk and
+ define HAVE_DEVGTK if its found. This should save us a bunch of
+ work next time we go to do a release we won't have to chase
+ around code that only works on the devel version of gtk.
+ * libgnomeui/* bracketed all code that requires the devel branch of
+ gtk.. I think I got it all.
+ * acconfig.h : new tag HAVE_DEVGTK, use this to mark your changes that
+ require the dev branch of gtk.
+
+1998-06-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * Makefile.am (built_SUBDIRS): Added test-gnome to the list of directories.
+
+Tue Jun 9 02:30:36 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * configure.in: redid graphics lib checks
+
+1998-06-08 Jim Pick <jim@jimpick.com>
+
+ * Added debian packaging dir.
+
+Mon Jun 8 22:49:28 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-exec.c (gnome_execute_shell): Free element of
+ argv.
+
+Mon Jun 8 20:46:40 EDT 1998 Gregory McLean <gregm@comstar.net>
+
+ * libgnomeui/gtkdial.c: removed some dead code bloat :)
+
+Mon Jun 8 19:13:50 1998 Havoc Pennington <hp@pobox.com>
+
+ * libgnome/gnome-util.h, gnome-util.c (g_filename_index):
+ Get the starting index of the last component of a path.
+ Sort of the reverse of g_concat_dir_and_file.
+
+1998-06-08 Martin Baulig <martin@home-of-linux.org>
+
+ * configure.in: Added some stuff for cross-compiling.
+
+ * gnomeConf.sh.in (need_gnome_support): New tag.
+
+1998-06-07 Stuart Parmenter <pavlov@innerx.net>
+
+ * libgnomeui/gnome-dialog.[ch]: changes to make it use GtkAccelGroup
+ functions, i.e. making it compile :)
+ * libgnomeui/gnome-stock.c: same thing
+ * libgnomeui/stock-demo.c: same thing
+ * libgnomeui/*: same thing :)
+
+1998-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_destroy): Remove
+ references to the gnome-config entry when discarding a
+ gnome-dentry and release the memory associated with the
+ GnomeDesktopEntry.
+
+Mon Jun 1 13:23:26 1998 Havoc Pennington <hp@pobox.com>
+
+ * libgnome/gnome-exec.h, gnome-exec.c (gnome_execute_async):
+ Change arg 3 to char * const argv[] to match execvp
+ (gnome_execute_shell): New function. Like system(), but
+ backgrounds the process and uses the user's shell.
+
+1998-05-25 Marc Ewing <marc@germ.labs.redhat.com>
+
+ * libgnome/gnome-help.c (gnome_help_goto): make sure
+ the help browser process lives on.
+
+Sat May 23 12:24:39 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-dentry.c: fixed two small bugs in the launch
+ stuff.
+
+Fri May 22 18:24:09 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-util.c (g_file_exists): `filename' argument now
+ const.
+
+ Some -Wall fixes:
+ * libgnome/lib_date.c: Include <stdio.h> for sprintf.
+ * libgnome/gnome-triggers.c (gnome_triggers_add_trigger): Removed
+ unused variable.
+ (gnome_triggers_do): Likewise.
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_launch_with_args):
+ Removed unused variable.
+ * libgnome/gnome-config.c: Declare strndup if required.
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_launch_with_args):
+ Use `SHELL -c' to execute command.
+
+ * libgnome/gnome-util.c (gnome_util_user_shell): New function;
+ modified from gnome-terminal.
+ * libgnome/gnome-util.h: Declare gnome_util_user_shell.
+
+1998-05-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.h: Added prototype for gnome_desktop_entry_launch_with_args().
+
+1998-05-20 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-config.c (gnome_config_make_vector,
+ gnome_config_assemble_vector): export the routines that make a
+ vector out from a string and the routine that assembles a vector
+ into a string. We need them outside as well.
+
+1998-05-19 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_launch_with_args):
+ New function. Allows to launch a dentry with optional extra
+ arguments. In the future we should probably scan ->exec vector
+ for ocurrences of '%f' and relpace that with the argumnets. For
+ now, we just appendm them.
+
+ * libgnome/gnome-config.c (_gnome_config_get_vector_with_default):
+ Set the entire argvp array to NULL.
+ Count correctly the number of arguments.
+
+1998-05-19 Raja R Harinath <harinath@cs.umn.edu>
+
+ * acconfig.h (HAVE_SYS_ERRLIST): New tag.
+
+Tue May 19 14:42:32 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.c: (escape_string_and_dup) fixed a segfault
+
+1998-05-19 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_free): We were
+ leaking item->geometry.
+
+ * configure.in (GLIB_LIBS): use the correct glib depending on what
+ is installed. Bug reported by Mark Galassi. Thanks to Owen for
+ suggesting the proper approach to this.
+
+1998-05-18 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_free): Do not free
+ item->exec as the gnome_string_arry_free already freed that.
+
+Mon May 18 14:10:42 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-config.c (_gnome_config_set_vector): Also quote
+ `\' characters.
+ (_gnome_config_get_vector_with_default): Don't duplicate result of
+ access_config. Allocate each element of array separately.
+
+1998-05-18 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-config.c (_gnome_config_get_vector_with_default):
+ Fix the routine. Simplify the parsing code with a slicker
+ routine. This should fix the panel problems, at least it works
+ for me.
+
+1998-04-30 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-util.c (g_copy_strings): Put back optimized and
+ non-leaking copy_strings.
+Sat May 16 00:44:21 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-string.c: Removed dead check for delim==NULL.
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_launch): Look up
+ desired terminal program in config database.
+
+ * libgnome/gnome-i18n.c (LANGKEY): Changed value.
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_load_flags): Treat
+ "Exec" entry as a vector.
+ (gnome_desktop_entry_save): Likewise.
+ (gnome_desktop_entry_free): Likewise.
+ (gnome_desktop_entry_launch): Likewse. Also use
+ gnome_execute_async.
+ * libgnome/gnome-dentry.h (GnomeDesktopEntry): Added `exec_length'
+ member. `exec' member now a `char**'.
+ * libgnome/libgnome.h: Include gnome-exec.h.
+ * libgnome/Makefile.am (libgnome_la_SOURCES): Added gnome-exec.c.
+ (libgnomeinclude_HEADERS): Added gnome-exec.h.
+ * libgnome/gnome-exec.h: New file.
+ * libgnome/gnome-exec.c: New file.
+
+ * libgnome/gnome-config.c (_gnome_config_get_vector_with_default):
+ If no value available, set *argvp to NULL.
+
+1998-05-14 Raja R Harinath <harinath@cs.umn.edu>
+
+ * libgnome/gnome-i18n.c (gnome_i18n_init): It is not safe to pass
+ an `auto' variable to `putenv'.
+
+1998-05-13 Jaka Mocnik <jaka.mocnik@kiss.uni-lj.si>
+
+ * configure.in: When checking for libtiff link conftest against
+ Z_LIBS and JPEG_LIBS. Check failed for me otherwise.
+
+Wed May 13 13:34:10 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-i18n.h: Declare new functions.
+ * libgnome/gnome-i18n.c (LANGKEY): New macro.
+ (gnome_i18n_set_preferred_language): New function.
+ (gnome_i18n_init): Likewise.
+ (gnome_i18n_get_preferred_language): Likewise.
+ (guess_category_value): Return NULL as default domain.
+ (gnome_i18n_get_language_list): Handle NULL return from
+ guess_category_value.
+ * libgnome/gnomelib-init.c (gnomelib_init): Call gnome_i18n_init().
+
+Sat May 9 20:25:49 1998 Szekeres István <szekeres@cyberspace.mht.bme.hu>
+
+ * libgnome/gnome-string.c (gnome_string_join):
+ Pass terminator NULL to gnome_string_joinv so it will not sigsegv
+
+
+Wed May 6 13:16:14 1998 Tom Tromey <tromey@cygnus.com>
+
+ * configure.in: Check for sys/select.h.
+
+1998-04-29 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * libgnome/gnome-config.c
+ (_gnome_config_get_translated_string_with_default): Added fallback
+ mechanism to read old files that did have the [C] suffix on
+ translated strings.
+
+ * libgnome/gnome-config.c (_gnome_config_set_translated_string):
+ If the language is the default "C", we don't want to write the [C]
+ suffix to the file. This is so that this function will work in
+ pairs with gnome_config_get_translated_string().
+
+1998-04-29 Tristan Tarrant <ttarrant@etnoteam.it>
+
+ * configure.in: add checks for forkpty
+
+1998-04-27 Michael Fulbright <msf@redhat.com>
+
+ * libgnome/gnome-help.c (gnome_help_file_find_file):
+ strip off last '#' in the requested path, since most help
+ requests are going to be URLs.
+
+ * libgnome/gnome-help.c (gnome_help_display):
+ use gnome_help_file_find_file() function
+
+ * libgnomeui/gnome-app-helper.c (gnome_app_add_help_menu_entries):
+ use gnome_help_file_find_file() function to find topic.dat
+
+
+1998-04-27 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
+
+ * libgnome/gnome-help.c (gnome_help_file_find_file): Changed to
+ look for more than one language.
+ (gnome_help_file_path): Changed to use
+ gnome_help_file_find_file. If no file is found, than return a
+ value like in former times.
+
+ * libgnome/gnome-config.c
+ (_gnome_config_get_translated_string_with_default): Changed to
+ look for more than one language.
+ (_gnome_config_set_translated_string): Changed to support language
+ lists.
+
+ * libgnome/gnome-i18n.c (guess_category_value): New function.
+ (gnome_i18n_get_language_list): New function.
+
+ * libgnome/gnome-i18n.h: Added gnome_i18n_get_language_list, that
+ returns a list of languages, depending on the users environment.
+
+ * libgnome/gnome-i18nP.h: Likewise.
+
+1998-04-27 Michael Fulbright <msf@redhat.com>
+
+ * libgnome/gnome-help.c (gnome_help_file_find_file):
+ A new function which is similar to gnome_help_file_path(), except
+ that if the desired file is not found in the default locale,
+ the 'C' locale is also searched. The gnome_help_*
+ code may need to be rethought when handling i18n issues.
+
+Sat Apr 25 23:29:54 CEST 1998 Eckehard Berns <eb@berns.prima.de>
+
+ * libgnome/gnome-config.c (_gnome_config_get_vector_with_default):
+ escaped spaces have to get unescaped after reading.
+
+1998-04-21 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-config.c (gnome_config_get_string_with_default):
+ Added ultra-nasty binary compatibility hack for those hackers
+ without dual-p2 machines so that they dont have to recompile
+ everything. This will be gone soon.
+
+Thu Apr 23 01:53:44 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.c: added some missing compatibility
+ functions.
+
+Tue Apr 21 15:23:58 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.h: added gnome_config_get_real_path
+ and gnome_config_private_get_real_path macros, that
+ return the real path of a file in the config dir
+
+Tue Apr 21 14:30:25 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnomelib-init.c: create .gnome_private and
+ set mode to 0700 on every initialization, added
+ gnome_user_private_dir constant
+
+ * libgnome/libgnome.c: add gnome_user_private_dir extern
+ declaration
+
+ * libgnome/gnome-config.[ch]: made parse_path use either
+ private or normal path, and made defines for source
+ compatibility to new functions which have one more
+ argument which is gint priv, added gnome_config_private
+ defines to these functions that use the private directory
+
+Mon Apr 20 23:38:55 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.c: made it check for the entire
+ path first as a special case so that it doesn't end
+ up walking though the entire path if it exists
+
+Mon Apr 20 22:41:44 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.c: new function check_path
+ called before a file is opened for writing,
+ it will try to check if a the directory exists
+ and create it if neccessary. needs a bit of
+ a bit of optimization maybe and uses 755 by default
+ now which probably should be either 700 or specified
+ by user.
+
+1998-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_is_program_in_path): Return the
+ full pathname for the program if it is found on the path.
+ (gnome_desktop_entry_load_flags): Free the pathname according to
+ the new convention.
+
+Sun Apr 19 09:38:36 EDT 1998 Gregory McLean <gregm@comstar.net>
+
+ * rasterapi/.cvsignore: added to ignore generated files.
+
+Mon Apr 13 22:14:11 1998 George Lebl <jirka@5z.com>
+
+ * configure.in: make Makefile in libgnomeui/pixmaps
+
+1998-04-13 Raja R Harinath <harinath@cs.umn.edu>
+
+ * libgnome/gnome-help.c (gnome_help_file_path): Be more
+ `const'-correct.
+
+1998-04-12 Raja R Harinath <harinath@cs.umn.edu>
+
+ Introduce `gnomesupport.h'.
+ * configure.in (SUPPORTINCS): Define NEED_GNOMESUPPORT_H if
+ `libgnomesupport' is built.
+ (GNOME_INCLUDEDIR): Likewise. Also, use $(pkglibdir)/include
+ instead of $(includedir)/libgnomesupport. (See support/ChangeLog.)
+
+ * gnome.h: Include `gnomesupport.h' if NEED_GNOMESUPPORT_H is
+ defined. This should make `gnomesupport.h' pretty transparent.
+
+Mon Apr 6 00:05:34 1998 Havoc Pennington <hp@pobox.com>
+
+ * libgnome/gnome-i18nP.h: new file
+ * libgnome/gnome-i18n.h: #warning if used together with
+ gnome-i18nP.h
+ * libgnome/Makefile.am: noinst_HEADERS = gnome-i18nP.h
+
+Sat Apr 04 12:12:47 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-config.c: do init on functions that
+ previously errored out with "called before init"
+
+1998-03-31 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/lib_date.c, lib_date.h, lib_defs.h, lib_date.README:
+ Added the lib_date routines from Steffen Beyer.
+
+Sat Mar 28 19:28:48 MST 1998 Nathan Summers <rock@gimp.org>
+
+ * libgnome/gnome_dl.c: changed lib_path to libpath in the hpux code
+
+Tue Mar 24 00:39:36 1998 Tom Tromey <tromey@cygnus.com>
+
+ * Makefile.am (DISTCLEANFILES): Removed.
+
+Thu Mar 19 18:57:05 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-parse.h: Added copyright info.
+ * libgnome/gnome-parse.c: Likewise.
+
+ * libgnome/gnome-history.c (gnome_history_recently_used): Changed
+ interface.
+ Added copyright info.
+ * libgnome/gnome-history.h: Added comments, updated
+ gnome_history_recently_used decl.
+ Added copyright info.
+
+Wed Mar 18 20:33:30 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_save): Save the
+ geometry field of the gnome-dentry.
+
+Tue Mar 17 21:34:35 1998 George Lebl <jirka@5z.com>
+
+ * libgnomeui/gtk-{plug,socket}.[ch]: added Owen's plugsocket
+ code to libgnomeui
+
+Sun Mar 15 15:24:41 1998 Owen Taylor <owt1@cornell.edu>
+
+ * Makefile.am configure.in gnomeConf.sh.in:
+ Add GTK_CFLAGS to GNOME_INCLUDEDIR, and GTK_LIBS to the
+ approriate *LIBS variables.
+
+ * libgnome/Makefile.am libgnomeui/Makefile.am:
+ Added GTK_CFLAGS to INCLUDES
+
+Tue Mar 10 11:58:38 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-parse.h: Just look for <argp.h>.
+
+Mon Mar 9 20:37:56 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-parse.h: Add BEGIN_GNOME_DECLS and
+ END_GNOME_DECLS: they are *required* for C++ compilation.
+
+Sun Mar 8 17:15:17 1998 Tom Tromey <tromey@cygnus.com>
+
+ * version.h.in: Removed.
+ * configure.in: Don't create version.h.
+
+ * libgnome/Makefile.am (INCLUDES): Added @SUPPORTINCS@.
+
+ * configure.in (SUPPORTINCS, LIBSUPPORT): New defines.
+ (GNOME_LIBS): Include -lgnomesupport if required.
+ (GNOME_INCLUDEDIR): Include -I for libgnomesupport if required.
+
+ * gnomeConf.sh.in (GNOME_INCLUDEDIR, GNOMELIBDIR): Quote values.
+
+Fri Mar 6 21:42:09 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/libgnome.h: Include gnome-parse.h.
+
+Fri Mar 06 20:31:13 1998 George Lebl <jirka@5z.com>
+
+ * libgnome/gnome-dentry.c: fixed the _load function to always set
+ ->icon, at least to NULL, this was causing the panel to segfault
+
+Wed Mar 4 01:06:58 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/libgnome.h (gnomelib_register_arguments): Declare.
+ * libgnome/gnomelib-init.c (gnomelib_register_arguments): New
+ function.
+
+ * libgnome/Makefile.am (libgnome_la_SOURCES): Added
+ gnome-parse.c.
+ (libgnomeinclude_HEADERS): Added gnome-parse.h.
+ * libgnome/gnome-parse.h: New file.
+ * libgnome/gnome-parse.c: New file.
+
+ * libgnome/gnomelib-init.c (gnomelib_init): Removed argc, argv
+ arguments.
+ * libgnome/libgnome.h (gnomelib_init): Likewise.
+
+ * acconfig.h (HAVE_PROGRAM_INVOCATION_SHORT_NAME,
+ HAVE_PROGRAM_INVOCATION_NAME): Added.
+
+1998-02-28 Raja R Harinath <harinath@cs.umn.edu>
+
+ * libgnome/gnome-config.c (dump_sections): Don't crash if
+ p->section_name == NULL.
+ (*): Use `g_strdup' and `g_free' uniformly, throughout.
+
+Sat Feb 28 15:46:51 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-config.c (parse_path): Reverse Raja Harinath's
+ change that used "" instead of NULL.
+
+ If we use NULL here, the gnome-config-get-string routines can
+ distinguish between:
+
+ - NULL if they key was non-existant.
+ - "" if the key had an empty value.
+
+Thu Feb 26 21:12:26 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-util.c (gnome_dirrelative_file): Check inside the
+ user relative home directory for more files.
+
+1998-02-26 Mark Galassi <rosalia@cygnus.com>
+
+ * devel-docs/libgnomeui.sgml, devel-docs/libgnome.sgml:
+ added PSGML file option comments with a "parent document". This
+ makes it easier for emacs to load the subdocuments.
+
+1998-02-28 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
+
+ * libgnome/gnome-dentry.c (get_translated_string): Due to the
+ changes in libgnome/gnome-config.c (parse_path), empty strings
+ instead of the untranslated strings have beed returned, if a
+ translated string was not available. This is fixed now.
+
+Thu Feb 26 18:08:15 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c, libgnome/gnome-dentry.h: Dropped the
+ computed icon filenames, things will be scaled now by the panel.
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_load_flags): More
+ fields; a new parameter that avoids dumping the loaded
+ information.
+
+1998-02-25 Raja R Harinath <harinath@cs.umn.edu>
+
+ * libgnome/gnome-config.c (parse_path): Use "" instead of NULL.
+
+Wed Feb 25 20:16:13 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_load): Drop known
+ information on a dentry after loading.
+
+ Add more fields.
+
+1998-02-25 Raja R Harinath <harinath@cs.umn.edu>
+
+ * configure.in: Clean up the handling of {Z,PNG,JPEG,TIFF,GIF}_LIBS,
+ and their interaction with {GDK_IMLIB,GNOMEUI,GTKXMHTML}_LIBS.
+ (AC_SUBST): Remove {Z,PNG,JPEG}_LIBS.
+
+Tue Feb 24 20:01:42 1998 Maciej Stachowiak <mstachow@mit.edu>
+
+ * configure.in: Added checks for libraries that gdk_imlib depends
+ on, since libgnomeui now depends on libgdk_imlib. This is needed
+ for the libraries and demos (and probably other apps) to build
+ properly.
+
+1998-02-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gnome.h: Added #include <gdk_imlib.h>, as it is now required for
+ all of Gnome.
+
+1998-02-23 Mark Galassi <rosalia@nis.lanl.gov>
+
+ * configure.in (LIBGNOMEUI_LIBS):
+ (GNOMEUI_LIBS): added $Z_LIBS to both of these, sine gdk_imlib
+ might require them, and gdk_imlib is now always linked in
+ libgnomeui.
+
+1998-02-23 Marc Ewing <marc@redhat.com>
+
+ * libgnomeui/gnome-app-helper.{c,h}: added radio and check/toggle
+ button support, for both menus and toolbars. Also added two
+ new fields to the struct _GnomeUIInfo: user_data - is used as the
+ data parameter to the gtk_signal_connect() call for each item,
+ and unsed_data which should always be NULL. Previously the
+ data paramenter to gtk_signal_connect() came from the data
+ parameters to the *_interp() and *_with_data(), which was less
+ than optimal.
+
+ * libgnomeui/gnome-font-selector.c: Changes to support above.
+
+1998-02-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * libgnome/gnome-dl.c:
+ * libgnome/gnome-help.c: #include <string.h>
+
+ * configure.in (ALL_LINGUAS): Added "it" to ALL_LINGUAS
+
+1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * libgnome/gnome-score.h: Added missing #include <glib.h>
+
+1998-02-20 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
+
+ * libgnome/gnome-mime.c: Now includes 'libgnome.h' and 'gtk/gtk.h'
+ instead of 'gnome.h'. This removes the dependence from
+ 'libgnomeui.h'.
+
+ * devel-docs/.cvsignore: Added 'Makefile' and 'Makefile.in'.
+
+ * configure.in (ALL_LINGUAS): Added german translations.
+
+1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * libgnome/gnomelib-init.c (gnomelib_init): Added app_id parameter
+ to this function. Changes to the rest of Gnome are in progress.
+
+Wed Feb 18 09:25:38 ART 1998 Horacio J. Peña <horape@compendium.com.ar>
+
+ * devel-docs/Makefile.am: new.
+ * devel-docs/libgnome*.sgml: new.
+ * devel-docs/gdoc/: new dir.
+ * README: added licensing info for gtk-xmhtml and libgtktty.
+ * devel-docs/gnome-dev-info.sgml: splited. (now the libgnome(ui)?
+ chapters are independant files.
+ * libgnomeui/gnome-about.h: Documented.
+ * libgnomeui/{almost_all}.h: Added #include <libgnome/gnome-defs.h>
+
+Tue Feb 17 23:37:50 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * libgnome/gnome-dentry.c (gnome_desktop_entry_load): Provide a
+ default for the Terminal entry.
+
+Mon Feb 16 13:13:19 1998 Tom Tromey <tromey@cygnus.com>
+
+ * libgnome/gnome-config.c (gnome_config_get_vector_with_default):
+ Don't include space separator at start of a vector element.
+
+Sat Feb 14 00:35:54 1998 Tom Tromey <tromey@cygnus.com>
+
+ * Makefile.am (confexecdir): Renamed.
+ (confexec_DATA): Likewise.
+
+ * configure.in (GNOME_LIBDIR, GNOME_INCLUDEDIR): Define to be
+ expanded in make.
+ (AC_OUTPUT): Don't create gnomeConf.sh.
+ * Makefile.am (release): Fixed typo.
+ (gnomeConf.sh): New target.
+
+1998-02-13 Raja R Harinath <harinath@cs.umn.edu>
+
+ * configure.in (GNOME_INCLUDEDIR): Include `-I'.
+ (GNOME_LIBDIR): Include `-L'.
+
+ * autogen.sh: Moved most of the stuff to `macros/autogen.sh'.
+
+ * Makefile.am (SUBDIRS): Add macros.
+ (macros/macros.dep): New maintainer rule for handling automatic
+ rebuilding of aclocal.m4 if any of the macros in `macros/' change.
+
+ * configure.in (AC_OUTPUT): Generate macros/Makefile too.
+
+1998-02-12 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * libgnomeui/gnome-app.c (gnome_app_configure_positions): Fixed
+ bug where it would sigsegv if the app had a toolbar but no menubar.
+ (gnome_app_new): Removed unused variable prefix.
+ Removed unused prototype for gnome_app_rightclick_event.
+ (gnome_app_rightclick_menubar): Removed unused variable i.
+ (gnome_app_rightclick_toolbar): Likewise.
+ (gnome_app_set_menus): Fixed uninitialized variable warnings.
+ (gnome_app_rightclick_menubar): gtk_menu_popup time parameter set
+ to event->time. This makes the popup timer work correctly.
+ (gnome_app_rightclick_toolbar): Likewise.
+
+1998-02-12 Raja R Harinath <harinath@cs.umn.edu>
+
+ * configure.in (GNOME_LIBDIR,GNOME_INCLUDEDIR): New configuration
+ variables used in `gnomeConf.sh'.
+ * gnomeConf.sh.in (GNOME_LIBDIR,GNOME_INCLUDEDIR): Moved here from
+ the `install-data-local' rule.
+
+ * Makefile.am (SUBDIRS): Add `support'.
+ (install-data-local): Remove.
+
+1998-02-10 Raja R Harinath <harinath@cs.umn.edu>
+
+ * HACKING: Added a note about `aclocal' and the `macros' subdir.
+
+ * autogen.sh: Run `aclocal -I macros' if macros subdir exists.
+
+ * configure.in: Moved AC_GNOME_CHECK and AC_GNOME_X_CHECKS to
+ macros subdir (as gnome.m4 and gnome-x-checks.m4 resp.).
diff --git a/Copyright b/Copyright
new file mode 100644
index 00000000..c01ea4a7
--- /dev/null
+++ b/Copyright
@@ -0,0 +1,27 @@
+Copyright © 1998 World Wide Web Consortium, (Massachusetts Institute of
+Technology, Institut National de Recherche en Informatique et en
+Automatique, Keio University). All Rights Reserved.
+
+This software is available under the GNU Library Public License as described
+in the COPYING.LIB file.
+
+Note that the original distribution from W3C is also available under the
+W3C IPR SOFTWARE NOTICE, described at http://www.w3.org/COPYRIGHT.html
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Daniel Veillard <Daniel.Veillard@w3.org>
+Fri Jul 24 1998
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/INSTALL
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 00000000..a5df93c3
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,37 @@
+## Process this file with automake to produce Makefile.in
+
+noinst_PROGRAMS=tester
+
+lib_LTLIBRARIES = libxml_0.10.la
+
+libxml_0_10_la_SOURCES = \
+ xml_entities.c \
+ xml_parser.c \
+ xml_tree.c
+
+include_HEADERS = \
+ xml_entities.h \
+ xml_parser.h \
+ xml_tree.h
+
+DEPS = $(top_builddir)/libxml_0.10.la
+LDADDS = $(top_builddir)/libxml_0.10.la @Z_LIBS@
+
+tester_SOURCES=tester.c
+tester_LDFLAGS =
+tester_DEPENDENCIES = $(DEPS)
+tester_LDADD= $(LDADDS)
+
+tests : tester
+ @(DIR=`pwd`; cd $(srcdir) ; for i in test/* ; do \
+ if [ ! -d $$i ] ; then \
+ if [ ! -f result/`basename $$i` ] ; then \
+ echo New test file `basename $$i` ; \
+ $$DIR/tester $$i > result/`basename $$i` ; \
+ else \
+ echo Testing `basename $$i` ; \
+ $$DIR/tester $$i > result.`basename $$i` ; \
+ diff result/`basename $$i` result.`basename $$i` ; \
+ rm result.`basename $$i` ; \
+ fi ; fi ; done)
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/README
diff --git a/TODO b/TODO
new file mode 100644
index 00000000..8fd623c5
--- /dev/null
+++ b/TODO
@@ -0,0 +1,30 @@
+
+ TODO for the XML parser:
+
+- Support for UTF-8 encoding
+- progressive parsing. Currently the parser uses a single
+ string containing the full document. The good point is
+ that there is no context associated with the parser, the
+ full state is in the stack. The bad point is that such a
+ recursive design is hard to make progressive ...
+- Better error handling, use a dedicated, overridable error
+ handling function.
+- Keep track of line numbers for better error reporting.
+- DOM support, instead of using a proprietary in memory
+ format for the document representation, the parser should
+ call a DOM API to actually build the resulting document.
+ Then the parser becomes independent of the in-memory
+ representation of the document. Even better using RPC's
+ the parser can actually build the document in another
+ program.
+- finish the support for Entities.
+- Support for Comments (bad, should be in ASAP, they are parsed
+ but not stored).
+- Support for PI.
+- Support for CDATA.
+
+Done:
+- C++ support : John Ehresman <jehresma@dsg.harvard.edu>
+- Updated code to follow more recent specs, added compatibility flag
+
+$Id$
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 00000000..5460e0af
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile GLIB."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have libtool installed to compile GLIB."
+ echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have automake installed to compile GLIB."
+ echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+test -f xml_entities.h || {
+ echo "You must run this script in the top-level GLIB directory"
+ exit 1
+}
+
+if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish "
+ echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+aclocal
+automake
+autoconf
+./configure "$@"
+
+echo
+echo "Now type 'make' to compile GLIB."
diff --git a/configure.in b/configure.in
new file mode 100644
index 00000000..55af1e26
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,35 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.2)
+AC_INIT(xml_entities.h)
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(libxml, 0.10)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PATH_PROG(RM, rm, /bin/rm)
+AC_PATH_PROG(MV, mv, /bin/mv)
+AC_PATH_PROG(TAR, tar, /bin/tar)
+AC_PATH_PROG(GZIP, gzip, /bin/gzip)
+
+AM_PROG_LIBTOOL
+
+AM_MAINTAINER_MODE
+
+dnl Checks for libraries.
+Z_LIBS=
+AC_CHECK_LIB(z, inflate,
+ AC_CHECK_HEADER(zlib.h,
+ Z_LIBS="-lz"; AC_DEFINE(HAVE_LIBZ)))
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h)
+AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h zlib.h)
+
+dnl Checks for library functions.
+AC_FUNC_STRFTIME
+AC_CHECK_FUNCS(strdup strndup strerror snprintf )
+AC_SUBST(Z_LIBS)
+AC_OUTPUT(Makefile)
diff --git a/install-sh b/install-sh
new file mode 100755
index 00000000..ebc66913
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/missing b/missing
new file mode 100755
index 00000000..a6abd069
--- /dev/null
+++ b/missing
@@ -0,0 +1,134 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# 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, 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.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison touch file \`y.tab.c'
+ makeinfo touch the output file
+ yacc touch file \`y.tab.c'"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing - GNU libit 0.0"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`configure.in'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`configure.in'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`configure.in'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ touch config.h.in
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print \
+ | sed 's/^\(.*\).am$/touch \1.in/' \
+ | sh
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ touch y.tab.c
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100755
index 00000000..d0fd194f
--- /dev/null
+++ b/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id$
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/result/dav1 b/result/dav1
new file mode 100644
index 00000000..942f5eef
--- /dev/null
+++ b/result/dav1
@@ -0,0 +1,30 @@
+
+
+------- test/dav1 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.foo.bar/boxschema" prefix="R"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:prop>
+ <R:bigbox>
+ <R:BoxType>Box type A</R:BoxType>
+ </R:bigbox>
+ <R:author>
+ <R:Name>J.J. Dingleheimerschmidt</R:Name>
+ </R:author>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:response>
+ <D:response>
+ <D:prop>
+ <R:DingALing/>
+ <R:Random/>
+ </D:prop>
+ <D:status>HTTP/1.1 403 Forbidden</D:status>
+ <D:responsedescription> The user does not have access to the DingALing property.
+ </D:responsedescription>
+ </D:response>
+ <D:responsedescription> There has been an access violation error.
+ </D:responsedescription>
+</D:multistatus>
diff --git a/result/dav10 b/result/dav10
new file mode 100644
index 00000000..eca7ad69
--- /dev/null
+++ b/result/dav10
@@ -0,0 +1,8 @@
+
+
+------- test/dav10 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:owner>
+ <D:href>http://www.ics.uci.edu/~ejw/contact.html</D:href>
+</D:owner>
diff --git a/result/dav11 b/result/dav11
new file mode 100644
index 00000000..9c7816ec
--- /dev/null
+++ b/result/dav11
@@ -0,0 +1,25 @@
+
+
+------- test/dav11 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:prop>
+ <D:lockdiscovery>
+ <D:activelock>
+ <D:locktype>write</D:locktype>
+ <D:lockscope>exclusive</D:lockscope>
+ <D:addlocks/>
+ <D:owner>
+ <D:href>
+ http://www.ics.uci.edu/~ejw/contact.html
+ </D:href>
+ </D:owner>
+ <D:timeout>Second-604800</D:timeout>
+ <D:locktoken>
+ <D:href>
+ opaquelocktoken:xyz122393481230912asdfa09s8df09s7df
+ </D:href>
+ </D:locktoken>
+ </D:activelock>
+ </D:lockdiscovery>
+</D:prop>
diff --git a/result/dav12 b/result/dav12
new file mode 100644
index 00000000..9b6cbf16
--- /dev/null
+++ b/result/dav12
@@ -0,0 +1,6 @@
+
+
+------- test/dav12 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:href>http://www.ics.uci.edu/~ejw/contact.html</D:href>
diff --git a/result/dav13 b/result/dav13
new file mode 100644
index 00000000..9ce781c6
--- /dev/null
+++ b/result/dav13
@@ -0,0 +1,20 @@
+
+
+------- test/dav13 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:href>
+ http://webdav.sb.aol.com/workspace/webdav/proposal.doc
+ </D:href>
+ <D:href>
+ http://webdav.sb.aol.com/workspace/webdav/
+ </D:href>
+ <D:status>HTTP/1.1 202 Accepted</D:status>
+ </D:response>
+ <D:response>
+ <D:href>http://foo.bar/blah</D:href>
+ <D:status>HTTP/1.1 403 Forbidden</D:status>
+ </D:response>
+</D:multistatus>
diff --git a/result/dav14 b/result/dav14
new file mode 100644
index 00000000..bf537972
--- /dev/null
+++ b/result/dav14
@@ -0,0 +1,17 @@
+
+
+------- test/dav14 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/patch/" prefix="D"?>
+<D:resourceupdate>
+ <D:replace XML-SPACE="PRESERVE">
+ <D:octet-range>14</D:octet-range>
+003CTITLE003ENew
+ Title003C/TITLE003E </D:replace>
+ <D:delete>
+ <D:octet-range>38-50</D:octet-range>
+ </D:delete>
+ <D:insert XML-SPACE="PRESERVE">
+ <D:octet-range>86</D:octet-range>
+003CP003ENew paragraph003C/P003E </D:insert>
+</D:resourceupdate>
diff --git a/result/dav15 b/result/dav15
new file mode 100644
index 00000000..7703289d
--- /dev/null
+++ b/result/dav15
@@ -0,0 +1,25 @@
+
+
+------- test/dav15 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.foocorp.com/Project/" prefix="F"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:prop>
+ <D:Source>
+ <D:link>
+ <F:projfiles>Source</F:projfiles>
+ <D:src>http://foo.bar/program</D:src>
+ <D:dst>http://foo.bar/src/main.c</D:dst>
+ </D:link>
+ <D:link>
+ <F:projfiles>Library</F:projfiles>
+ <D:src>http://foo.bar/program</D:src>
+ <D:dst>http://foo.bar/src/main.lib</D:dst>
+ </D:link>
+ <D:link>
+ <F:projfiles>Makefile</F:projfiles>
+ <D:src>http://foo.bar/program</D:src>
+ <D:dst>http://foo.bar/src/makefile</D:dst>
+ </D:link>
+ </D:Source>
+</D:prop>
diff --git a/result/dav16 b/result/dav16
new file mode 100644
index 00000000..3585ab15
--- /dev/null
+++ b/result/dav16
@@ -0,0 +1,10 @@
+
+
+------- test/dav16 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:propfind>
+ <D:prop>
+ <lockdiscovery/>
+ </D:prop>
+</D:propfind>
diff --git a/result/dav17 b/result/dav17
new file mode 100644
index 00000000..30a10af3
--- /dev/null
+++ b/result/dav17
@@ -0,0 +1,26 @@
+
+
+------- test/dav17 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:prop>
+ <D:lockdiscovery>
+ <D:activelock>
+ <D:locktype>write</D:locktype>
+ <D:lockscope>exclusive</D:lockscope>
+ <D:addlocks>
+ <D:href>http://foo.com/doc/</D:href>
+ </D:addlocks>
+ <D:owner>Jane Smith</D:owner>
+ <D:timeout>Infinite</D:timeout>
+ <D:locktoken>
+ <D:href>iamuri:unique!!!!!</D:href>
+ </D:locktoken>
+ </D:activelock>
+ </D:lockdiscovery>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:response>
+</D:multistatus>
diff --git a/result/dav18 b/result/dav18
new file mode 100644
index 00000000..245dbdbb
--- /dev/null
+++ b/result/dav18
@@ -0,0 +1,10 @@
+
+
+------- test/dav18 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:propfind>
+ <D:prop>
+ <supportedlock/>
+ </D:prop>
+</D:propfind>
diff --git a/result/dav19 b/result/dav19
new file mode 100644
index 00000000..b7482329
--- /dev/null
+++ b/result/dav19
@@ -0,0 +1,22 @@
+
+
+------- test/dav19 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:prop>
+ <D:supportedlock>
+ <D:LockEntry>
+ <D:locktype>Write</D:locktype>
+ <D:lockscope>Exclusive</D:lockscope>
+ </D:LockEntry>
+ <D:LockEntry>
+ <D:locktype>Write</D:locktype>
+ <D:lockscope>Shared</D:lockscope>
+ </D:LockEntry>
+ </D:supportedlock>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:response>
+</D:multistatus>
diff --git a/result/dav2 b/result/dav2
new file mode 100644
index 00000000..f7efb031
--- /dev/null
+++ b/result/dav2
@@ -0,0 +1,29 @@
+
+
+------- test/dav2 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.foo.bar/boxschema/" prefix="R"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="S"?>
+<S:multistatus>
+ <S:response>
+ <S:href>http://www.foo.bar/container/</S:href>
+ <S:prop>
+ <R:bigbox>
+ <R:BoxType>Box type A</R:BoxType>
+ </R:bigbox>
+ <R:author>
+ <R:Name>Hadrian</R:Name>
+ </R:author>
+ </S:prop>
+ <S:status>HTTP 1.1 200 OK</S:status>
+ </S:response>
+ <S:response>
+ <S:href>http://www.foo.bar/container/index.html</S:href>
+ <S:prop>
+ <R:bigbox>
+ <R:BoxType>Box type B</R:BoxType>
+ </R:bigbox>
+ </S:prop>
+ <S:status>HTTP 1.1 200 OK</S:status>
+ </S:response>
+</S:multistatus>
diff --git a/result/dav3 b/result/dav3
new file mode 100644
index 00000000..c4c235a4
--- /dev/null
+++ b/result/dav3
@@ -0,0 +1,23 @@
+
+
+------- test/dav3 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.foo.bar/boxschema/" prefix="R"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:href>http://www.foo.bar/container/</D:href>
+ <D:prop>
+ <R:bigbox/>
+ <R:author/>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+ <D:response>
+ <D:href>http://www.foo.bar/container/index.html</D:href>
+ <D:prop>
+ <R:bigbox/>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+</D:multistatus>
diff --git a/result/dav4 b/result/dav4
new file mode 100644
index 00000000..3c38b647
--- /dev/null
+++ b/result/dav4
@@ -0,0 +1,21 @@
+
+
+------- test/dav4 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.w3.com/standards/z39.50/" prefix="Z"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:propertyupdate>
+ <D:set>
+ <D:prop>
+ <Z:authors>
+ <Z:Author>Jim Whitehead</Z:Author>
+ <Z:Author>Roy Fielding</Z:Author>
+ </Z:authors>
+ </D:prop>
+ </D:set>
+ <D:remove>
+ <D:prop>
+ <Z:Copyright-Owner/>
+ </D:prop>
+ </D:remove>
+</D:propertyupdate>
diff --git a/result/dav5 b/result/dav5
new file mode 100644
index 00000000..cb8c1dd6
--- /dev/null
+++ b/result/dav5
@@ -0,0 +1,22 @@
+
+
+------- test/dav5 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.w3.com/standards/z39.50/" prefix="Z"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:prop>
+ <Z:Authors/>
+ </D:prop>
+ <D:status>HTTP/1.1 420 Method Failure</D:status>
+ </D:response>
+ <D:response>
+ <D:prop>
+ <Z:Copyright-Owner/>
+ </D:prop>
+ <D:status>HTTP/1.1 409 Conflict</D:status>
+ </D:response>
+ <D:responsedescription> Copyright Owner can not be deleted or
+ altered.</D:responsedescription>
+</D:multistatus>
diff --git a/result/dav6 b/result/dav6
new file mode 100644
index 00000000..1fce59b2
--- /dev/null
+++ b/result/dav6
@@ -0,0 +1,26 @@
+
+
+------- test/dav6 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="D"?>
+<D:multistatus>
+ <D:response>
+ <D:href>http://www.microsoft.com/user/yarong/dav_drafts/
+ </D:href>
+ <D:prop>
+ <D:resourcetype>
+ <D:collection/>
+ </D:resourcetype>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+ <D:response>
+ <D:href>
+ http://www.microsoft.com/user/yarong/dav_drafts/base
+ </D:href>
+ <D:prop>
+ <D:resourcetype/>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+</D:multistatus>
diff --git a/result/dav7 b/result/dav7
new file mode 100644
index 00000000..68f43cef
--- /dev/null
+++ b/result/dav7
@@ -0,0 +1,20 @@
+
+
+------- test/dav7 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="d"?>
+<d:multistatus>
+ <d:response>
+ <d:href>http://www.foo.bar/container/resource1</d:href>
+ <d:href>http://www.foo.bar/container/resource2</d:href>
+ <d:status>HTTP/1.1 200 OK</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/container/</d:href>
+ <d:status>HTTP/1.1 420 Method Failure</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/container/resource3</d:href>
+ <d:status>HTTP/1.1 412 Precondition Failed</d:status>
+ </d:response>
+</d:multistatus>
diff --git a/result/dav8 b/result/dav8
new file mode 100644
index 00000000..e285c193
--- /dev/null
+++ b/result/dav8
@@ -0,0 +1,18 @@
+
+
+------- test/dav8 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="d"?>
+<d:multistatus>
+ <d:response>
+ <d:href>http://www.foo.bar/othercontainer/resource1</d:href>
+ <d:href>http://www.foo.bar/othercontainer/resource2</d:href>
+ <d:href>http://www.foo.bar/othercontainer/</d:href>
+ <d:href>http://www.foo.bar/othercontainer/R2/D2</d:href>
+ <d:status>HTTP/1.1 201 Created</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/othercontainer/R2/</d:href>
+ <d:status>HTTP/1.1 412 Precondition Failed</d:status>
+ </d:response>
+</d:multistatus>
diff --git a/result/dav9 b/result/dav9
new file mode 100644
index 00000000..6c505b97
--- /dev/null
+++ b/result/dav9
@@ -0,0 +1,22 @@
+
+
+------- test/dav9 -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.ietf.org/standards/dav/" prefix="d"?>
+<d:multistatus>
+ <d:response>
+ <d:href>http://www.foo.bar/container/resource1</d:href>
+ <d:href>http://www.foo.bar/container/resource2</d:href>
+ <d:href>http://www.foo.bar/container/</d:href>
+ <d:href>http://www.foo.bar/container/C2/R2</d:href>
+ <d:status>HTTP/1.1 201 Created</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/container/C2</d:href>
+ <d:status>HTTP/1.1 420 Method Failure</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/othercontainer/C2</d:href>
+ <d:status>HTTP/1.1 409 Conflict</d:status>
+ </d:response>
+</d:multistatus>
diff --git a/result/p3p b/result/p3p
new file mode 100644
index 00000000..41f5a359
--- /dev/null
+++ b/result/p3p
@@ -0,0 +1,26 @@
+
+
+------- test/p3p -----------
+<?xml version="1.0"?>
+<?xml:namespace ns="http://www.w3.org/TR/WD-rdf-syntax#" prefix="RDF"?>
+<RDF:RDF>
+ <PROP assurance="http://www.TrustUs.org" agreeID="94df1293a3e519bb" entity="CoolCatalog" realm="http://www.CoolCatalog.com/catalogue/">
+ <USES>
+ <STATEMENT consq="a site with clothes you&apos;d appreciate." id="0" recpnt="0" purp="2,3">
+ <WITH>
+ <PREFIX name="User.">
+ <REF name="Name.First"/>
+ <REF optional="1" name="Bdate.Year"/>
+ <REF name="Gender"/>
+ </PREFIX>
+ </WITH>
+ </STATEMENT>
+ </USES>
+ <USES>
+ <STATEMENT id="1" recpnt="0" purp="0" action="read&amp;write">
+ <REF name="User.Shipping."/>
+ </STATEMENT>
+ </USES>
+ <DISCLOSURE other="0,1" access="3" discURI="http://www.CoolCatalog.com/PrivacyPractice.html"/>
+ </PROP>
+</RDF:RDF>
diff --git a/test/dav1 b/test/dav1
new file mode 100644
index 00000000..e7ad9e61
--- /dev/null
+++ b/test/dav1
@@ -0,0 +1,24 @@
+ <?XML version="1.0">
+ <?namespace href ="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <?namespace href = "http://www.foo.bar/boxschema" AS = "R"?>
+ <D:multistatus>
+ <D:response>
+ <D:prop>
+ <R:bigbox>
+ <R:BoxType>Box type A</R:BoxType>
+ </R:bigbox>
+ <R:author>
+ <R:Name>J.J. Dingleheimerschmidt</R:Name>
+ </R:author>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:response>
+ <D:response>
+ <D:prop><R:DingALing/><R:Random/></D:prop>
+ <D:status>HTTP/1.1 403 Forbidden</D:status>
+ <D:responsedescription> The user does not have access to the DingALing property.
+ </D:responsedescription>
+ </D:response>
+ <D:responsedescription> There has been an access violation error.
+ </D:responsedescription>
+ </D:multistatus>
diff --git a/test/dav10 b/test/dav10
new file mode 100644
index 00000000..4a444b91
--- /dev/null
+++ b/test/dav10
@@ -0,0 +1,5 @@
+ <?XML version="1.0">
+ <?namespace href="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:owner>
+ <D:href>http://www.ics.uci.edu/~ejw/contact.html</D:href>
+ </D:owner>
diff --git a/test/dav11 b/test/dav11
new file mode 100644
index 00000000..ece73dc3
--- /dev/null
+++ b/test/dav11
@@ -0,0 +1,22 @@
+ <?XML version="1.0">
+ <?namespace href ="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:prop>
+ <D:lockdiscovery>
+ <D:activelock>
+ <D:locktype>write</D:locktype>
+ <D:lockscope>exclusive</D:lockscope>
+ <D:addlocks/>
+ <D:owner>
+ <D:href>
+ http://www.ics.uci.edu/~ejw/contact.html
+ </D:href>
+ </D:owner>
+ <D:timeout>Second-604800</D:timeout>
+ <D:locktoken>
+ <D:href>
+ opaquelocktoken:xyz122393481230912asdfa09s8df09s7df
+ </D:href>
+ </D:locktoken>
+ </D:activelock>
+ </D:lockdiscovery>
+ </D:prop>
diff --git a/test/dav12 b/test/dav12
new file mode 100644
index 00000000..47a1a9d8
--- /dev/null
+++ b/test/dav12
@@ -0,0 +1,3 @@
+ <?XML version="1.0">
+ <?namespace href="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:href>http://www.ics.uci.edu/~ejw/contact.html</D:href>
diff --git a/test/dav13 b/test/dav13
new file mode 100644
index 00000000..df92ae59
--- /dev/null
+++ b/test/dav13
@@ -0,0 +1,17 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:multistatus>
+ <D:response>
+ <D:href>
+ http://webdav.sb.aol.com/workspace/webdav/proposal.doc
+ </D:href>
+ <D:href>
+ http://webdav.sb.aol.com/workspace/webdav/
+ </D:href>
+ <D:status>HTTP/1.1 202 Accepted</D:status>
+ </D:response>
+ <D:response>
+ <D:href>http://foo.bar/blah</D:href>
+ <D:status>HTTP/1.1 403 Forbidden</D:status>
+ </D:response>
+ </D:multistatus>
diff --git a/test/dav14 b/test/dav14
new file mode 100644
index 00000000..7fe8bf4f
--- /dev/null
+++ b/test/dav14
@@ -0,0 +1,10 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/patch/" AS =
+ "D"?>
+ <D:resourceupdate>
+ <D:replace XML-SPACE = "PRESERVE">
+ <D:octet-range>14</D:octet-range>&003CTITLE&003ENew
+ Title&003C/TITLE&003E</D:replace>
+ <D:delete><D:octet-range>38-50</D:octet-range></D:delete>
+ <D:insert XML-SPACE = "PRESERVE"><D:octet-range>86</D:octet-range>&003CP&003ENew paragraph&003C/P&003E</D:insert>
+ </D:resourceupdate>
diff --git a/test/dav15 b/test/dav15
new file mode 100644
index 00000000..1d354300
--- /dev/null
+++ b/test/dav15
@@ -0,0 +1,22 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <?namespace href = "http://www.foocorp.com/Project/" AS = "F"?>
+ <D:prop>
+ <D:Source>
+ <D:link>
+ <F:projfiles>Source</F:projfiles>
+ <D:src>http://foo.bar/program</D:src>
+ <D:dst>http://foo.bar/src/main.c</D:dst>
+ </D:link>
+ <D:link>
+ <F:projfiles>Library</F:projfiles>
+ <D:src>http://foo.bar/program</D:src>
+ <D:dst>http://foo.bar/src/main.lib</D:dst>
+ </D:link>
+ <D:link>
+ <F:projfiles>Makefile</F:projfiles>
+ <D:src>http://foo.bar/program</D:src>
+ <D:dst>http://foo.bar/src/makefile</D:dst>
+ </D:link>
+ </D:Source>
+ </D:prop>
diff --git a/test/dav16 b/test/dav16
new file mode 100644
index 00000000..29fe2568
--- /dev/null
+++ b/test/dav16
@@ -0,0 +1,5 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:propfind>
+ <D:prop><lockdiscovery/></D:prop>
+ </D:propfind>
diff --git a/test/dav17 b/test/dav17
new file mode 100644
index 00000000..f1dabdaf
--- /dev/null
+++ b/test/dav17
@@ -0,0 +1,23 @@
+ <?XML version="1.0">
+ <?namespace href ="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:multistatus>
+ <D:response>
+ <D:prop>
+ <D:lockdiscovery>
+ <D:activelock>
+ <D:locktype>write</D:locktype>
+ <D:lockscope>exclusive</D:lockscope>
+ <D:addlocks>
+ <D:href>http://foo.com/doc/</D:href>
+ </D:addlocks>
+ <D:owner>Jane Smith</D:owner>
+ <D:timeout>Infinite</D:timeout>
+ <D:locktoken>
+ <D:href>iamuri:unique!!!!!</D:href>
+ </D:locktoken>
+ </D:activelock>
+ </D:lockdiscovery>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:response>
+ </D:multistatus>
diff --git a/test/dav18 b/test/dav18
new file mode 100644
index 00000000..545c7e51
--- /dev/null
+++ b/test/dav18
@@ -0,0 +1,5 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:propfind>
+ <D:prop><supportedlock/></D:prop>
+ </D:propfind>
diff --git a/test/dav19 b/test/dav19
new file mode 100644
index 00000000..e75fedb7
--- /dev/null
+++ b/test/dav19
@@ -0,0 +1,19 @@
+ <?XML version="1.0">
+ <?namespace href ="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:multistatus>
+ <D:response>
+ <D:prop>
+ <D:supportedlock>
+ <D:LockEntry>
+ <D:locktype>Write</D:locktype>
+ <D:lockscope>Exclusive</D:lockscope>
+ </D:LockEntry>
+ <D:LockEntry>
+ <D:locktype>Write</D:locktype>
+ <D:lockscope>Shared</D:lockscope>
+ </D:LockEntry>
+ </D:supportedlock>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:response>
+ </D:multistatus>
diff --git a/test/dav2 b/test/dav2
new file mode 100644
index 00000000..2b73d5f7
--- /dev/null
+++ b/test/dav2
@@ -0,0 +1,26 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "S"?>
+ <?namespace href = "http://www.foo.bar/boxschema/" AS = "R"?>
+ <S:multistatus>
+ <S:response>
+ <S:href>http://www.foo.bar/container/</S:href>
+ <S:prop>
+ <R:bigbox>
+ <R:BoxType>Box type A</R:BoxType>
+ </R:bigbox>
+ <R:author>
+ <R:Name>Hadrian</R:Name>
+ </R:author>
+ </S:prop>
+ <S:status>HTTP 1.1 200 OK</S:status>
+ </S:response>
+ <S:response>
+ <S:href>http://www.foo.bar/container/index.html</S:href>
+ <S:prop>
+ <R:bigbox>
+ <R:BoxType>Box type B</R:BoxType>
+ </R:bigbox>
+ </S:prop>
+ <S:status>HTTP 1.1 200 OK</S:status>
+ </S:response>
+ </S:multistatus>
diff --git a/test/dav3 b/test/dav3
new file mode 100644
index 00000000..964f344a
--- /dev/null
+++ b/test/dav3
@@ -0,0 +1,20 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <?namespace href = "http://www.foo.bar/boxschema/" AS = "R"?>
+ <D:multistatus>
+ <D:response>
+ <D:href>http://www.foo.bar/container/</D:href>
+ <D:prop>
+ <R:bigbox/>
+ <R:author/>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+ <D:response>
+ <D:href>http://www.foo.bar/container/index.html</D:href>
+ <D:prop>
+ <R:bigbox/>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+ </D:multistatus>
diff --git a/test/dav4 b/test/dav4
new file mode 100644
index 00000000..26f61537
--- /dev/null
+++ b/test/dav4
@@ -0,0 +1,16 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <?namespace href = "http://www.w3.com/standards/z39.50/" AS = "Z"?>
+ <D:propertyupdate>
+ <D:set>
+ <D:prop>
+ <Z:authors>
+ <Z:Author>Jim Whitehead</Z:Author>
+ <Z:Author>Roy Fielding</Z:Author>
+ </Z:authors>
+ </D:prop>
+ </D:set>
+ <D:remove>
+ <D:prop><Z:Copyright-Owner/></D:prop>
+ </D:remove>
+ </D:propertyupdate>
diff --git a/test/dav5 b/test/dav5
new file mode 100644
index 00000000..b51b0f83
--- /dev/null
+++ b/test/dav5
@@ -0,0 +1,15 @@
+ <?XML version="1.0">
+ <?namespace href="http://www.ietf.org/standards/dav/" AS = "D"?>
+ <?namespace href="http://www.w3.com/standards/z39.50/" AS = "Z"?>
+ <D:multistatus>
+ <D:response>
+ <D:prop><Z:Authors/></D:prop>
+ <D:status>HTTP/1.1 420 Method Failure</D:status>
+ </D:response>
+ <D:response>
+ <D:prop><Z:Copyright-Owner/></D:prop>
+ <D:status>HTTP/1.1 409 Conflict</D:status>
+ </D:response>
+ <D:responsedescription> Copyright Owner can not be deleted or
+ altered.</D:responsedescription>
+ </D:multistatus>
diff --git a/test/dav6 b/test/dav6
new file mode 100644
index 00000000..b970c8a0
--- /dev/null
+++ b/test/dav6
@@ -0,0 +1,23 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "D"?>
+ <D:multistatus>
+ <D:response>
+ <D:href>http://www.microsoft.com/user/yarong/dav_drafts/
+ </D:href>
+ <D:prop>
+ <D:resourcetype>
+ <D:collection/>
+ </D:resourcetype>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+ <D:response>
+ <D:href>
+ http://www.microsoft.com/user/yarong/dav_drafts/base
+ </D:href>
+ <D:prop>
+ <D:resourcetype/>
+ </D:prop>
+ <D:status>HTTP 1.1 200 OK</D:status>
+ </D:response>
+ </D:multistatus>
diff --git a/test/dav7 b/test/dav7
new file mode 100644
index 00000000..7ed12fa7
--- /dev/null
+++ b/test/dav7
@@ -0,0 +1,17 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "d"?>
+ <d:multistatus>
+ <d:response>
+ <d:href>http://www.foo.bar/container/resource1</d:href>
+ <d:href>http://www.foo.bar/container/resource2</d:href>
+ <d:status>HTTP/1.1 200 OK</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/container/</d:href>
+ <d:status>HTTP/1.1 420 Method Failure</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/container/resource3</d:href>
+ <d:status>HTTP/1.1 412 Precondition Failed</d:status>
+ </d:response>
+ </d:multistatus>
diff --git a/test/dav8 b/test/dav8
new file mode 100644
index 00000000..b5c0c6b0
--- /dev/null
+++ b/test/dav8
@@ -0,0 +1,15 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "d"?>
+ <d:multistatus>
+ <d:response>
+ <d:href>http://www.foo.bar/othercontainer/resource1</d:href>
+ <d:href>http://www.foo.bar/othercontainer/resource2</d:href>
+ <d:href>http://www.foo.bar/othercontainer/</d:href>
+ <d:href>http://www.foo.bar/othercontainer/R2/D2</d:href>
+ <d:status>HTTP/1.1 201 Created</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/othercontainer/R2/</d:href>
+ <d:status>HTTP/1.1 412 Precondition Failed</d:status>
+ </d:response>
+ </d:multistatus>
diff --git a/test/dav9 b/test/dav9
new file mode 100644
index 00000000..a1dfa435
--- /dev/null
+++ b/test/dav9
@@ -0,0 +1,19 @@
+ <?XML version="1.0">
+ <?namespace href = "http://www.ietf.org/standards/dav/" AS = "d"?>
+ <d:multistatus>
+ <d:response>
+ <d:href>http://www.foo.bar/container/resource1</d:href>
+ <d:href>http://www.foo.bar/container/resource2</d:href>
+ <d:href>http://www.foo.bar/container/</d:href>
+ <d:href>http://www.foo.bar/container/C2/R2</d:href>
+ <d:status>HTTP/1.1 201 Created</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/container/C2</d:href>
+ <d:status>HTTP/1.1 420 Method Failure</d:status>
+ </d:response>
+ <d:response>
+ <d:href>http://www.foo.bar/othercontainer/C2</d:href>
+ <d:status>HTTP/1.1 409 Conflict</d:status>
+ </d:response>
+ </d:multistatus>
diff --git a/test/p3p b/test/p3p
new file mode 100644
index 00000000..1a83af27
--- /dev/null
+++ b/test/p3p
@@ -0,0 +1,23 @@
+<?xml:namespace ns="http//www.w3.org/TR/1998/WD-P3P10-syntax#proposal.DTD" prefix="p3p"?>
+<?xml:namespace ns="http://www.w3.org/TR/WD-rdf-syntax#" prefix="RDF"?>
+<RDF:RDF><PROP realm="http://www.CoolCatalog.com/catalogue/"
+ entity="CoolCatalog" agreeID="94df1293a3e519bb"
+ assurance="http://www.TrustUs.org">
+ <USES>
+ <STATEMENT purp="2,3" recpnt="0" id="0"
+ consq="a site with clothes you'd appreciate.">
+ <WITH><PREFIX name="User.">
+ <REF name="Name.First"/>
+ <REF name="Bdate.Year" optional="1"/>
+ <REF name="Gender"/>
+ </PREFIX></WITH>
+ </STATEMENT>
+ </USES>
+ <USES>
+ <STATEMENT action="read&write" purp="0" recpnt="0" id="1">
+ <REF name="User.Shipping."/>
+ </STATEMENT>
+ </USES>
+ <DISCLOSURE discURI="http://www.CoolCatalog.com/PrivacyPractice.html"
+ access="3" other="0,1"/>
+</PROP></RDF:RDF>
diff --git a/tester.c b/tester.c
new file mode 100644
index 00000000..030ee1cc
--- /dev/null
+++ b/tester.c
@@ -0,0 +1,102 @@
+/*
+ * tester.c : a small tester program for XML input.
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "xml_parser.h"
+#include "xml_tree.h"
+
+#define MAX_BUF 500000
+
+static CHAR buffer[MAX_BUF] =
+"\n\
+<?xml version=\"1.0\">\n\
+<?xml:namespace ns = \"http://www.ietf.org/standards/dav/\" prefix = \"D\"?>\n\
+<?xml:namespace ns = \"http://www.w3.com/standards/z39.50/\" prefix = \"Z\"?>\n\
+<D:propertyupdate>\n\
+<D:set a=\"'toto'\" b>\n\
+ <D:prop>\n\
+ <Z:authors>\n\
+ <Z:Author>Jim Whitehead</Z:Author>\n\
+ <Z:Author>Roy Fielding</Z:Author>\n\
+ </Z:authors>\n\
+ </D:prop>\n\
+ </D:set>\n\
+ <D:remove>\n\
+ <D:prop><Z:Copyright-Owner/></D:prop>\n\
+ </D:remove>\n\
+</D:propertyupdate>\n\
+\n\
+";
+
+int readFile(char *filename) {
+ int input;
+ int res;
+
+ memset(buffer, 0, sizeof(buffer));
+ input = open (filename, O_RDONLY);
+ if (input < 0) {
+ fprintf (stderr, "Cannot read file %s :\n", filename);
+ perror ("open failed");
+ return(-1);
+ }
+ res = read(input, buffer, sizeof(buffer));
+ if (res < 0) {
+ fprintf (stderr, "Cannot read file %s :\n", filename);
+ perror ("read failed");
+ return(-1);
+ }
+ if (res >= MAX_BUF) {
+ fprintf (stderr, "Read only %d byte of %s, increase MAX_BUF\n",
+ res, filename);
+ return(-1);
+ }
+ close(input);
+ return(res);
+}
+
+void parseAndPrint(CHAR *buf) {
+ xmlDocPtr doc;
+
+ /*
+ * build a fake XML document from a string;
+ */
+ doc = xmlParseDoc(buf);
+
+ /*
+ * print it.
+ */
+ xmlDocDump(stdout, doc);
+
+ /*
+ * free it.
+ */
+ xmlFreeDoc(doc);
+}
+
+int main(int argc, char **argv) {
+ int i;
+
+ if (argc > 1) {
+ for (i = 1; i < argc ; i++) {
+ if (readFile(argv[i]) >= 0) {
+ printf("\n\n------- %s -----------\n", argv[i]);
+ parseAndPrint(buffer);
+ }
+ }
+ } else
+ parseAndPrint(buffer);
+
+ return(0);
+}
diff --git a/xml_entities.c b/xml_entities.c
new file mode 100644
index 00000000..3c9d55cd
--- /dev/null
+++ b/xml_entities.c
@@ -0,0 +1,353 @@
+/*
+ * entities.c : implementation for the XML entities handking
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <malloc.h>
+#include <strings.h>
+#include "xml_entities.h"
+
+/*
+ * A buffer used for converting entities to their equivalent and back.
+ */
+static CHAR *buffer = NULL;
+static int buffer_size = 0;
+
+void growBuffer(void) {
+ buffer_size *= 2;
+ buffer = (CHAR *) realloc(buffer, buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ perror("realloc failed");
+ exit(1);
+ }
+}
+
+/*
+ * xmlFreeEntity : clean-up an entity record.
+ */
+
+void xmlFreeEntity(xmlEntityPtr entity) {
+ if (entity == NULL) return;
+
+ if (entity->value != NULL) free(entity->value);
+ entity->value = NULL;
+ if (entity->id != NULL)
+ free((char *) entity->id);
+}
+
+/*
+ * xmlAddDocEntity : register a new entity for an entities table.
+ */
+static void xmlAddEntity(xmlEntitiesTablePtr table, CHAR *value,
+ const CHAR *id) {
+ int i;
+ xmlEntityPtr cur;
+
+ for (i = 0;i < table->nb_entities;i++) {
+ cur = &table->table[i];
+ if (!xmlStrcmp(cur->id, id)) {
+ free(cur->value);
+ cur->value = xmlStrdup(value);
+ }
+ }
+ if (table->nb_entities >= table->max_entities) {
+ /*
+ * need more elements.
+ */
+ table->max_entities *= 2;
+ table->table = (xmlEntityPtr)
+ realloc(table->table, table->max_entities * sizeof(xmlEntity));
+ if (table->table) {
+ perror("realloc failed");
+ exit(1);
+ }
+ }
+ cur = &table->table[table->nb_entities];
+ cur->value = xmlStrdup(value);
+ cur->id = xmlStrdup(id);
+ table->nb_entities++;
+}
+
+
+/*
+ * xmlAddDtdEntity : register a new entity for this document.
+ */
+void xmlAddDtdEntity(xmlDtdPtr dtd, CHAR *value, const CHAR *id) {
+ xmlEntitiesTablePtr table;
+
+ table = (xmlEntitiesTablePtr) dtd->entities;
+ if (table == NULL) {
+ table = xmlCreateEntitiesTable();
+ dtd->entities = table;
+ }
+ xmlAddEntity(table, value, id);
+}
+
+/*
+ * xmlAddDocEntity : register a new entity for this document.
+ */
+void xmlAddDocEntity(xmlDocPtr doc, CHAR *value, const CHAR *id) {
+ xmlEntitiesTablePtr table;
+
+ table = (xmlEntitiesTablePtr) doc->entities;
+ if (table == NULL) {
+ table = xmlCreateEntitiesTable();
+ doc->entities = table;
+ }
+ xmlAddEntity(table, value, id);
+}
+
+/*
+ * xmlGetEntity : do an entity lookup in the hash table and
+ * returns the corrsponding CHAR *, if found, zero otherwise.
+ */
+CHAR *xmlGetEntity(xmlDocPtr doc, const CHAR *id) {
+ int i;
+ xmlEntityPtr cur;
+ xmlEntitiesTablePtr table;
+
+ if (doc->entities == NULL) return(0);
+ table = (xmlEntitiesTablePtr) doc->entities;
+ for (i = 0;i < table->nb_entities;i++) {
+ cur = &table->table[i];
+ if (!xmlStrcmp(cur->id, id)) return(cur->value);
+ }
+ return(NULL);
+}
+
+/*
+ * xmlReadEntities : read an entity.
+ */
+const CHAR *xmlReadEntity(xmlDocPtr doc, const CHAR **input) {
+ static CHAR *entity = NULL;
+ static int entity_size = 100;
+ const CHAR *cur = *input;
+
+ if (entity == NULL) {
+ entity = (CHAR *) malloc(entity_size * sizeof(CHAR));
+ if (entity == NULL) {
+ fprintf(stderr, "xmlReadEntity : cannot allocate %d bytes\n",
+ entity_size * sizeof(CHAR));
+ return(NULL);
+ }
+ }
+ if (*cur == '&') {
+ cur++;
+ if (*cur == '#') {
+ /* TODO !!!!
+ fprintf(stderr, "Character reference not yet implemented\n"); */
+ } else {
+ /* TODO !!!!
+ fprintf(stderr, "Entity search not yet implemented\n"); */
+ }
+ }
+
+ /*
+ * The few predefined entities.
+ */
+ if ((cur[0] == 'a') && (cur[1] == 'm') && (cur[2] == 'p') &&
+ (cur[3] == ';')) {
+ entity[0] = '%';
+ entity[1] = 0;
+ cur += 3;
+ *input = cur;
+ return(entity);
+ } else if ((cur[0] == 'q') && (cur[1] == 'u') && (cur[2] == 'o') &&
+ (cur[3] == 't') && (cur[4] == ';')) {
+ entity[0] = '"';
+ entity[1] = 0;
+ cur += 4;
+ *input = cur;
+ return(entity);
+ } else if ((cur[0] == 'a') && (cur[1] == 'p') && (cur[2] == 'o') &&
+ (cur[3] == 's') && (cur[4] == ';')) {
+ entity[0] = '\'';
+ entity[1] = 0;
+ cur += 4;
+ *input = cur;
+ return(entity);
+ } else if ((cur[0] == 'l') && (cur[1] == 't') && (cur[2] == ';')) {
+ entity[0] = '<';
+ entity[1] = 0;
+ cur += 2;
+ *input = cur;
+ return(entity);
+ } else if ((cur[0] == 'g') && (cur[1] == 't') && (cur[2] == ';')) {
+ entity[0] = '>';
+ entity[1] = 0;
+ cur += 2;
+ *input = cur;
+ return(entity);
+ }
+
+ return(NULL);
+}
+
+/*
+ * xmlDecodeEntities : do a global entities lookup on a input string
+ * and returns a duplicate after the entities substitution.
+ */
+CHAR *xmlDecodeEntities(xmlDocPtr doc, const CHAR *input, int len) {
+ const CHAR *cur = input;
+ CHAR *out = buffer;
+ int i;
+
+ if (buffer == NULL) {
+ buffer_size = 1000;
+ buffer = (CHAR *) malloc(buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ perror("malloc failed");
+ exit(1);
+ }
+ out = buffer;
+ }
+ for (i = 0;(*cur != 0) && (cur - input < len);cur++) {
+ if (*cur == '&') {
+ const CHAR *entity = xmlReadEntity(doc, &cur);
+ if (entity != NULL)
+ while (*entity != 0) {
+ *out++ = *entity++;
+ i++;
+ if (i + 10 > buffer_size) {
+ int index = out - buffer;
+
+ growBuffer();
+ out = &buffer[index];
+ }
+ }
+ } else if (*cur == '%') {
+ /* TODO !!!!!
+ fprintf(stderr, " \n"); */
+ } else {
+ *out++ = *cur;
+ i++;
+ }
+
+ if (i + 10 > buffer_size) {
+ int index = out - buffer;
+
+ growBuffer();
+ out = &buffer[index];
+ }
+ }
+ *out++ = 0;
+ return(buffer);
+}
+
+/*
+ * xmlEncodeEntities : do a global encoding of a string, replacing the
+ * basic values with their entities form.
+ */
+CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input) {
+ const CHAR *cur = input;
+ CHAR *out = buffer;
+
+ if (buffer == NULL) {
+ buffer_size = 1000;
+ buffer = (CHAR *) malloc(buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ perror("malloc failed");
+ exit(1);
+ }
+ out = buffer;
+ }
+ while (*cur != '\0') {
+ if (out - buffer > buffer_size - 100) {
+ int index = out - buffer;
+
+ growBuffer();
+ out = &buffer[index];
+ }
+
+ /*
+ * By default one have to encode at least '<', '>', '"' and '&' !
+ * One could try a better encoding using the entities defined and
+ * used as a compression code !!!.
+ */
+ if (*cur == '<') {
+ *out++ = '&';
+ *out++ = 'l';
+ *out++ = 't';
+ *out++ = ';';
+ } else if (*cur == '>') {
+ *out++ = '&';
+ *out++ = 'g';
+ *out++ = 't';
+ *out++ = ';';
+ } else if (*cur == '&') {
+ *out++ = '&';
+ *out++ = 'a';
+ *out++ = 'm';
+ *out++ = 'p';
+ *out++ = ';';
+ } else if (*cur == '"') {
+ *out++ = '&';
+ *out++ = 'q';
+ *out++ = 'u';
+ *out++ = 'o';
+ *out++ = 't';
+ *out++ = ';';
+ } else if (*cur == '\'') {
+ *out++ = '&';
+ *out++ = 'a';
+ *out++ = 'p';
+ *out++ = 'o';
+ *out++ = 's';
+ *out++ = ';';
+ } else {
+ /*
+ * default case, just copy !
+ */
+ *out++ = *cur;
+ }
+ cur++;
+ }
+ *out++ = 0;
+ return(buffer);
+}
+
+/*
+ * xmlCreateEntitiesTable : create and initialize an enmpty hash table
+ */
+xmlEntitiesTablePtr xmlCreateEntitiesTable(void) {
+ xmlEntitiesTablePtr ret;
+
+ ret = (xmlEntitiesTablePtr)
+ malloc(sizeof(xmlEntitiesTable));
+ if (ret == NULL) {
+ fprintf(stderr, "xmlCreateEntitiesTable : malloc(%d) failed\n",
+ sizeof(xmlEntitiesTable));
+ return(NULL);
+ }
+ ret->max_entities = XML_MIN_ENTITIES_TABLE;
+ ret->nb_entities = 0;
+ ret->table = (xmlEntityPtr )
+ malloc(ret->max_entities * sizeof(xmlEntity));
+ if (ret == NULL) {
+ fprintf(stderr, "xmlCreateEntitiesTable : malloc(%d) failed\n",
+ ret->max_entities * sizeof(xmlEntity));
+ free(ret);
+ return(NULL);
+ }
+ return(ret);
+}
+
+/*
+ * xmlFreeEntitiesTable : clean up and free an entities hash table.
+ */
+void xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
+ int i;
+
+ if (table == NULL) return;
+
+ for (i = 0;i < table->nb_entities;i++) {
+ xmlFreeEntity(&table->table[i]);
+ }
+ free(table->table);
+ free(table);
+}
+
diff --git a/xml_entities.h b/xml_entities.h
new file mode 100644
index 00000000..a0b24ac2
--- /dev/null
+++ b/xml_entities.h
@@ -0,0 +1,58 @@
+/*
+ * entities.h : interface for the XML entities handking
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#ifndef __XML_ENTITIES_H__
+#define __XML_ENTITIES_H__
+#include "xml_parser.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * An unit of storage for an entity, contains the string, the value
+ * and the linkind data needed for the linking in the hash table.
+ */
+
+typedef struct xmlEntity {
+ const CHAR *id; /* The entity name */
+ CHAR *value; /* The entity CHAR equivalent */
+} xmlEntity, *xmlEntityPtr;
+
+/*
+ * ALl entities are stored in a table there is one table per DTD
+ * and one extra per document.
+ */
+
+#define XML_MIN_ENTITIES_TABLE 32
+
+typedef struct xmlEntitiesTable {
+ int nb_entities; /* number of elements stored */
+ int max_entities; /* maximum number of elements */
+ xmlEntityPtr table; /* the table of entities */
+} xmlEntitiesTable, *xmlEntitiesTablePtr;
+
+/*
+ * External functions :
+ */
+
+extern void xmlAddDocEntity(xmlDocPtr doc, CHAR *value, const CHAR *id);
+extern void xmlAddDtdEntity(xmlDtdPtr dtd, CHAR *value, const CHAR *id);
+extern CHAR *xmlGetEntity(xmlDocPtr doc, const CHAR *id);
+extern CHAR *xmlSubstituteEntities(xmlDocPtr doc, const CHAR *input);
+extern CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input);
+extern CHAR *xmlDecodeEntities(xmlDocPtr doc, const CHAR *input, int len);
+extern xmlEntitiesTablePtr xmlCreateEntitiesTable(void);
+extern void xmlFreeEntitiesTable(xmlEntitiesTablePtr table);
+
+#ifdef __cplusplus
+}
+#endif
+
+# endif /* __XML_ENTITIES_H__ */
diff --git a/xml_parser.c b/xml_parser.c
new file mode 100644
index 00000000..dfec5a78
--- /dev/null
+++ b/xml_parser.c
@@ -0,0 +1,1183 @@
+/*
+ * parser.c : an XML 1.0 non-verifying parser
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h> /* for memset() only */
+#include <malloc.h>
+#include <sys/stat.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+#include "xml_tree.h"
+#include "xml_parser.h"
+#include "xml_entities.h"
+
+/*
+ * A few macros needed to help building the parser.
+ */
+
+#ifdef UNICODE
+/*
+ * UNICODE version of the macros. Incomplete now TODO !!!!
+ */
+#define IS_CHAR(c) \
+ (((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0d) || \
+ (((c) >= 0x20) && ((c) != 0xFFFE) && ((c) != 0xFFFF)))
+
+#define SKIP_BLANKS(p) \
+ while ((*(p) == 0x20) || (*(p) == 0x09) || (*(p) == 0xa) || \
+ (*(p) == 0x3000)) (p)++;
+
+/* I'm too lazy to complete this one TODO !!!! */
+#define IS_BASECHAR(c) \
+ ((((c) >= 0x41) && ((c) <= 0x5a)) || \
+ (((c) >= 0x61) && ((c) <= 0x7a)) || \
+ (((c) >= 0xaa) && ((c) <= 0x5b)) || \
+ (((c) >= 0xc0) && ((c) <= 0xd6)) || \
+ (((c) >= 0xd8) && ((c) <= 0xf6)) || \
+ (((c) >= 0xf8) && ((c) <= 0xff)) || \
+ ((c) == 0xba))
+
+/* I'm too lazy to complete this one TODO !!!! */
+#define IS_DIGIT(c) (((c) >= 0x30) && ((c) <= 0x39))
+
+/* I'm too lazy to complete this one TODO !!!! */
+#define IS_COMBINING(c) 0
+
+#define IS_IGNORABLE(c) \
+ ((((c) >= 0x200c) && ((c) <= 0x200f)) || \
+ (((c) >= 0x202a) && ((c) <= 0x202e)) || \
+ (((c) >= 0x206a) && ((c) <= 0x206f)) || \
+ ((c) == 0xfeff))
+
+#define IS_EXTENDER(c) \
+ (((c) == 0xb7) || ((c) == 0x2d0) || ((c) == 0x2d1) || \
+ ((c) == 0x387) || ((c) == 0x640) || ((c) == 0xe46) || \
+ ((c) == 0xec6) || ((c) == 0x3005) \
+ (((c) >= 0x3031) && ((c) <= 0x3035)) || \
+ (((c) >= 0x309b) && ((c) <= 0x309e)) || \
+ (((c) >= 0x30fc) && ((c) <= 0x30fe)) || \
+ (((c) >= 0xff70) && ((c) <= 0xff9e)) || \
+ ((c) == 0xff9f))
+
+#define IS_IDEOGRAPHIC(c) \
+ ((((c) >= 0x4e00) && ((c) <= 0x9fa5)) || \
+ (((c) >= 0xf900) && ((c) <= 0xfa2d)) || \
+ (((c) >= 0x3021) && ((c) <= 0x3029)) || \
+ ((c) == 0x3007))
+
+#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
+
+/* I'm too lazy to complete this one ! */
+#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xa))
+#else
+/*
+ * 8bits / ASCII version of the macros.
+ */
+#define IS_CHAR(c) \
+ (((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0d) || ((c) >= 0x20))
+
+#define IS_BASECHAR(c) \
+ ((((c) >= 0x41) && ((c) <= 0x5a)) || \
+ (((c) >= 0x61) && ((c) <= 0x7a)) || \
+ (((c) >= 0xaa) && ((c) <= 0x5b)) || \
+ (((c) >= 0xc0) && ((c) <= 0xd6)) || \
+ (((c) >= 0xd8) && ((c) <= 0xf6)) || \
+ (((c) >= 0xf8) && ((c) <= 0xff)) || \
+ ((c) == 0xba))
+
+#define IS_DIGIT(c) (((c) >= 0x30) && ((c) <= 0x39))
+
+#define IS_LETTER(c) IS_BASECHAR(c)
+
+#define IS_COMBINING(c) 0
+
+#define IS_IGNORABLE(c) 0
+
+#define IS_EXTENDER(c) ((c) == 0xb7)
+
+#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xa))
+#endif
+
+
+#define SKIP_EOL(p) \
+ if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
+ if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
+
+#define SKIP_BLANKS(p) \
+ while (IS_BLANK(*(p))) (p)++;
+
+#define MOVETO_ENDTAG(p) \
+ while (IS_CHAR(*p) && (*(p) != '>')) (p)++;
+
+#define MOVETO_STARTTAG(p) \
+ while (IS_CHAR(*p) && (*(p) != '<')) (p)++;
+
+/*
+ * Forward definition for recusive behaviour.
+ */
+xmlNodePtr xmlParseElement(xmlParserCtxtPtr ctxt);
+
+/*
+ * xmlHandleData : this routine represent's the specific application
+ * behaviour when reading a piece of text.
+ *
+ * For example in WebDav, any piece made only of blanks is eliminated
+ */
+
+CHAR *xmlHandleData(CHAR *in) {
+ CHAR *cur;
+
+ if (in == NULL) return(NULL);
+ cur = in;
+ while (IS_CHAR(*cur)) {
+ if (!IS_BLANK(*cur)) goto not_blank;
+ cur++;
+ }
+ free(in);
+ return(NULL);
+
+not_blank:
+ return(in);
+}
+
+/*
+ * xmlStrndup : a strdup for array of CHAR's
+ */
+
+CHAR *xmlStrndup(const CHAR *cur, int len) {
+ CHAR *ret = malloc((len + 1) * sizeof(CHAR));
+
+ if (ret == NULL) {
+ fprintf(stderr, "malloc of %d byte failed\n",
+ (len + 1) * sizeof(CHAR));
+ return(NULL);
+ }
+ memcpy(ret, cur, len * sizeof(CHAR));
+ ret[len] = 0;
+ return(ret);
+}
+
+/*
+ * xmlStrdup : a strdup for CHAR's
+ */
+
+CHAR *xmlStrdup(const CHAR *cur) {
+ const CHAR *p = cur;
+
+ while (IS_CHAR(*p)) p++;
+ return(xmlStrndup(cur, p - cur));
+}
+
+/*
+ * xmlStrcmp : a strcmp for CHAR's
+ */
+
+int xmlStrcmp(const CHAR *str1, const CHAR *str2) {
+ register int tmp;
+
+ do {
+ tmp = *str1++ - *str2++;
+ if (tmp != 0) return(tmp);
+ } while ((*str1 != 0) && (*str2 != 0));
+ return (*str1 - *str2);
+}
+
+/*
+ * xmlStrncmp : a strncmp for CHAR's
+ */
+
+int xmlStrncmp(const CHAR *str1, const CHAR *str2, int len) {
+ register int tmp;
+
+ if (len <= 0) return(0);
+ do {
+ tmp = *str1++ - *str2++;
+ if (tmp != 0) return(tmp);
+ len--;
+ if (len <= 0) return(0);
+ } while ((*str1 != 0) && (*str2 != 0));
+ return (*str1 - *str2);
+}
+
+/*
+ * xmlStrchr : a strchr for CHAR's
+ */
+
+CHAR *xmlStrchr(const CHAR *str, CHAR val) {
+ while (*str != 0) {
+ if (*str == val) return((CHAR *) str);
+ str++;
+ }
+ return(NULL);
+}
+
+/*
+ * xmlParseName : parse an XML name.
+ */
+
+CHAR *xmlParseName(xmlParserCtxtPtr ctxt) {
+ const CHAR *q;
+ CHAR *ret = NULL;
+
+ /*
+ * Name ::= (Letter | '_') (NameChar)*
+ */
+ if (!IS_LETTER(ctxt->cur[0]) && (ctxt->cur[0] != '_')) return(NULL);
+ q = ctxt->cur++;
+ while ((IS_LETTER(ctxt->cur[0])) || (IS_DIGIT(ctxt->cur[0])) ||
+ (ctxt->cur[0] == '.') || (ctxt->cur[0] == '-') || (ctxt->cur[0] == '_') ||
+ (ctxt->cur[0] == ':') ||
+ (IS_COMBINING(ctxt->cur[0])) || (IS_IGNORABLE(ctxt->cur[0])) ||
+ (IS_EXTENDER(ctxt->cur[0])))
+ ctxt->cur++;
+
+ ret = xmlStrndup(q, ctxt->cur - q);
+
+ return(ret);
+}
+
+/*
+ * Parse and return a string between quotes or doublequotes
+ */
+CHAR *xmlParseQuotedString(xmlParserCtxtPtr ctxt) {
+ CHAR *ret = NULL;
+ const CHAR *q;
+
+ if (ctxt->cur[0] == '"') {
+ ctxt->cur++;
+ q = ctxt->cur;
+ while (IS_CHAR(ctxt->cur[0]) && (ctxt->cur[0] != '"')) ctxt->cur++;
+ if (ctxt->cur[0] != '"')
+ fprintf(stderr, "String not closed \"%.50s\n", q);
+ else {
+ ret = xmlStrndup(q, ctxt->cur - q);
+ ctxt->cur++;
+ }
+ } else if (ctxt->cur[0] == '\''){
+ ctxt->cur++;
+ q = ctxt->cur;
+ while (IS_CHAR(ctxt->cur[0]) && (ctxt->cur[0] != '\'')) ctxt->cur++;
+ if (ctxt->cur[0] != '\'')
+ fprintf(stderr, "String not closed '%.50s\n", q);
+ else {
+ ret = xmlStrndup(q, ctxt->cur - q);
+ ctxt->cur++;
+ }
+ }
+ return(ret);
+}
+
+/*
+ * Skip an XML (SGML) comment <!-- .... -->
+ *
+ * TODO !!!! Save the comment in the tree !!!
+ */
+void xmlParserSkipComment(xmlParserCtxtPtr ctxt) {
+ const CHAR *q, *start;
+ const CHAR *r;
+
+ /*
+ * An extra check may avoid errors and isn't that costly !
+ */
+ if ((ctxt->cur[0] != '<') || (ctxt->cur[1] != '!') ||
+ (ctxt->cur[2] != '-') || (ctxt->cur[3] != '-')) return;
+
+ ctxt->cur += 4;
+ start = q = ctxt->cur;
+ ctxt->cur++;
+ r = ctxt->cur;
+ ctxt->cur++;
+ while (IS_CHAR(ctxt->cur[0]) &&
+ ((ctxt->cur[0] == ':') || (ctxt->cur[0] != '>') ||
+ (*r != '-') || (*q != '-'))) {
+ ctxt->cur++;r++;q++;
+ }
+ if (!IS_CHAR(ctxt->cur[0])) {
+ fprintf(stderr, "Comment not terminated <!--%.50s\n", start);
+ ctxt->cur = start; /* !!! We shouldn't really try to recover !!! */
+ } else {
+ ctxt->cur++;
+ }
+}
+
+/*
+ * xmlParseNamespace: parse specific '<?namespace ...' constructs.
+ */
+
+void xmlParseNamespace(xmlParserCtxtPtr ctxt) {
+ CHAR *href = NULL;
+ CHAR *AS = NULL;
+ int garbage = 0;
+
+ /*
+ * We just skipped "namespace" or "xml:namespace"
+ */
+ SKIP_BLANKS(ctxt->cur);
+
+ while (IS_CHAR(ctxt->cur[0]) && (ctxt->cur[0] != '>')) {
+ /*
+ * We can have "ns" or "prefix" attributes
+ * Old encoding as 'href' or 'AS' attributes is still supported
+ */
+ if ((ctxt->cur[0] == 'n') && (ctxt->cur[1] == 's')) {
+ garbage = 0;
+ ctxt->cur += 2;
+ SKIP_BLANKS(ctxt->cur);
+
+ if (ctxt->cur[0] != '=') continue;
+ ctxt->cur++;
+ SKIP_BLANKS(ctxt->cur);
+
+ href = xmlParseQuotedString(ctxt);
+ SKIP_BLANKS(ctxt->cur);
+ } else if ((ctxt->cur[0] == 'h') && (ctxt->cur[1] == 'r') &&
+ (ctxt->cur[2] == 'e') && (ctxt->cur[3] == 'f')) {
+ garbage = 0;
+ ctxt->cur += 4;
+ SKIP_BLANKS(ctxt->cur);
+
+ if (ctxt->cur[0] != '=') continue;
+ ctxt->cur++;
+ SKIP_BLANKS(ctxt->cur);
+
+ href = xmlParseQuotedString(ctxt);
+ SKIP_BLANKS(ctxt->cur);
+ } else if ((ctxt->cur[0] == 'p') && (ctxt->cur[1] == 'r') &&
+ (ctxt->cur[2] == 'e') && (ctxt->cur[3] == 'f') &&
+ (ctxt->cur[4] == 'i') && (ctxt->cur[5] == 'x')) {
+ garbage = 0;
+ ctxt->cur += 6;
+ SKIP_BLANKS(ctxt->cur);
+
+ if (ctxt->cur[0] != '=') continue;
+ ctxt->cur++;
+ SKIP_BLANKS(ctxt->cur);
+
+ AS = xmlParseQuotedString(ctxt);
+ SKIP_BLANKS(ctxt->cur);
+ } else if ((ctxt->cur[0] == 'A') && (ctxt->cur[1] == 'S')) {
+ garbage = 0;
+ ctxt->cur += 2;
+ SKIP_BLANKS(ctxt->cur);
+
+ if (ctxt->cur[0] != '=') continue;
+ ctxt->cur++;
+ SKIP_BLANKS(ctxt->cur);
+
+ AS = xmlParseQuotedString(ctxt);
+ SKIP_BLANKS(ctxt->cur);
+ } else if ((ctxt->cur[0] == '?') && (ctxt->cur[1] == '>')) {
+ garbage = 0;
+ ctxt->cur ++;
+ } else {
+ /*
+ * Found garbage when parsing the namespace
+ */
+ if (!garbage) fprintf(stderr,
+ "\nxmlParseNamespace found garbage: ");
+ fprintf(stderr, "%c", ctxt->cur[0]);
+ ctxt->cur++;
+ }
+ }
+
+ MOVETO_ENDTAG(ctxt->cur);
+ ctxt->cur++;
+
+ /*
+ * Register the DTD.
+ */
+ if (href != NULL)
+ xmlNewDtd(ctxt->doc, href, AS);
+
+ if (AS != NULL) free(AS);
+ if (href != NULL) free(href);
+}
+
+/*
+ * xmlParsePI: parse an XML Processing Instruction.
+ */
+
+void xmlParsePI(xmlParserCtxtPtr ctxt) {
+ if ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '?')) {
+ /*
+ * this is a Processing Instruction.
+ */
+ ctxt->cur += 2;
+
+ /*
+ * Special for WebDav, support for the Processing Instruction
+ * '<?namespace ...' contruct in the header of the XML document.
+ */
+ if ((ctxt->cur[0] == 'n') && (ctxt->cur[1] == 'a') &&
+ (ctxt->cur[2] == 'm') && (ctxt->cur[3] == 'e') &&
+ (ctxt->cur[4] == 's') && (ctxt->cur[5] == 'p') &&
+ (ctxt->cur[6] == 'a') && (ctxt->cur[7] == 'c') &&
+ (ctxt->cur[8] == 'e')) {
+ ctxt->cur += 9;
+ xmlParseNamespace(ctxt);
+ } else if ((ctxt->cur[0] == 'x') && (ctxt->cur[1] == 'm') &&
+ (ctxt->cur[2] == 'l') && (ctxt->cur[3] == ':') &&
+ (ctxt->cur[4] == 'n') && (ctxt->cur[5] == 'a') &&
+ (ctxt->cur[6] == 'm') && (ctxt->cur[7] == 'e') &&
+ (ctxt->cur[8] == 's') && (ctxt->cur[9] == 'p') &&
+ (ctxt->cur[10] == 'a') && (ctxt->cur[11] == 'c') &&
+ (ctxt->cur[12] == 'e')) {
+ ctxt->cur += 13;
+ xmlParseNamespace(ctxt);
+ } else {
+ /* Unknown PI, ignore it ! */
+ fprintf(stderr, "xmlParsePI : skipping unknown PI %30s\n",
+ ctxt->cur);
+ MOVETO_ENDTAG(ctxt->cur);
+ ctxt->cur++;
+ }
+ }
+}
+
+/*
+ * xmlParseAttribute: parse a start of tag.
+ *
+ * Attribute ::= Name Eq AttValue
+ */
+
+void xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlNodePtr node) {
+ const CHAR *q;
+ CHAR *name, *value = NULL;
+
+ if (!IS_LETTER(ctxt->cur[0]) && (ctxt->cur[0] != '_')) {
+ return;
+ }
+ q = ctxt->cur++;
+ while ((IS_LETTER(ctxt->cur[0])) || (IS_DIGIT(ctxt->cur[0])) ||
+ (ctxt->cur[0] == '.') || (ctxt->cur[0] == '-') ||
+ (ctxt->cur[0] == '_') || (ctxt->cur[0] == ':') ||
+ (IS_COMBINING(ctxt->cur[0])) || (IS_IGNORABLE(ctxt->cur[0])) ||
+ (IS_EXTENDER(ctxt->cur[0])))
+ ctxt->cur++;
+ name = xmlStrndup(q, ctxt->cur - q);
+
+ /*
+ * We should have the equal, we are laxist here and allow attributes
+ * without values and extra spaces.
+ */
+ SKIP_BLANKS(ctxt->cur);
+ if (ctxt->cur[0] == '=') {
+ ctxt->cur++;
+ SKIP_BLANKS(ctxt->cur);
+ if ((ctxt->cur[0] != '\'') && (ctxt->cur[0] != '"')) {
+ fprintf(stderr, "Quotes were expected for attribute value %.20s\n",
+ q);
+ } else
+ value = xmlParseQuotedString(ctxt);
+ }
+
+ /*
+ * Add the attribute to the node.
+ */
+ if (name != NULL) {
+ xmlNewProp(node, name, value);
+ free(name);
+ }
+ if ( value != NULL )
+ free(value);
+}
+
+/*
+ * xmlParseStartTag: parse a start of tag.
+ */
+
+xmlNodePtr xmlParseStartTag(xmlParserCtxtPtr ctxt) {
+ const CHAR *q;
+ CHAR *ns, *name;
+ xmlDtdPtr dtd = NULL;
+ xmlNodePtr ret = NULL;
+
+ /*
+ * Theorically one should just parse a Name, but with the addition
+ * of the namespace needed for WebDav, it's a bit more complicated
+ * since the element name may be prefixed by a namespace prefix.
+ *
+ * QName ::= (NSPart ':')? LocalPart
+ * NSPart ::= Name
+ * LocalPart ::= Name
+ * STag ::= '<' QName (S Attribute)* S? '>'
+ *
+ * instead of :
+ *
+ * STag ::= '<' QName (S Attribute)* S? '>'
+ */
+ if (ctxt->cur[0] != '<') return(NULL);
+ ctxt->cur++;
+
+ if (!IS_LETTER(ctxt->cur[0]) && (ctxt->cur[0] != '_')) return(NULL);
+ q = ctxt->cur++;
+ while ((IS_LETTER(ctxt->cur[0])) || (IS_DIGIT(ctxt->cur[0])) ||
+ (ctxt->cur[0] == '.') || (ctxt->cur[0] == '-') ||
+ (ctxt->cur[0] == '_') ||
+ (IS_COMBINING(ctxt->cur[0])) || (IS_IGNORABLE(ctxt->cur[0])) ||
+ (IS_EXTENDER(ctxt->cur[0])))
+ ctxt->cur++;
+
+ if (ctxt->cur[0] == ':') {
+ ns = xmlStrndup(q, ctxt->cur - q);
+
+ ctxt->cur++; /* skip the column */
+ if (!IS_LETTER(ctxt->cur[0]) && (ctxt->cur[0] != '_')) {
+ fprintf(stderr,
+ "Start tag : no element name after namespace identifier %.20s\n",
+ q);
+ free(ns);
+ return(NULL);
+ }
+ q = ctxt->cur++;
+ while ((IS_LETTER(ctxt->cur[0])) || (IS_DIGIT(ctxt->cur[0])) ||
+ (ctxt->cur[0] == '.') || (ctxt->cur[0] == '-') ||
+ (ctxt->cur[0] == '_') || (ctxt->cur[0] == ':') ||
+ (IS_COMBINING(ctxt->cur[0])) || (IS_IGNORABLE(ctxt->cur[0])) ||
+ (IS_EXTENDER(ctxt->cur[0])))
+ ctxt->cur++;
+ name = xmlStrndup(q, ctxt->cur - q);
+
+ /*
+ * Search the DTD associated to ns.
+ */
+ dtd = xmlSearchDtd(ctxt->doc, ns);
+ if (dtd == NULL)
+ fprintf(stderr, "Start tag : Couldn't find namespace %s\n", ns);
+ free(ns);
+ } else
+ name = xmlStrndup(q, ctxt->cur - q);
+
+ ret = xmlNewNode(dtd, name, NULL);
+
+ /*
+ * Now parse the attributes, it ends up with the ending
+ *
+ * (S Attribute)* S?
+ */
+ SKIP_BLANKS(ctxt->cur);
+ while ((IS_CHAR(ctxt->cur[0])) &&
+ (ctxt->cur[0] != '>') &&
+ ((ctxt->cur[0] != '/') || (ctxt->cur[1] != '>'))) {
+ if (IS_LETTER(ctxt->cur[0]) || (ctxt->cur[0] == '_'))
+ xmlParseAttribute(ctxt, ret);
+ else {
+ /* We should warn TODO !!! */
+ ctxt->cur++;
+ }
+ SKIP_BLANKS(ctxt->cur);
+ }
+
+ return(ret);
+}
+
+/*
+ * xmlParseEndTag: parse an end of tag, note that the '</' part has
+ * already been read.
+ */
+
+void xmlParseEndTag(xmlParserCtxtPtr ctxt, xmlDtdPtr *dtdPtr, CHAR **tagPtr) {
+ const CHAR *q;
+ CHAR *ns, *name;
+ xmlDtdPtr dtd = NULL;
+
+ *dtdPtr = NULL;
+ *tagPtr = NULL;
+
+ /*
+ * Theorically one should just parse a Name, but with the addition
+ * of the namespace needed for WebDav, it's a bit more complicated
+ * since the element name may be prefixed by a namespace prefix.
+ *
+ * QName ::= (NSPart ':')? LocalPart
+ * NSPart ::= Name
+ * LocalPart ::= Name
+ * ETag ::= '</' QName S? '>'
+ *
+ * instead of :
+ *
+ * ETag ::= '</' Name S? '>'
+ */
+ if (!IS_LETTER(ctxt->cur[0]) && (ctxt->cur[0] != '_')) return;
+ q = ctxt->cur++;
+ while ((IS_LETTER(ctxt->cur[0])) || (IS_DIGIT(ctxt->cur[0])) ||
+ (ctxt->cur[0] == '.') || (ctxt->cur[0] == '-') ||
+ (ctxt->cur[0] == '_') ||
+ (IS_COMBINING(ctxt->cur[0])) || (IS_IGNORABLE(ctxt->cur[0])) ||
+ (IS_EXTENDER(ctxt->cur[0])))
+ ctxt->cur++;
+
+ if (ctxt->cur[0] == ':') {
+ ns = xmlStrndup(q, ctxt->cur - q);
+
+ ctxt->cur++; /* skip the column */
+ if (!IS_LETTER(ctxt->cur[0]) && (ctxt->cur[0] != '_')) {
+ fprintf(stderr,
+ "End tag : no element name after namespace identifier %.20s\n",
+ q);
+ free(ns);
+ return;
+ }
+ q = ctxt->cur++;
+ while ((IS_LETTER(ctxt->cur[0])) || (IS_DIGIT(ctxt->cur[0])) ||
+ (ctxt->cur[0] == '.') || (ctxt->cur[0] == '-') ||
+ (ctxt->cur[0] == '_') || (ctxt->cur[0] == ':') ||
+ (IS_COMBINING(ctxt->cur[0])) || (IS_IGNORABLE(ctxt->cur[0])) ||
+ (IS_EXTENDER(ctxt->cur[0])))
+ ctxt->cur++;
+ name = xmlStrndup(q, ctxt->cur - q);
+
+ /*
+ * Search the DTD associated to ns.
+ */
+ dtd = xmlSearchDtd(ctxt->doc, ns);
+ if (dtd == NULL)
+ fprintf(stderr, "End tag : Couldn't find namespace %s\n", ns);
+ free(ns);
+ } else
+ name = xmlStrndup(q, ctxt->cur - q);
+
+ *dtdPtr = dtd;
+ *tagPtr = name;
+
+ /*
+ * We should definitely be at the ending "S? '>'" part
+ */
+ SKIP_BLANKS(ctxt->cur);
+ if ((!IS_CHAR(ctxt->cur[0])) || (ctxt->cur[0] != '>')) {
+ fprintf(stderr, "End tag : expected '>', got %.20s\n", ctxt->cur);
+ /*
+ * Note : skipping to the next '>' is probably otherkill,
+ * especially in case the '>' is hust missing.
+ *
+ * Otherwise add:
+ * MOVETO_ENDTAG(ctxt->cur);
+ */
+ } else
+ ctxt->cur++;
+
+ return;
+}
+
+/*
+ * xmlParseCDSect: escaped pure raw content.
+ */
+CHAR *xmlParseCDSect(xmlParserCtxtPtr ctxt) {
+ const CHAR *r, *s, *base;
+ CHAR *ret;
+
+ base = ctxt->cur;
+ if (!IS_CHAR(ctxt->cur[0])) {
+ fprintf(stderr, "CData section not finished : %.20s\n", base);
+ return(NULL);
+ }
+ r = ctxt->cur++;
+ if (!IS_CHAR(ctxt->cur[0])) {
+ fprintf(stderr, "CData section not finished : %.20s\n", base);
+ return(NULL);
+ }
+ s = ctxt->cur++;
+ while (IS_CHAR(ctxt->cur[0]) &&
+ ((*r != ']') || (*s != ']') || (ctxt->cur[0] != '>'))) {
+ r++;s++;ctxt->cur++;
+ }
+ if (!IS_CHAR(ctxt->cur[0])) {
+ fprintf(stderr, "CData section not finished : %.20s\n", base);
+ return(NULL);
+ }
+ ret = xmlStrndup(base, ctxt->cur-base);
+
+ return(ret);
+}
+
+/*
+ * xmlParseContent: a content is
+ * (element | PCData | Reference | CDSect | PI | Comment)
+ *
+ * element : starts by '<'
+ * PCData : any CHAR but '&' or '<'
+ * Reference : starts by '&'
+ * CDSect : starts by '<![CDATA['
+ * PI : starts by '<?'
+ */
+
+xmlNodePtr xmlParseContent(xmlParserCtxtPtr ctxt, xmlNodePtr node) {
+ const CHAR *q;
+ CHAR *data = NULL;
+ xmlNodePtr ret = NULL;
+
+ /*
+ * First case : a Processing Instruction.
+ */
+ if ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '?')) {
+ xmlParsePI(ctxt);
+ }
+ /*
+ * Second case : a CDSection
+ */
+ if ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '!') &&
+ (ctxt->cur[2] == '[') && (ctxt->cur[3] == 'C') &&
+ (ctxt->cur[4] == 'D') && (ctxt->cur[5] == 'A') &&
+ (ctxt->cur[6] == 'T') && (ctxt->cur[7] == 'A') &&
+ (ctxt->cur[8] == '[')) {
+ ctxt->cur += 9;
+ data = xmlParseCDSect(ctxt);
+ }
+ /*
+ * Third case : a sub-element.
+ */
+ else if (ctxt->cur[0] == '<') {
+ ret = xmlParseElement(ctxt);
+ }
+ /*
+ * Last case, text. Note that References are handled directly.
+ */
+ else {
+ q = ctxt->cur;
+ while (IS_CHAR(ctxt->cur[0]) && (ctxt->cur[0] != '<')) ctxt->cur++;
+
+ if (!IS_CHAR(ctxt->cur[0])) {
+ fprintf(stderr, "Truncated content : %.50s\n", q);
+ return(NULL);
+ }
+
+ /*
+ * Do the Entities decoding...
+ */
+ data = xmlStrdup(xmlDecodeEntities(ctxt->doc, q, ctxt->cur - q));
+ }
+
+ /*
+ * Handle the data if any. If there is no child
+ * add it as content, otherwise create a new node of type text.
+ */
+ if (data != NULL)
+ data = xmlHandleData(data);
+ if (data != NULL) {
+ if (node->childs == NULL)
+ xmlNodeSetContent(node, data);
+ else
+ ret = xmlNewText(data);
+ free(data);
+ }
+
+ return(ret);
+}
+
+/*
+ * xmlParseElement: parse an XML element
+ */
+
+xmlNodePtr xmlParseElement(xmlParserCtxtPtr ctxt) {
+ xmlNodePtr ret, child;
+ const CHAR *openTag = ctxt->cur;
+ const CHAR *closeTag = ctxt->cur;
+
+ ret = xmlParseStartTag(ctxt);
+ if (ret == NULL) {
+ return(NULL);
+ }
+
+ /*
+ * Check for an Empty Element.
+ */
+ if ((ctxt->cur[0] == '/') && (ctxt->cur[1] == '>')) {
+ ctxt->cur += 2;
+ return(ret);
+ }
+ if (ctxt->cur[0] == '>') ctxt->cur++;
+ else {
+ fprintf(stderr, "Couldn't find end of Start Tag %.30s\n", openTag);
+ return(NULL);
+ }
+
+ /*
+ * Parse the content of the element:
+ * (element | PCData | Reference | CDSect | PI | Comment) *
+ *
+ * element : starts by '<'
+ * PCData : any CHAR but '&' or '<'
+ * Reference : starts by '&'
+ * CDSect : starts by '<![CDATA['
+ * PI : starts by '<?'
+ *
+ * The loop stops upon detection of an end of tag '</'
+ */
+ while ((IS_CHAR(ctxt->cur[0])) &&
+ ((ctxt->cur[0] != '<') || (ctxt->cur[1] != '/'))) {
+ child = xmlParseContent(ctxt, ret);
+ if (child != NULL)
+ xmlAddChild(ret, child);
+ }
+ if (!IS_CHAR(ctxt->cur[0])) {
+ fprintf(stderr, "Premature end of data in tag %.30s\n", openTag);
+ return(NULL);
+ }
+
+ /*
+ * parse the end of tag : '</' has been detected.
+ */
+ ctxt->cur += 2;
+ if (ctxt->cur[0] == '>') ctxt->cur++; /* simplified closing </> */
+ else {
+ CHAR *endTag;
+ xmlDtdPtr endDtd;
+
+ xmlParseEndTag(ctxt, &endDtd, &endTag);
+
+ /*
+ * Check that the Name in the ETag is the same as in the STag.
+ */
+ if (endDtd != ret->dtd) {
+ fprintf(stderr, "Start and End tags don't use the same DTD:\n");
+ fprintf(stderr, "\t%.30s\n\t%.30s\n", openTag, closeTag);
+ }
+ if (strcmp(ret->name, endTag)) {
+ fprintf(stderr, "Start and End tags don't use the same name:\n");
+ fprintf(stderr, "\t%.30s\n\t%.30s\n", openTag, closeTag);
+ }
+
+ if ( endTag != NULL )
+ free(endTag);
+ }
+
+ return(ret);
+}
+
+/*
+ * xmlParseXMLDecl: parse an XML declaration header
+ */
+
+void xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
+ CHAR *version;
+
+ /*
+ * We know that '<?xml' is here.
+ */
+ ctxt->cur += 5;
+
+ /*
+ * Parse the version info
+ */
+ SKIP_BLANKS(ctxt->cur);
+
+ /*
+ * We should have 'version=' here !
+ */
+ if ((ctxt->cur[0] == 'v') && (ctxt->cur[1] == 'e') &&
+ (ctxt->cur[2] == 'r') && (ctxt->cur[3] == 's') &&
+ (ctxt->cur[4] == 'i') && (ctxt->cur[5] == 'o') &&
+ (ctxt->cur[6] == 'n') && (ctxt->cur[7] == '=')) {
+ ctxt->cur += 8;
+ version = xmlParseQuotedString(ctxt);
+ if (version == NULL)
+ ctxt->doc = xmlNewDoc(XML_DEFAULT_VERSION);
+ else {
+ ctxt->doc = xmlNewDoc(version);
+ free(version);
+ }
+ } else {
+ ctxt->doc = xmlNewDoc(XML_DEFAULT_VERSION);
+ }
+
+ /*
+ * We should check for Required Markup Declaration TODO !!!!
+ */
+ MOVETO_ENDTAG(ctxt->cur);
+ ctxt->cur++;
+
+}
+
+/*
+ * xmlParseMisc: parse an XML Misc optionnal field.
+ * (Comment | PI | S)*
+ */
+
+void xmlParseMisc(xmlParserCtxtPtr ctxt) {
+ while (((ctxt->cur[0] == '<') && (ctxt->cur[1] == '?')) ||
+ ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '!') &&
+ (ctxt->cur[2] == '-') && (ctxt->cur[2] == '-')) ||
+ IS_BLANK(ctxt->cur[0])) {
+ if ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '?')) {
+ xmlParsePI(ctxt);
+ } else if (IS_BLANK(ctxt->cur[0])) {
+ ctxt->cur++;
+ } else
+ xmlParserSkipComment(ctxt);
+ }
+}
+
+/*
+ * xmlParseDocument : parse an XML document and build a tree.
+ */
+
+int xmlParseDocument(xmlParserCtxtPtr ctxt) {
+ /*
+ * We should check for encoding here and plug-in some
+ * conversion code TODO !!!!
+ */
+
+ /*
+ * Wipe out everything which is before the first '<'
+ */
+ SKIP_BLANKS(ctxt->cur);
+
+ /*
+ * Check for the XMLDecl in the Prolog.
+ */
+ if ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '?') &&
+ (ctxt->cur[2] == 'x') && (ctxt->cur[3] == 'm') &&
+ (ctxt->cur[4] == 'l')) {
+ xmlParseXMLDecl(ctxt);
+ /* SKIP_EOL(cur); */
+ SKIP_BLANKS(ctxt->cur);
+ } else if ((ctxt->cur[0] == '<') && (ctxt->cur[1] == '?') &&
+ (ctxt->cur[2] == 'X') && (ctxt->cur[3] == 'M') &&
+ (ctxt->cur[4] == 'L')) {
+ /*
+ * The first drafts were using <?XML and the final W3C REC
+ * now use <?xml ...
+ */
+ xmlParseXMLDecl(ctxt);
+ /* SKIP_EOL(cur); */
+ SKIP_BLANKS(ctxt->cur);
+ } else {
+ ctxt->doc = xmlNewDoc(XML_DEFAULT_VERSION);
+ }
+
+ /*
+ * The Misc part of the Prolog
+ * (Comment | PI | S) *
+ */
+ xmlParseMisc(ctxt);
+
+ /*
+ * Time to start parsing
+ */
+ ctxt->doc->root = xmlParseElement(ctxt);
+
+ return(0);
+}
+
+/*
+ * xmlParseDoc : parse an XML in-memory document and build a tree.
+ */
+
+xmlDocPtr xmlParseDoc(CHAR *cur) {
+ xmlDocPtr ret;
+ xmlParserCtxtPtr ctxt;
+
+ if (cur == NULL) return(NULL);
+
+ ctxt = (xmlParserCtxtPtr) malloc(sizeof(xmlParserCtxt));
+ if (ctxt == NULL) {
+ perror("malloc");
+ return(NULL);
+ }
+
+ xmlInitParserCtxt(ctxt);
+ ctxt->base = cur;
+ ctxt->cur = cur;
+
+ xmlParseDocument(ctxt);
+ ret = ctxt->doc;
+ free(ctxt->nodes);
+ free(ctxt);
+
+ return(ret);
+}
+
+/*
+ * xmlParseFile : parse an XML file and build a tree.
+ */
+
+xmlDocPtr xmlParseFile(const char *filename) {
+ xmlDocPtr ret;
+#ifdef HAVE_ZLIB_H
+ gzFile input;
+#else
+ int input;
+#endif
+ int res;
+ struct stat buf;
+ char *buffer;
+ xmlParserCtxtPtr ctxt;
+
+ res = stat(filename, &buf);
+ if (res < 0) return(NULL);
+
+#ifdef HAVE_ZLIB_H
+retry_bigger:
+ buffer = malloc((buf.st_size * 20) + 100);
+#else
+ buffer = malloc(buf.st_size + 100);
+#endif
+ if (buffer == NULL) {
+ perror("malloc");
+ return(NULL);
+ }
+
+ memset(buffer, 0, sizeof(buffer));
+#ifdef HAVE_ZLIB_H
+ input = gzopen (filename, "r");
+ if (input == NULL) {
+ fprintf (stderr, "Cannot read file %s :\n", filename);
+ perror ("gzopen failed");
+ return(NULL);
+ }
+#else
+ input = open (filename, O_RDONLY);
+ if (input < 0) {
+ fprintf (stderr, "Cannot read file %s :\n", filename);
+ perror ("open failed");
+ return(NULL);
+ }
+#endif
+#ifdef HAVE_ZLIB_H
+ res = gzread(input, buffer, 20 * buf.st_size);
+#else
+ res = read(input, buffer, buf.st_size);
+#endif
+ if (res < 0) {
+ fprintf (stderr, "Cannot read file %s :\n", filename);
+#ifdef HAVE_ZLIB_H
+ perror ("gzread failed");
+#else
+ perror ("read failed");
+#endif
+ return(NULL);
+ }
+#ifdef HAVE_ZLIB_H
+ gzclose(input);
+ if (res >= 20 * buf.st_size) {
+ free(buffer);
+ buf.st_size *= 2;
+ goto retry_bigger;
+ }
+ buf.st_size = res;
+#else
+ close(input);
+#endif
+
+
+ ctxt = (xmlParserCtxtPtr) malloc(sizeof(xmlParserCtxt));
+ if (ctxt == NULL) {
+ perror("malloc");
+ return(NULL);
+ }
+ buffer[buf.st_size] = '\0';
+
+ xmlInitParserCtxt(ctxt);
+ ctxt->filename = filename;
+ ctxt->base = buffer;
+ ctxt->cur = buffer;
+
+ xmlParseDocument(ctxt);
+ ret = ctxt->doc;
+ free(buffer);
+ free(ctxt->nodes);
+ free(ctxt);
+
+ return(ret);
+}
+
+/*
+ * xmlParseFile : parse an XML memory block and build a tree.
+ */
+
+xmlDocPtr xmlParseMemory(char *buffer, int size) {
+ xmlDocPtr ret;
+ xmlParserCtxtPtr ctxt;
+
+ ctxt = (xmlParserCtxtPtr) malloc(sizeof(xmlParserCtxt));
+ if (ctxt == NULL) {
+ perror("malloc");
+ return(NULL);
+ }
+
+ buffer[size - 1] = '\0';
+
+ xmlInitParserCtxt(ctxt);
+ ctxt->base = buffer;
+ ctxt->cur = buffer;
+
+ xmlParseDocument(ctxt);
+ ret = ctxt->doc;
+ free(ctxt->nodes);
+ free(ctxt);
+
+ return(ret);
+}
+
+
+
+
+/* Initialize parser context */
+void xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
+{
+ int i;
+
+ ctxt->filename = NULL;
+ ctxt->base = NULL;
+ ctxt->cur = NULL;
+ ctxt->line = 1;
+ ctxt->col = 1;
+ ctxt->doc = NULL;
+ ctxt->depth = 0;
+ ctxt->max_depth = 10;
+ ctxt->nodes = (xmlNodePtr *) malloc(ctxt->max_depth * sizeof(xmlNodePtr));
+ if (ctxt->nodes == NULL) {
+ fprintf(stderr, "malloc of %d byte failed\n",
+ ctxt->max_depth * sizeof(xmlNodePtr));
+ ctxt->max_depth = 0;
+ } else {
+ for (i = 0;i < ctxt->max_depth;i++)
+ ctxt->nodes[i] = NULL;
+ }
+}
+
+
+/*
+ * Clear (release owned resources) and reinitialize context
+ */
+void xmlClearParserCtxt(xmlParserCtxtPtr ctx)
+{
+ xmlInitParserCtxt(ctx);
+}
+
+
+/*
+ * Setup the parser context to parse a new buffer; Clears any prior
+ * contents from the parser context. The buffer parameter must not be
+ * NULL, but the filename parameter can be
+ */
+void xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const CHAR* buffer,
+ const char* filename)
+{
+ xmlClearParserCtxt(ctxt);
+ ctxt->base = buffer;
+ ctxt->cur = buffer;
+ ctxt->filename = filename;
+}
+
+
+
+void xmlReportError(xmlParserCtxtPtr ctx, const CHAR* msg)
+{
+ fputs(msg, stderr);
+}
diff --git a/xml_parser.h b/xml_parser.h
new file mode 100644
index 00000000..a20c95a2
--- /dev/null
+++ b/xml_parser.h
@@ -0,0 +1,61 @@
+/*
+ * parser.h : constants and stuff related to the XML parser.
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#ifndef __XML_PARSER_H__
+#define __XML_PARSER_H__
+
+#include "xml_tree.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Constants.
+ */
+#define XML_DEFAULT_VERSION "1.0"
+
+
+typedef struct xmlParserCtxt {
+ const char *filename; /* The file analyzed, if any */
+ const CHAR *base; /* Base of the array to parse */
+ const CHAR *cur; /* Current char being parsed */
+ int line; /* Current line */
+ int col; /* Current column */
+ xmlDocPtr doc; /* the document being built */
+ int depth; /* Depth of current element */
+ int max_depth; /* Max depth allocated */
+ xmlNodePtr *nodes; /* The node hierarchy being built */
+} xmlParserCtxt, *xmlParserCtxtPtr;
+
+/*
+ * Interfaces
+ */
+extern int xmlParseDocument(xmlParserCtxtPtr ctxt);
+extern xmlDocPtr xmlParseDoc(CHAR *cur);
+extern xmlDocPtr xmlParseMemory(char *buffer, int size);
+extern xmlDocPtr xmlParseFile(const char *filename);
+extern CHAR *xmlStrdup(const CHAR *input);
+extern CHAR *xmlStrndup(const CHAR *input, int n);
+extern CHAR *xmlStrchr(const CHAR *str, CHAR val);
+extern int xmlStrcmp(const CHAR *str1, const CHAR *str2);
+extern int xmlStrncmp(const CHAR *str1, const CHAR *str2, int len);
+
+extern void xmlInitParserCtxt(xmlParserCtxtPtr ctx);
+extern void xmlClearParserCtxt(xmlParserCtxtPtr ctx);
+extern void xmlSetupParserForBuffer(xmlParserCtxtPtr ctx, const CHAR* buffer,
+ const char* filename);
+
+extern void xmlReportError(xmlParserCtxtPtr ctx, const CHAR* msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_PARSER_H__ */
+
diff --git a/xml_tree.c b/xml_tree.c
new file mode 100644
index 00000000..6a6da8b7
--- /dev/null
+++ b/xml_tree.c
@@ -0,0 +1,731 @@
+/*
+ * tree.c : implemetation of access function for an XML tree.
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <malloc.h>
+#include <string.h> /* for memset() only ! */
+
+#include "xml_tree.h"
+#include "xml_entities.h"
+
+static CHAR xmlStringText[] = { 't', 'e', 'x', 't', 0 };
+int oldXMLWDcompatibility = 0;
+
+/************************************************************************
+ * *
+ * Allocation and deallocation of basic structures *
+ * *
+ ************************************************************************/
+
+/*
+ * Creation of a new DTD.
+ */
+xmlDtdPtr xmlNewDtd(xmlDocPtr doc, const CHAR *href, const CHAR *AS) {
+ xmlDtdPtr cur;
+
+ /*
+ * Allocate a new DTD and fill the fields.
+ */
+ cur = (xmlDtdPtr) malloc(sizeof(xmlDtd));
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNewDtd : malloc failed\n");
+ return(NULL);
+ }
+
+ cur->next = NULL;
+ if (href != NULL)
+ cur->href = xmlStrdup(href);
+ else
+ cur->href = NULL;
+ if (AS != NULL)
+ cur->AS = xmlStrdup(AS);
+ else
+ cur->AS = NULL;
+ if (doc != NULL) {
+ cur->next = doc->dtds;
+ doc->dtds = cur;
+ }
+
+ return(cur);
+}
+
+/*
+ * Freeing a DTD
+ */
+void xmlFreeDtd(xmlDtdPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreeDtd : DTD == NULL\n");
+ return;
+ }
+ if (cur->href != NULL) free((char *) cur->href);
+ if (cur->AS != NULL) free((char *) cur->AS);
+ memset(cur, -1, sizeof(xmlDtd));
+ free(cur);
+}
+
+/*
+ * Freeing a DTD list
+ */
+void xmlFreeDtdList(xmlDtdPtr cur) {
+ xmlDtdPtr next;
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreeDtdList : dtd == NULL\n");
+ return;
+ }
+ while (cur != NULL) {
+ next = cur->next;
+ xmlFreeDtd(cur);
+ cur = next;
+ }
+}
+
+/*
+ * Creation of a new document
+ */
+xmlDocPtr xmlNewDoc(const CHAR *version) {
+ xmlDocPtr cur;
+
+ if (version == NULL) {
+ fprintf(stderr, "xmlNewDoc : version == NULL\n");
+ return(NULL);
+ }
+
+ /*
+ * Allocate a new document and fill the fields.
+ */
+ cur = (xmlDocPtr) malloc(sizeof(xmlDoc));
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNewDoc : malloc failed\n");
+ return(NULL);
+ }
+
+ cur->version = xmlStrdup(version);
+ cur->root = NULL;
+ cur->dtds = NULL;
+ return(cur);
+}
+
+/*
+ * Freeing a document : all the tree is freed too.
+ */
+void xmlFreeDoc(xmlDocPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreeDoc : document == NULL\n");
+ return;
+ }
+ free((char *) cur->version);
+ if (cur->root != NULL) xmlFreeNode(cur->root);
+ if (cur->dtds != NULL) xmlFreeDtdList(cur->dtds);
+ memset(cur, -1, sizeof(xmlDoc));
+ free(cur);
+}
+
+/*
+ * Creation of a new property element in a given DTD.
+ */
+xmlPropPtr xmlNewProp(xmlNodePtr node, const CHAR *name, const CHAR *value) {
+ xmlPropPtr cur;
+
+ if (name == NULL) {
+ fprintf(stderr, "xmlNewProp : name == NULL\n");
+ return(NULL);
+ }
+
+ /*
+ * Allocate a new property and fill the fields.
+ */
+ cur = (xmlPropPtr) malloc(sizeof(xmlProp));
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNewProp : malloc failed\n");
+ return(NULL);
+ }
+
+ cur->node = node;
+ cur->name = xmlStrdup(name);
+ if (value != NULL)
+ cur->value = xmlStrdup(value);
+ else
+ cur->value = NULL;
+ if (node != NULL) {
+ cur->next = node->properties;
+ node->properties = cur;
+ } else
+ cur->next = NULL;
+ return(cur);
+}
+
+/*
+ * Freeing a property list : Free a property and all its siblings,
+ * this is a recursive behaviour, all the childs
+ * are freed too.
+ */
+void xmlFreePropList(xmlPropPtr cur) {
+ xmlPropPtr next;
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreePropList : property == NULL\n");
+ return;
+ }
+ while (cur != NULL) {
+ next = cur->next;
+ xmlFreeProp(cur);
+ cur = next;
+ }
+}
+
+/*
+ * Freeing a property.
+ */
+void xmlFreeProp(xmlPropPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreeProp : property == NULL\n");
+ return;
+ }
+ if (cur->name != NULL) free((char *) cur->name);
+ if (cur->value != NULL) free((char *) cur->value);
+ memset(cur, -1, sizeof(xmlProp));
+ free(cur);
+}
+
+/*
+ * Creation of a new node element in a given DTD.
+ * We assume that the "name" has already being strdup'd !
+ */
+xmlNodePtr xmlNewNode(xmlDtdPtr dtd, const CHAR *name, CHAR *content) {
+ xmlNodePtr cur;
+
+ if (name == NULL) {
+ fprintf(stderr, "xmlNewNode : name == NULL\n");
+ return(NULL);
+ }
+
+ /*
+ * Allocate a new node and fill the fields.
+ */
+ cur = (xmlNodePtr) malloc(sizeof(xmlNode));
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNewNode : malloc failed\n");
+ return(NULL);
+ }
+
+ cur->parent = NULL;
+ cur->next = NULL;
+ cur->childs = NULL;
+ cur->properties = NULL;
+ cur->type = 0;
+ cur->name = name;
+ cur->dtd = dtd;
+ if (content != NULL)
+ cur->content = xmlStrdup(content);
+ else
+ cur->content = NULL;
+ return(cur);
+}
+
+/*
+ * Creation of a new node contening text.
+ */
+xmlNodePtr xmlNewText(CHAR *content) {
+ xmlNodePtr cur;
+
+ /*
+ * Allocate a new node and fill the fields.
+ */
+ cur = (xmlNodePtr) malloc(sizeof(xmlNode));
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNewNode : malloc failed\n");
+ return(NULL);
+ }
+
+ cur->parent = NULL;
+ cur->next = NULL;
+ cur->childs = NULL;
+ cur->properties = NULL;
+ cur->type = XML_TYPE_TEXT;
+ cur->name = xmlStrdup(xmlStringText);;
+ cur->dtd = NULL;
+ if (content != NULL)
+ cur->content = xmlStrdup(content);
+ else
+ cur->content = NULL;
+ return(cur);
+}
+
+/*
+ * Creation of a new child element, added at the end.
+ */
+xmlNodePtr xmlNewChild(xmlNodePtr parent, xmlDtdPtr dtd,
+ const CHAR *name, CHAR *content) {
+ xmlNodePtr cur, prev;
+
+ if (parent == NULL) {
+ fprintf(stderr, "xmlNewChild : parent == NULL\n");
+ return(NULL);
+ }
+
+ if (name == NULL) {
+ fprintf(stderr, "xmlNewChild : name == NULL\n");
+ return(NULL);
+ }
+
+ /*
+ * Allocate a new node
+ */
+ if (dtd == NULL)
+ cur = xmlNewNode(parent->dtd, name, content);
+ else
+ cur = xmlNewNode(dtd, name, content);
+ if (cur == NULL) return(NULL);
+
+ /*
+ * add the new element at the end of the childs list.
+ */
+ cur->parent = parent;
+ if (parent->childs == NULL) {
+ parent->childs = cur;
+ } else {
+ prev = parent->childs;
+ while (prev->next != NULL) prev = prev->next;
+ prev->next = cur;
+ }
+
+ return(cur);
+}
+
+/*
+ * Add a new child element, added at the end.
+ */
+xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
+ xmlNodePtr prev;
+
+ if (parent == NULL) {
+ fprintf(stderr, "xmladdChild : parent == NULL\n");
+ return(NULL);
+ }
+
+ if (cur == NULL) {
+ fprintf(stderr, "xmladdChild : child == NULL\n");
+ return(NULL);
+ }
+
+ /*
+ * add the new element at the end of the childs list.
+ */
+ cur->parent = parent;
+ if (parent->childs == NULL) {
+ parent->childs = cur;
+ } else {
+ prev = parent->childs;
+ while (prev->next != NULL) prev = prev->next;
+ prev->next = cur;
+ }
+
+ return(cur);
+}
+
+/*
+ * Freeing a node list : Free a node and all its siblings,
+ * this is a recursive behaviour, all the childs
+ * are freed too.
+ */
+void xmlFreeNodeList(xmlNodePtr cur) {
+ xmlNodePtr next;
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreeNodeList : node == NULL\n");
+ return;
+ }
+ while (cur != NULL) {
+ next = cur->next;
+ xmlFreeNode(cur);
+ cur = next;
+ }
+}
+
+/*
+ * Freeing a node : this is a recursive behaviour, all the childs
+ * are freed too.
+ */
+void xmlFreeNode(xmlNodePtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlFreeNode : node == NULL\n");
+ return;
+ }
+ if (cur->properties != NULL) xmlFreePropList(cur->properties);
+ if (cur->childs != NULL) xmlFreeNodeList(cur->childs);
+ if (cur->content != NULL) free(cur->content);
+ if (cur->name != NULL) free((char *) cur->name);
+ memset(cur, -1, sizeof(xmlNode));
+ free(cur);
+}
+
+/************************************************************************
+ * *
+ * Content access functions *
+ * *
+ ************************************************************************/
+
+/*
+ * Changing the content of a node.
+ */
+void xmlNodeSetContent(xmlNodePtr cur, CHAR *content) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNodeSetContent : node == NULL\n");
+ return;
+ }
+ if (cur->content != NULL) free(cur->content);
+ if (content != NULL)
+ cur->content = xmlStrdup(content);
+ else
+ cur->content = NULL;
+}
+
+/*
+ * Search a Dtd registered under a given name space for a document.
+ */
+xmlDtdPtr xmlSearchDtd(xmlDocPtr doc, CHAR *nameSpace) {
+ xmlDtdPtr cur;
+
+ if ((doc == NULL) || (nameSpace == NULL)) return(NULL);
+
+ cur = doc->dtds;
+ while (cur != NULL) {
+ if ((cur->AS != NULL) && (!xmlStrcmp(cur->AS, nameSpace)))
+ return(cur);
+ cur = cur->next;
+ }
+ return(NULL);
+}
+
+/*
+ * Reading the content of a given property.
+ */
+const CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name) {
+ xmlPropPtr prop = node->properties;
+
+ while (prop != NULL) {
+ if (!xmlStrcmp(prop->name, name)) return(prop->value);
+ prop = prop->next;
+ }
+ return(NULL);
+}
+
+/************************************************************************
+ * *
+ * Output : to a FILE or in memory *
+ * *
+ ************************************************************************/
+
+/*
+ * routine which manage and grows an output buffer. One can write
+ * standard char array's (8 bits char) or CHAR's arrays.
+ */
+static CHAR *buffer = NULL;
+static int buffer_index = 0;
+static int buffer_size = 0;
+
+static void xmlBufferWriteCHAR(const CHAR *string) {
+ const CHAR *cur;
+
+ if (buffer == NULL) {
+ buffer_size = 50000;
+ buffer = (CHAR *) malloc(buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ fprintf(stderr, "xmlBufferWrite : out of memory!\n");
+ exit(1);
+ }
+ }
+
+ if (string == NULL) return;
+ for (cur = string;*cur != 0;cur++) {
+ if (buffer_index + 10 >= buffer_size) {
+ buffer_size *= 2;
+ buffer = (CHAR *) realloc(buffer, buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ fprintf(stderr, "xmlBufferWrite : out of memory!\n");
+ exit(1);
+ }
+ }
+ buffer[buffer_index++] = *cur;
+ }
+ buffer[buffer_index] = 0;
+}
+
+static void xmlBufferWriteChar(const char *string) {
+ const CHAR *cur;
+
+ if (buffer == NULL) {
+ buffer_size = 50000;
+ buffer = (CHAR *) malloc(buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ fprintf(stderr, "xmlBufferWrite : out of memory!\n");
+ exit(1);
+ }
+ }
+
+ if (string == NULL) return;
+ for (cur = string;*cur != 0;cur++) {
+ if (buffer_index + 10 >= buffer_size) {
+ buffer_size *= 2;
+ buffer = (CHAR *) realloc(buffer, buffer_size * sizeof(CHAR));
+ if (buffer == NULL) {
+ fprintf(stderr, "xmlBufferWrite : out of memory!\n");
+ exit(1);
+ }
+ }
+ buffer[buffer_index++] = *cur;
+ }
+ buffer[buffer_index] = 0;
+}
+
+/*
+ * Dump a DTD to the given FD
+ */
+static void xmlDtdDump(xmlDtdPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlDtdDump : DTD == NULL\n");
+ return;
+ }
+ if (oldXMLWDcompatibility) {
+ xmlBufferWriteChar("<?namespace");
+ if (cur->href != NULL) {
+ xmlBufferWriteChar(" href=\"");
+ xmlBufferWriteCHAR(cur->href);
+ xmlBufferWriteChar("\"");
+ }
+ if (cur->AS != NULL) {
+ xmlBufferWriteChar(" AS=\"");
+ xmlBufferWriteCHAR(cur->AS);
+ xmlBufferWriteChar("\"");
+ }
+ xmlBufferWriteChar("?>\n");
+ } else {
+ xmlBufferWriteChar("<?xml:namespace");
+ if (cur->href != NULL) {
+ xmlBufferWriteChar(" ns=\"");
+ xmlBufferWriteCHAR(cur->href);
+ xmlBufferWriteChar("\"");
+ }
+ if (cur->AS != NULL) {
+ xmlBufferWriteChar(" prefix=\"");
+ xmlBufferWriteCHAR(cur->AS);
+ xmlBufferWriteChar("\"");
+ }
+ xmlBufferWriteChar("?>\n");
+ }
+}
+
+/*
+ * Dump an XML property to the given FD
+ */
+
+static void xmlPropDump(xmlDocPtr doc, xmlPropPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlPropDump : property == NULL\n");
+ return;
+ }
+ xmlBufferWriteChar(" ");
+ xmlBufferWriteCHAR(cur->name);
+ if (cur->value) {
+ xmlBufferWriteChar("=\"");
+ xmlBufferWriteCHAR(xmlEncodeEntities(doc, cur->value));
+ xmlBufferWriteChar("\"");
+ }
+}
+
+/*
+ * Dump an XML property list to the given FD
+ */
+
+static void xmlPropListDump(xmlDocPtr doc, xmlPropPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlPropListDump : property == NULL\n");
+ return;
+ }
+ while (cur != NULL) {
+ xmlPropDump(doc, cur);
+ cur = cur->next;
+ }
+}
+
+/*
+ * Dump an XML node list to the given FD
+ */
+
+static void xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level);
+static void xmlNodeListDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNodeListDump : node == NULL\n");
+ return;
+ }
+ while (cur != NULL) {
+ xmlNodeDump(doc, cur, level);
+ cur = cur->next;
+ }
+}
+
+/*
+ * Dump an XML node to the given FD
+ */
+
+static void xmlNodeDump(xmlDocPtr doc, xmlNodePtr cur, int level) {
+ int i;
+
+ if (cur == NULL) {
+ fprintf(stderr, "xmlNodeDump : node == NULL\n");
+ return;
+ }
+ if (cur->type == XML_TYPE_TEXT) {
+ if (cur->content != NULL)
+ xmlBufferWriteCHAR(xmlEncodeEntities(doc, cur->content));
+ return;
+ }
+ for (i = 0;i < level;i++)
+ xmlBufferWriteChar(" ");
+
+ xmlBufferWriteChar("<");
+ if ((cur->dtd != NULL) && (cur->dtd->AS != NULL)) {
+ xmlBufferWriteCHAR(cur->dtd->AS);
+ xmlBufferWriteChar(":");
+ }
+
+ xmlBufferWriteCHAR(cur->name);
+ if (cur->properties != NULL)
+ xmlPropListDump(doc, cur->properties);
+
+ if ((cur->content == NULL) && (cur->childs == NULL)) {
+ xmlBufferWriteChar("/>\n");
+ return;
+ }
+ xmlBufferWriteChar(">");
+ if (cur->content != NULL)
+ xmlBufferWriteCHAR(xmlEncodeEntities(doc, cur->content));
+ if (cur->childs != NULL) {
+ xmlBufferWriteChar("\n");
+ xmlNodeListDump(doc, cur->childs, level + 1);
+ for (i = 0;i < level;i++)
+ xmlBufferWriteChar(" ");
+ }
+ xmlBufferWriteChar("</");
+ if ((cur->dtd != NULL) && (cur->dtd->AS != NULL)) {
+ xmlBufferWriteCHAR(cur->dtd->AS);
+ xmlBufferWriteChar(":");
+ }
+
+ xmlBufferWriteCHAR(cur->name);
+ xmlBufferWriteChar(">\n");
+}
+
+/*
+ * Dump an XML DTD list to the given FD
+ */
+
+static void xmlDtdListDump(xmlDtdPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlDtdListDump : DTD == NULL\n");
+ return;
+ }
+ while (cur != NULL) {
+ xmlDtdDump(cur);
+ cur = cur->next;
+ }
+}
+
+/*
+ * Dump an XML document to memory.
+ */
+
+void xmlDocDumpMemory(xmlDocPtr cur, CHAR**mem, int *size) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlDocDump : document == NULL\n");
+ *mem = NULL;
+ *size = 0;
+ return;
+ }
+ buffer_index = 0;
+ if (oldXMLWDcompatibility)
+ xmlBufferWriteChar("<?XML version=\"");
+ else
+ xmlBufferWriteChar("<?xml version=\"");
+ xmlBufferWriteCHAR(cur->version);
+ xmlBufferWriteChar("\"?>\n");
+ if (cur->dtds != NULL)
+ xmlDtdListDump(cur->dtds);
+ if (cur->root != NULL)
+ xmlNodeDump(cur, cur->root, 0);
+
+ *mem = buffer;
+ *size = buffer_index;
+}
+
+/*
+ * Dump an XML document to the given FD
+ */
+
+void xmlDocDump(FILE *f, xmlDocPtr cur) {
+ if (cur == NULL) {
+ fprintf(stderr, "xmlDocDump : document == NULL\n");
+ return;
+ }
+ buffer_index = 0;
+ if (oldXMLWDcompatibility)
+ xmlBufferWriteChar("<?XML version=\"");
+ else
+ xmlBufferWriteChar("<?xml version=\"");
+ xmlBufferWriteCHAR(cur->version);
+ xmlBufferWriteChar("\"?>\n");
+ if (cur->dtds != NULL)
+ xmlDtdListDump(cur->dtds);
+ if (cur->root != NULL)
+ xmlNodeDump(cur, cur->root, 0);
+
+ fwrite(buffer, sizeof(CHAR), buffer_index, f);
+}
+
+/************************************************************************
+ * *
+ * Debug *
+ * *
+ ************************************************************************/
+
+#ifdef DEBUG_TREE
+int main(void) {
+ xmlDocPtr doc;
+ xmlNodePtr tree, subtree;
+ xmlDtdPtr dtd1;
+ xmlDtdPtr dtd2;
+
+ /*
+ * build a fake XML document
+ */
+ doc = xmlNewDoc("1.0");
+ dtd1 = xmlNewDtd(doc, "http://www.ietf.org/standards/dav/", "D");
+ dtd2 = xmlNewDtd(doc, "http://www.w3.com/standards/z39.50/", "Z");
+ doc->root = xmlNewNode(dtd1, "multistatus", NULL);
+ tree = xmlNewChild(doc->root, NULL, "response", NULL);
+ subtree = xmlNewChild(tree, NULL, "prop", NULL);
+ xmlNewChild(subtree, dtd2, "Authors", NULL);
+ subtree = xmlNewChild(tree, NULL, "status", "HTTP/1.1 420 Method Failure");
+ tree = xmlNewChild(doc->root, NULL, "response", NULL);
+ subtree = xmlNewChild(tree, NULL, "prop", NULL);
+ xmlNewChild(subtree, dtd2, "Copyright-Owner", NULL);
+ subtree = xmlNewChild(tree, NULL, "status", "HTTP/1.1 409 Conflict");
+ tree = xmlNewChild(doc->root, NULL, "responsedescription",
+ "Copyright Owner can not be deleted or altered");
+
+ /*
+ * print it.
+ */
+ xmlDocDump(stdout, doc);
+
+ /*
+ * free it.
+ */
+ xmlFreeDoc(doc);
+ return(0);
+}
+#endif
diff --git a/xml_tree.h b/xml_tree.h
new file mode 100644
index 00000000..00322c10
--- /dev/null
+++ b/xml_tree.h
@@ -0,0 +1,113 @@
+/*
+ * tree.h : describes the structures found in an tree resulting
+ * from an XML parsing.
+ *
+ * See Copyright for the status of this software.
+ *
+ * $Id$
+ */
+
+#ifndef __XML_TREE_H__
+#define __XML_TREE_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Type definitions
+ */
+#ifdef UNICODE
+typedef unsigned short CHAR;
+#else
+typedef unsigned char CHAR;
+#endif
+
+/*
+ * Constants.
+ */
+#define XML_TYPE_TEXT 1
+
+/*
+ * An XML DTD defining a given name space.
+ */
+typedef struct xmlDtd {
+ struct xmlDtd *next; /* next Dtd link for this document */
+ const CHAR *href; /* URL for the DTD */
+ const CHAR *AS; /* URL for the DTD */
+ void *entities; /* Hash table for entities if any */
+} xmlDtd, *xmlDtdPtr;
+
+/*
+ * A property of an XML node.
+ */
+typedef struct xmlProp {
+ struct xmlNode *node; /* prop->node link */
+ struct xmlProp *next; /* parent->childs link */
+ const CHAR *name; /* the name of the property */
+ const CHAR *value; /* the value of the property */
+} xmlProp, *xmlPropPtr;
+
+/*
+ * A node in an XML tree.
+ */
+typedef struct xmlNode {
+ struct xmlNode *parent; /* child->parent link */
+ struct xmlNode *next; /* next sibling link */
+ struct xmlNode *childs; /* parent->childs link */
+ struct xmlProp *properties; /* properties list */
+ int type; /* type number in the DTD */
+ const CHAR *name; /* the name of the node */
+ xmlDtd *dtd; /* pointer to the DTD */
+ CHAR *content; /* the content */
+} xmlNode, *xmlNodePtr;
+
+/*
+ * An XML document.
+ */
+typedef struct xmlDoc {
+ const CHAR *version; /* the XML version string */
+ struct xmlDtd *dtds; /* referenced DTDs */
+ struct xmlNode *root; /* parent->childs link */
+ void *entities; /* Hash table for entities if any */
+} xmlDoc, *xmlDocPtr;
+
+/*
+ * Variables.
+ */
+extern xmlDtdPtr baseDTD;
+extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
+
+/*
+ * Functions.
+ */
+extern xmlDtdPtr xmlNewDtd(xmlDocPtr doc, const CHAR *href, const CHAR *AS);
+extern void xmlFreeDtd(xmlDtdPtr cur);
+extern xmlDocPtr xmlNewDoc(const CHAR *version);
+extern void xmlFreeDoc(xmlDocPtr cur);
+extern xmlPropPtr xmlNewProp(xmlNodePtr node, const CHAR *name,
+ const CHAR *value);
+extern const CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name);
+extern void xmlFreePropList(xmlPropPtr cur);
+extern void xmlFreeProp(xmlPropPtr cur);
+extern xmlNodePtr xmlNewNode(xmlDtdPtr dtd, const CHAR *name, CHAR *content);
+extern xmlNodePtr xmlNewText(CHAR *content);
+extern xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur);
+extern void xmlFreeNodeList(xmlNodePtr cur);
+extern void xmlFreeNode(xmlNodePtr cur);
+extern void xmlNodeSetContent(xmlNodePtr cur, CHAR *content);
+extern xmlDtdPtr xmlSearchDtd(xmlDocPtr doc, CHAR *nameSpace);
+extern xmlNodePtr xmlNewChild(xmlNodePtr parent, xmlDtdPtr dtd,
+ const CHAR *name, CHAR *content);
+
+extern void xmlDocDumpMemory(xmlDocPtr cur, CHAR**mem, int *size);
+extern void xmlDocDump(FILE *f, xmlDocPtr doc);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_TREE_H__ */
+