[xml/sgml-commit] r478 - in packages/libxml2/trunk: . debian doc doc/devhelp doc/examples doc/html example include include/libxml python python/tests result result/noent result/schemas test test/schemas xstc

Mike Hommey glandium at costa.debian.org
Tue Sep 13 16:06:47 UTC 2005


Author: glandium
Date: 2005-09-13 16:06:20 +0000 (Tue, 13 Sep 2005)
New Revision: 478

Added:
   packages/libxml2/trunk/doc/devhelp/
Modified:
   packages/libxml2/trunk/ChangeLog
   packages/libxml2/trunk/Makefile.in
   packages/libxml2/trunk/NEWS
   packages/libxml2/trunk/aclocal.m4
   packages/libxml2/trunk/autogen.sh
   packages/libxml2/trunk/configure
   packages/libxml2/trunk/configure.in
   packages/libxml2/trunk/debian/changelog
   packages/libxml2/trunk/debugXML.c
   packages/libxml2/trunk/depcomp
   packages/libxml2/trunk/doc/APIchunk10.html
   packages/libxml2/trunk/doc/APIchunk14.html
   packages/libxml2/trunk/doc/APIchunk15.html
   packages/libxml2/trunk/doc/APIchunk16.html
   packages/libxml2/trunk/doc/APIchunk17.html
   packages/libxml2/trunk/doc/APIchunk2.html
   packages/libxml2/trunk/doc/APIchunk23.html
   packages/libxml2/trunk/doc/APIchunk24.html
   packages/libxml2/trunk/doc/APIchunk28.html
   packages/libxml2/trunk/doc/APIchunk3.html
   packages/libxml2/trunk/doc/APIchunk4.html
   packages/libxml2/trunk/doc/APIchunk6.html
   packages/libxml2/trunk/doc/APIfiles.html
   packages/libxml2/trunk/doc/APIsymbols.html
   packages/libxml2/trunk/doc/Makefile.am
   packages/libxml2/trunk/doc/Makefile.in
   packages/libxml2/trunk/doc/apibuild.py
   packages/libxml2/trunk/doc/devhelp/Makefile.in
   packages/libxml2/trunk/doc/examples/Makefile.in
   packages/libxml2/trunk/doc/html/libxml-parser.html
   packages/libxml2/trunk/doc/html/libxml-schemasInternals.html
   packages/libxml2/trunk/doc/html/libxml-xmlautomata.html
   packages/libxml2/trunk/doc/html/libxml-xmlerror.html
   packages/libxml2/trunk/doc/html/libxml-xmlmodule.html
   packages/libxml2/trunk/doc/html/libxml-xmlreader.html
   packages/libxml2/trunk/doc/html/libxml-xmlregexp.html
   packages/libxml2/trunk/doc/html/libxml-xmlsave.html
   packages/libxml2/trunk/doc/html/libxml-xmlschemas.html
   packages/libxml2/trunk/doc/html/libxml-xmlstring.html
   packages/libxml2/trunk/doc/libxml2-api.xml
   packages/libxml2/trunk/doc/libxml2.xsa
   packages/libxml2/trunk/doc/news.html
   packages/libxml2/trunk/doc/xml.html
   packages/libxml2/trunk/error.c
   packages/libxml2/trunk/example/Makefile.in
   packages/libxml2/trunk/include/Makefile.in
   packages/libxml2/trunk/include/libxml/Makefile.in
   packages/libxml2/trunk/include/libxml/parser.h
   packages/libxml2/trunk/include/libxml/schemasInternals.h
   packages/libxml2/trunk/include/libxml/xmlerror.h
   packages/libxml2/trunk/include/libxml/xmlsave.h
   packages/libxml2/trunk/include/libxml/xmlstring.h
   packages/libxml2/trunk/include/libxml/xmlversion.h
   packages/libxml2/trunk/install-sh
   packages/libxml2/trunk/libxml.spec.in
   packages/libxml2/trunk/libxml2.spec
   packages/libxml2/trunk/missing
   packages/libxml2/trunk/mkinstalldirs
   packages/libxml2/trunk/parser.c
   packages/libxml2/trunk/python/Makefile.in
   packages/libxml2/trunk/python/setup.py
   packages/libxml2/trunk/python/tests/Makefile.in
   packages/libxml2/trunk/result/noent/xhtml1
   packages/libxml2/trunk/result/schemas/allsg_0_3.err
   packages/libxml2/trunk/result/schemas/allsg_0_4.err
   packages/libxml2/trunk/result/schemas/changelog093_1_0.err
   packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0
   packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0.err
   packages/libxml2/trunk/result/schemas/derivation-ok-restriction-2-1-1_0_0.err
   packages/libxml2/trunk/result/schemas/import1_0_0.err
   packages/libxml2/trunk/result/xhtml1
   packages/libxml2/trunk/result/xhtml1.rde
   packages/libxml2/trunk/result/xhtml1.rdr
   packages/libxml2/trunk/result/xhtml1.sax
   packages/libxml2/trunk/result/xhtml1.sax2
   packages/libxml2/trunk/test/schemas/import1_0.xsd
   packages/libxml2/trunk/test/xhtml1
   packages/libxml2/trunk/testapi.c
   packages/libxml2/trunk/xmllint.c
   packages/libxml2/trunk/xmlsave.c
   packages/libxml2/trunk/xmlschemas.c
   packages/libxml2/trunk/xstc/Makefile.in
Log:
New upstream

Modified: packages/libxml2/trunk/ChangeLog
===================================================================
--- packages/libxml2/trunk/ChangeLog	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/ChangeLog	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,3 +1,95 @@
+Mon Sep 12 23:41:40 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* NEWS configure.in doc//*: release of 2.6.22 updated doc and
+	  rebuild.
+	* xmlsave.c include/libxml/xmlsave.h: added XML_SAVE_NO_XHTML
+	  xmlSaveOption
+	* xmlschemas.c: minor cleanups
+
+Mon Sep 12 21:42:47 CEST 2005 Kasimier Buchcik <libxml2-cvs at cazic.net>
+	
+	* test/schemas/import1_0.xsd: And adapting another one.
+
+Mon Sep 12 21:29:35 CEST 2005 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* result/schemas/derivation-ok-extension_0_0: Adapted result.
+
+Mon Sep 12 21:20:41 CEST 2005 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* result/schemas/allsg_0_3.err result/schemas/allsg_0_4.err
+	  result/schemas/changelog093_1_0.err
+	  result/schemas/derivation-ok-extension_0_0.err
+	  result/schemas/import1_0_0.err
+	  result/schemas/derivation-ok-restriction-2-1-1_0_0.err:
+	  Adapted regression results.
+
+Mon Sep 12 21:00:53 CEST 2005 Kasimier Buchcik <libxml2-cvs at cazic.net>
+
+	* xmlschemas.c include/libxml/schemasInternals.h
+	  include/libxml/xmlerror.h: Completion of the schema graph.
+	  Centralisation, more robustness of the schema document
+	  aquisition story. Centralised and restructured component fixup.
+	  Fixed attribute derivation when 'prohibiting' attribute uses.
+	  Added warnings: when schema documents cannot be localized
+	  during imports; when we get duplicate and pointless attribute
+	  prohibitions. Changed error reports for IDCs to report
+	  the relevant IDC designation as well (requested by GUY Fabrice).
+	  Misc code-cleanup.
+
+Mon Sep 12 16:02:12 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* xmlsave.c: applied second patch from David Madore to be less intrusive
+	  when handling scripts and style elements in XHTML1 should fix #316041
+	* test/xhtml1 result//xhtml1\*: updated the test accordingly
+
+Mon Sep 12 15:09:09 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* libxml.spec.in doc/devhelp/*: finished the integration with
+	  devhelp, completing the index and inserted into the gtk-doc
+	  database at "make install" stage
+
+Mon Sep 12 14:14:12 CEST 2005 Rob Richards <rrichards at ctindustries.net>
+
+	* include/libxml/xmlsave.h xmlsave.c: add XML_SAVE_NO_EMPTY save option
+	  and use option from xmlSaveCtxtPtr rather than global during output.
+	* xmlsave.c: fix some output formatting for meta element under XHTML.
+
+Mon Sep 12 11:12:03 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* include/libxml/parser.h parser.c xmllint.c: damn XML_FEATURE_UNICODE
+	  clashes with Expat headers rename to XML_WITH_ to fix bug #316053. 
+	* doc/Makefile.am: build devhelp before the examples.
+	* doc/*: regenerated the API
+
+Mon Sep 12 02:03:12 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* xmlsave.c: fix bug #316034, where xmlElemDump() can crash if 
+	  given a document pointer instead of an element
+
+Mon Sep 12 01:26:16 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* doc/devhelp/devhelp.xsl: improvements on the html generation,
+	  should be complete with navigation, what is left done is glueing
+
+Mon Sep 12 00:03:27 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* configure.in doc/Makefile.am doc/apibuild.py doc/libxml2-api.xml
+	  doc/devhelp/*: started work needed to generate devhelp content,
+	  not too hard based on the existing format and extractor.
+
+Fri Sep  9 12:56:19 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* parser.c: fixes bug #315617 when using push CDATA in some cases.
+
+Thu Sep  8 23:39:41 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* xmllint.c: patch from Stéphane Bidoul to compile without schematron
+
+Wed Sep  7 00:16:27 CEST 2005 Daniel Veillard <daniel at veillard.com>
+
+	* debugXML.c: patch from Oleg Paraschenko to fix xmlDebugDumpNode()
+	  when handled a namespace node.
+
 Sun Sep  4 23:36:45 CEST 2005 Daniel Veillard <daniel at veillard.com>
 
 	* NEWS elfgcchack.h testapi.c doc/*: updated the docs and rebuild

Modified: packages/libxml2/trunk/Makefile.in
===================================================================
--- packages/libxml2/trunk/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,8 +17,6 @@
 
 
 
-SOURCES = $(libxml2_la_SOURCES) $(testdso_la_SOURCES) $(runsuite_SOURCES) $(runtest_SOURCES) $(testAutomata_SOURCES) $(testC14N_SOURCES) $(testHTML_SOURCES) $(testModule_SOURCES) $(testReader_SOURCES) $(testRegexp_SOURCES) $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) $(testapi_SOURCES) $(xmlcatalog_SOURCES) $(xmllint_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -39,6 +37,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 noinst_PROGRAMS = testSchemas$(EXEEXT) testRelax$(EXEEXT) \
 	testSAX$(EXEEXT) testHTML$(EXEEXT) testXPath$(EXEEXT) \
@@ -66,7 +65,16 @@
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES = libxml2.spec xml2-config libxml-2.0.pc \
 	libxml-2.0-uninstalled.pc
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(confexecdir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)"
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+	"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \
+	"$(DESTDIR)$(man3dir)" "$(DESTDIR)$(confexecdir)" \
+	"$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
 am__DEPENDENCIES_1 =
@@ -157,52 +165,13 @@
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
- at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/DOCBparser.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/HTMLparser.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/HTMLtree.Plo ./$(DEPDIR)/SAX.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/SAX2.Plo ./$(DEPDIR)/c14n.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/catalog.Plo ./$(DEPDIR)/chvalid.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/debugXML.Plo ./$(DEPDIR)/dict.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/encoding.Plo ./$(DEPDIR)/entities.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/error.Plo ./$(DEPDIR)/globals.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/hash.Plo ./$(DEPDIR)/legacy.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/list.Plo ./$(DEPDIR)/nanoftp.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/nanohttp.Plo ./$(DEPDIR)/parser.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/parserInternals.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/pattern.Plo ./$(DEPDIR)/relaxng.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/runsuite.Po ./$(DEPDIR)/runtest.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/schematron.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/testAutomata.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testC14N.Po ./$(DEPDIR)/testHTML.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testModule.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testReader.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testRegexp.Po ./$(DEPDIR)/testRelax.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testSAX.Po ./$(DEPDIR)/testSchemas.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testThreads at THREADS_W32@.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testURI.Po ./$(DEPDIR)/testXPath.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testapi.Po ./$(DEPDIR)/testdso.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/threads.Plo ./$(DEPDIR)/tree.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/trio.Plo ./$(DEPDIR)/triostr.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/uri.Plo ./$(DEPDIR)/valid.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xinclude.Plo ./$(DEPDIR)/xlink.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlIO.Plo ./$(DEPDIR)/xmlcatalog.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/xmllint.Po ./$(DEPDIR)/xmlmemory.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlmodule.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlreader.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlregexp.Plo ./$(DEPDIR)/xmlsave.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlschemas.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlschemastypes.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlstring.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlunicode.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xmlwriter.Plo ./$(DEPDIR)/xpath.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/xpointer.Plo
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libxml2_la_SOURCES) $(testdso_la_SOURCES) \
 	$(runsuite_SOURCES) $(runtest_SOURCES) $(testAutomata_SOURCES) \
@@ -427,6 +396,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -653,7 +624,7 @@
 	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  if test -f $$p; then \
-	    f="`echo $$p | sed -e 's|^.*/||'`"; \
+	    f=$(am__strip_dir) \
 	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
 	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
 	  else :; fi; \
@@ -661,8 +632,8 @@
 
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	    p="`echo $$p | sed -e 's|^.*/||'`"; \
+	@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
 	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
 	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
 	done
@@ -868,24 +839,21 @@
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
@@ -992,7 +960,7 @@
 	test -z "$(confexecdir)" || $(mkdir_p) "$(DESTDIR)$(confexecdir)"
 	@list='$(confexec_DATA)'; for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " $(confexecDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(confexecdir)/$$f'"; \
 	  $(confexecDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(confexecdir)/$$f"; \
 	done
@@ -1000,7 +968,7 @@
 uninstall-confexecDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(confexec_DATA)'; for p in $$list; do \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " rm -f '$(DESTDIR)$(confexecdir)/$$f'"; \
 	  rm -f "$(DESTDIR)$(confexecdir)/$$f"; \
 	done
@@ -1009,7 +977,7 @@
 	test -z "$(m4datadir)" || $(mkdir_p) "$(DESTDIR)$(m4datadir)"
 	@list='$(m4data_DATA)'; for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " $(m4dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(m4datadir)/$$f'"; \
 	  $(m4dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(m4datadir)/$$f"; \
 	done
@@ -1017,7 +985,7 @@
 uninstall-m4dataDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(m4data_DATA)'; for p in $$list; do \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " rm -f '$(DESTDIR)$(m4datadir)/$$f'"; \
 	  rm -f "$(DESTDIR)$(m4datadir)/$$f"; \
 	done
@@ -1026,7 +994,7 @@
 	test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)"
 	@list='$(pkgconfig_DATA)'; for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
 	  $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
 	done
@@ -1034,7 +1002,7 @@
 uninstall-pkgconfigDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(pkgconfig_DATA)'; for p in $$list; do \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
 	  rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
 	done
@@ -1046,7 +1014,13 @@
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -1058,7 +1032,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -1066,7 +1040,13 @@
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -1087,7 +1067,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -1192,12 +1172,14 @@
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || mkdir "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="../$(top_distdir)" \
-	        distdir="../$(distdir)/$$subdir" \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -1211,15 +1193,15 @@
 	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r $(distdir)
 dist-gzip: distdir
-	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 
 dist-bzip2: distdir
-	$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
 dist-tarZ: distdir
-	$(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__remove_distdir)
 
 dist-shar: distdir
@@ -1232,7 +1214,7 @@
 	$(am__remove_distdir)
 
 dist dist-all: distdir
-	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
@@ -1241,11 +1223,11 @@
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
-	  bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.Z*) \
-	  uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
 	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
@@ -1334,7 +1316,7 @@
 	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -1407,8 +1389,8 @@
 	check-am check-local clean clean-binPROGRAMS clean-generic \
 	clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
 	clean-noinstPROGRAMS clean-recursive ctags ctags-recursive \
-	dist dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ \
-	dist-zip distcheck distclean distclean-compile \
+	dist dist-all dist-bzip2 dist-gzip dist-hook dist-shar \
+	dist-tarZ dist-zip distcheck distclean distclean-compile \
 	distclean-generic distclean-hdr distclean-libtool \
 	distclean-recursive distclean-tags distcleancheck distdir \
 	distuninstallcheck dvi dvi-am html html-am info info-am \

Modified: packages/libxml2/trunk/NEWS
===================================================================
--- packages/libxml2/trunk/NEWS	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/NEWS	2005-09-13 16:06:20 UTC (rev 478)
@@ -15,6 +15,23 @@
 to the CVS at 
 http://cvs.gnome.org/viewcvs/libxml2/
  code base.There is the list of public releases:
+2.6.22: Sep 12 2005:
+   - build fixes: compile without schematron (Stéphane Bidoul)
+   - bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i,
+      CDATA push parser bug, xmlElemDump problem with XHTML1 doc, 
+      XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx,
+      fix some output formatting for meta element (Rob Richards),
+      script and style XHTML1 serialization (David Madore), Attribute
+      derivation fixups in XSD (Kasimier Buchcik), better IDC error
+      reports (Kasimier Buchcik)
+      
+   - improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards),
+      add XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements
+      preparing for derive (Kasimier Buchcik).
+   - documentation: generation of gtk-doc like docs, integration with
+      devhelp.
+
+
 2.6.21: Sep 4 2005:
    - build fixes: Cygwin portability fixes (Gerrit P. Haase), calling
       convention problems on Windows (Marcus Boerger), cleanups based on

Modified: packages/libxml2/trunk/aclocal.m4
===================================================================
--- packages/libxml2/trunk/aclocal.m4	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/aclocal.m4	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -5927,56 +5927,33 @@
 AC_MSG_RESULT([$SED])
 ])
 
-#                                                        -*- Autoconf -*-
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
-# Generated from amversion.in; do not edit by hand.
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"])
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
 
 # AM_SET_CURRENT_AUTOMAKE_VERSION
 # -------------------------------
 # Call AM_AUTOMAKE_VERSION so it can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.8.5])])
+	 [AM_AUTOMAKE_VERSION([1.9.6])])
 
-# AM_AUX_DIR_EXPAND
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -6022,27 +5999,17 @@
 am_aux_dir=`cd $ac_aux_dir && pwd`
 ])
 
-# AM_CONDITIONAL                                              -*- Autoconf -*-
+# AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 7
 
-# 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.
-
-# serial 6
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
@@ -6061,31 +6028,20 @@
 fi
 AC_CONFIG_COMMANDS_PRE(
 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
-  AC_MSG_ERROR([conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.])
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# serial 7						-*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 8
 
-# 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.
-
-
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
@@ -6093,7 +6049,6 @@
 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
 
 
-
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
@@ -6233,27 +6188,17 @@
 AC_SUBST([AMDEPBACKSLASH])
 ])
 
-# Generate code to set up dependency tracking.   -*- Autoconf -*-
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+#serial 3
 
-# 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.
-
-#serial 2
-
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -6271,27 +6216,21 @@
   else
     continue
   fi
-  grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
-  # Extract the definition of DEP_FILES from the Makefile without
-  # running `make'.
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
   DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
   test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
   # When using ansi2knr, U may be empty or an underscore; expand it
   U=`sed -n 's/^U = //p' < "$mf"`
-  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
-  # We invoke sed twice because it is the simplest approach to
-  # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n '
-    /^DEP_FILES = .*\\\\$/ {
-      s/^DEP_FILES = //
-      :loop
-	s/\\\\$//
-	p
-	n
-	/\\\\$/ b loop
-      p
-    }
-    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
     # Make sure the directory exists.
     test -f "$dirpart/$file" && continue
@@ -6317,55 +6256,32 @@
      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
 ])
 
-# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+# serial 8
 
-# 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.
-
-# serial 7
-
 # AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
 AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 
-# Do all the work for Automake.                            -*- Autoconf -*-
+# Do all the work for Automake.                             -*- Autoconf -*-
 
-# This macro actually does too much some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 12
 
-# 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.
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
 
-# 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.
-
-# serial 11
-
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
@@ -6422,7 +6338,6 @@
 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
 AM_MISSING_PROG(AUTOHEADER, autoheader)
 AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_MISSING_PROG(AMTAR, tar)
 AM_PROG_INSTALL_SH
 AM_PROG_INSTALL_STRIP
 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
@@ -6431,7 +6346,9 @@
 AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
                   [_AM_DEPENDENCIES(CC)],
@@ -6465,52 +6382,28 @@
 done
 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
 
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
-
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-
-# 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.
-
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 install_sh=${install_sh-"$am_aux_dir/install-sh"}
 AC_SUBST(install_sh)])
 
-#                                                          -*- Autoconf -*-
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 2
 
-# 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.
-
-# serial 1
-
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -6524,29 +6417,18 @@
 rmdir .tst 2>/dev/null
 AC_SUBST([am__leading_dot])])
 
-# Add --enable-maintainer-mode option to configure.
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 4
 
-# 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.
-
-# serial 3
-
 AC_DEFUN([AM_MAINTAINER_MODE],
 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode is disabled by default
@@ -6564,27 +6446,16 @@
 
 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
 
-# Check to see how 'make' treats includes.	-*- Autoconf -*-
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 3
 
-# 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.
-
-# serial 2
-
 # AM_MAKE_INCLUDE()
 # -----------------
 # Check to see how make treats includes.
@@ -6627,28 +6498,17 @@
 rm -f confinc confmf
 ])
 
-#  -*- Autoconf -*-
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+# serial 4
 
-# 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.
-
-# serial 3
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -6673,27 +6533,16 @@
 fi
 ])
 
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
 # AM_PROG_MKDIR_P
 # ---------------
 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-
-# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-# 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.
-
+#
 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
 # created by `make install' are always world readable, even if the
 # installer happens to have an overly restrictive umask (e.g. 077).
@@ -6714,13 +6563,21 @@
 # this.)
 AC_DEFUN([AM_PROG_MKDIR_P],
 [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # Keeping the `.' argument allows $(mkdir_p) to be used without
-  # argument.  Indeed, we sometimes output rules like
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
   #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.
-  # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
-  # expensive solution, as it forces Make to start a sub-shell.)
-  mkdir_p='mkdir -p -- .'
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
 else
   # On NextStep and OpenStep, the `mkdir' command does not
   # recognize any option.  It will interpret all options as
@@ -6739,27 +6596,16 @@
 fi
 AC_SUBST([mkdir_p])])
 
-# Helper functions for option handling.                    -*- Autoconf -*-
+# Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 3
 
-# 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.
-
-# serial 2
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
@@ -6783,27 +6629,15 @@
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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.
+# serial 4
 
-# 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.
-
-# serial 3
-
 AC_DEFUN([AM_C_PROTOTYPES],
 [AC_REQUIRE([AC_C_PROTOTYPES])
 if test "$ac_cv_prog_cc_stdc" != no; then
@@ -6820,29 +6654,17 @@
 
 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
 
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
 #
-# Check to make sure that the build environment is sane.
-#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+# serial 4
 
-# 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.
-
-# serial 3
-
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
@@ -6884,25 +6706,14 @@
 fi
 AC_MSG_RESULT(yes)])
 
-# AM_PROG_INSTALL_STRIP
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-
-# 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.
-
+# AM_PROG_INSTALL_STRIP
+# ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
@@ -6923,4 +6734,100 @@
 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
 m4_include([acinclude.m4])

Modified: packages/libxml2/trunk/autogen.sh
===================================================================
--- packages/libxml2/trunk/autogen.sh	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/autogen.sh	2005-09-13 16:06:20 UTC (rev 478)
@@ -4,7 +4,7 @@
 ## refreshes doc/examples/index.html
 ## For use in root directory of the build tree ONLY.
 ## ----------------------------------------------------------------------
-## Requires: autoconf (2.5x), automake1.8, libtool (1.5.x), xsltproc,
+## Requires: autoconf (2.5x), automake1.9, libtool (1.5.x), xsltproc,
 ## libxml2-utils
 ## ----------------------------------------------------------------------
 
@@ -15,13 +15,13 @@
 libtoolize --force --copy
 
 ## ----------------------------------------------------------------------
-aclocal-1.8
+aclocal-1.9
 
 ## ----------------------------------------------------------------------
 autoheader
 
 ## ----------------------------------------------------------------------
-automake-1.8 --foreign --add-missing --force-missing --copy
+automake-1.9 --foreign --add-missing --force-missing --copy
 
 ## ----------------------------------------------------------------------
 autoconf

Modified: packages/libxml2/trunk/configure
===================================================================
--- packages/libxml2/trunk/configure	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/configure	2005-09-13 16:06:20 UTC (rev 478)
@@ -463,7 +463,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBXML_MAJOR_VERSION LIBXML_MINOR_VERSION LIBXML_MICRO_VERSION LIBXML_VERSION LIBXML_VERSION_INFO LIBXML_VERSION_NUMBER LIBXML_VERSION_EXTRA INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP RM MV TAR PERL XMLLINT XSLTPROC EGREP U ANSI2KNR LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT HTML_DIR Z_CFLAGS Z_LIBS PYTHON WITH_PYTHON_TRUE WITH_PYTHON_FALSE pythondir PYTHON_SUBDIR WITH_MODULES MODULE_PLATFORM_LIBS MODULE_EXTENSION TEST_MODULES STATIC_BINARIES WITH_TRIO_SOURCES_TRUE WITH_TRIO_SOURCES_FALSE WITH_TRIO THREAD_LIBS BASE_THREAD_LIBS WITH_THREADS THREAD_CFLAGS TEST_THREADS THREADS_W32 WITH_TREE WITH_FTP FTP_OBJ WITH_HTTP HTTP_OBJ WITH_LEGACY WITH_READER READER_TEST WITH_WRITER WITH_PATTERN TEST_PATTERN WITH_SAX1 TEST_SAX WITH_PUSH TEST_PUSH WITH_HTML HTML_OBJ TEST_HTML TEST_PHTML WITH_VALID TEST_VALID TEST_VTIME WITH_CATALOG CATALOG_OBJ TEST_CATALOG WITH_DOCB DOCB_OBJ WITH_XPTR XPTR_OBJ TEST_XPTR WITH_C14N C14N_OBJ TEST_C14N WITH_XINCLUDE XINCLUDE_OBJ TEST_XINCLUDE WITH_XPATH XPATH_OBJ TEST_XPATH WITH_OUTPUT WITH_ICONV WITH_ISO8859X WITH_SCHEMATRON TEST_SCHEMATRON WITH_SCHEMAS TEST_SCHEMAS WITH_REGEXPS TEST_REGEXPS WITH_DEBUG DEBUG_OBJ TEST_DEBUG WITH_MEM_DEBUG WITH_RUN_DEBUG WIN32_EXTRA_LIBADD WIN32_EXTRA_LDFLAGS CYGWIN_EXTRA_LDFLAGS CYGWIN_EXTRA_PYTHON_LIBADD XML_CFLAGS XML_LIBDIR XML_LIBS XML_LIBTOOLLIBS ICONV_LIBS XML_INCLUDEDIR HAVE_ISNAN HAVE_ISINF PYTHON_VERSION PYTHON_INCLUDES PYTHON_SITE_PACKAGES M_LIBS RDL_LIBS RELDATE PYTHON_TESTS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBXML_MAJOR_VERSION LIBXML_MINOR_VERSION LIBXML_MICRO_VERSION LIBXML_VERSION LIBXML_VERSION_INFO LIBXML_VERSION_NUMBER LIBXML_VERSION_EXTRA INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP RM MV TAR PERL XMLLINT XSLTPROC EGREP U ANSI2KNR LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT HTML_DIR Z_CFLAGS Z_LIBS PYTHON WITH_PYTHON_TRUE WITH_PYTHON_FALSE pythondir PYTHON_SUBDIR WITH_MODULES MODULE_PLATFORM_LIBS MODULE_EXTENSION TEST_MODULES STATIC_BINARIES WITH_TRIO_SOURCES_TRUE WITH_TRIO_SOURCES_FALSE WITH_TRIO THREAD_LIBS BASE_THREAD_LIBS WITH_THREADS THREAD_CFLAGS TEST_THREADS THREADS_W32 WITH_TREE WITH_FTP FTP_OBJ WITH_HTTP HTTP_OBJ WITH_LEGACY WITH_READER READER_TEST WITH_WRITER WITH_PATTERN TEST_PATTERN WITH_SAX1 TEST_SAX WITH_PUSH TEST_PUSH WITH_HTML HTML_OBJ TEST_HTML TEST_PHTML WITH_VALID TEST_VALID TEST_VTIME WITH_CATALOG CATALOG_OBJ TEST_CATALOG WITH_DOCB DOCB_OBJ WITH_XPTR XPTR_OBJ TEST_XPTR WITH_C14N C14N_OBJ TEST_C14N WITH_XINCLUDE XINCLUDE_OBJ TEST_XINCLUDE WITH_XPATH XPATH_OBJ TEST_XPATH WITH_OUTPUT WITH_ICONV WITH_ISO8859X WITH_SCHEMATRON TEST_SCHEMATRON WITH_SCHEMAS TEST_SCHEMAS WITH_REGEXPS TEST_REGEXPS WITH_DEBUG DEBUG_OBJ TEST_DEBUG WITH_MEM_DEBUG WITH_RUN_DEBUG WIN32_EXTRA_LIBADD WIN32_EXTRA_LDFLAGS CYGWIN_EXTRA_LDFLAGS CYGWIN_EXTRA_PYTHON_LIBADD XML_CFLAGS XML_LIBDIR XML_LIBS XML_LIBTOOLLIBS ICONV_LIBS XML_INCLUDEDIR HAVE_ISNAN HAVE_ISINF PYTHON_VERSION PYTHON_INCLUDES PYTHON_SITE_PACKAGES M_LIBS RDL_LIBS RELDATE PYTHON_TESTS LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1620,7 +1620,7 @@
 
 LIBXML_MAJOR_VERSION=2
 LIBXML_MINOR_VERSION=6
-LIBXML_MICRO_VERSION=21
+LIBXML_MICRO_VERSION=22
 LIBXML_MICRO_VERSION_SUFFIX=
 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -1645,7 +1645,7 @@
 
 VERSION=${LIBXML_VERSION}
 
-am__api_version="1.8"
+am__api_version="1.9"
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
@@ -1797,13 +1797,21 @@
 fi
 
 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # Keeping the `.' argument allows $(mkdir_p) to be used without
-  # argument.  Indeed, we sometimes output rules like
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
   #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.
-  # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
-  # expensive solution, as it forces Make to start a sub-shell.)
-  mkdir_p='mkdir -p -- .'
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
 else
   # On NextStep and OpenStep, the `mkdir' command does not
   # recognize any option.  It will interpret all options as
@@ -1947,9 +1955,6 @@
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
 install_sh=${install_sh-"$am_aux_dir/install-sh"}
 
 # Installed binaries are usually stripped using `strip' when the user
@@ -2042,10 +2047,17 @@
 
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
+# Always define AMTAR for backward compatibility.
 
+AMTAR=${AMTAR-"${am_missing_run}tar"}
 
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 
+
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4664,7 +4676,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4667 "configure"' > conftest.$ac_ext
+  echo '#line 4679 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5999,7 +6011,7 @@
 
 
 # Provide some information about the compiler.
-echo "$as_me:6002:" \
+echo "$as_me:6014:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -7031,11 +7043,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7034: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7046: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7038: \$? = $ac_status" >&5
+   echo "$as_me:7050: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -7264,11 +7276,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7267: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7279: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7271: \$? = $ac_status" >&5
+   echo "$as_me:7283: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -7324,11 +7336,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7327: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7339: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7331: \$? = $ac_status" >&5
+   echo "$as_me:7343: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9512,7 +9524,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9515 "configure"
+#line 9527 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9610,7 +9622,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9613 "configure"
+#line 9625 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11787,11 +11799,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11790: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11802: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11794: \$? = $ac_status" >&5
+   echo "$as_me:11806: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -11847,11 +11859,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11850: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11862: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11854: \$? = $ac_status" >&5
+   echo "$as_me:11866: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13216,7 +13228,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13219 "configure"
+#line 13231 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13314,7 +13326,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13317 "configure"
+#line 13329 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14141,11 +14153,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14144: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14156: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14148: \$? = $ac_status" >&5
+   echo "$as_me:14160: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -14201,11 +14213,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14204: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14216: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14208: \$? = $ac_status" >&5
+   echo "$as_me:14220: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16246,11 +16258,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16249: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16261: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16253: \$? = $ac_status" >&5
+   echo "$as_me:16265: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -16479,11 +16491,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16482: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16494: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16486: \$? = $ac_status" >&5
+   echo "$as_me:16498: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -16539,11 +16551,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16542: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16554: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16546: \$? = $ac_status" >&5
+   echo "$as_me:16558: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18727,7 +18739,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 18730 "configure"
+#line 18742 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18825,7 +18837,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 18828 "configure"
+#line 18840 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -26582,7 +26594,7 @@
 echo "$as_me:$LINENO: checking for type of socket length (socklen_t)" >&5
 echo $ECHO_N "checking for type of socket length (socklen_t)... $ECHO_C" >&6
 cat > conftest.$ac_ext <<EOF
-#line 26585 "configure"
+#line 26597 "configure"
 #include "confdefs.h"
 
 #include <stddef.h>
@@ -26593,7 +26605,7 @@
 (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)
 ; return 0; }
 EOF
-if { (eval echo configure:26596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
+if { (eval echo configure:26608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
   rm -rf conftest*
 
   echo "$as_me:$LINENO: result: socklen_t *" >&5
@@ -26605,7 +26617,7 @@
   rm -rf conftest*
 
   cat > conftest.$ac_ext <<EOF
-#line 26608 "configure"
+#line 26620 "configure"
 #include "confdefs.h"
 
 #include <stddef.h>
@@ -26616,7 +26628,7 @@
 (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)
 ; return 0; }
 EOF
-if { (eval echo configure:26619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
+if { (eval echo configure:26631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
   rm -rf conftest*
 
     echo "$as_me:$LINENO: result: size_t *" >&5
@@ -26628,7 +26640,7 @@
   rm -rf conftest*
 
     cat > conftest.$ac_ext <<EOF
-#line 26631 "configure"
+#line 26643 "configure"
 #include "confdefs.h"
 
 #include <stddef.h>
@@ -26639,7 +26651,7 @@
 (void)getsockopt (1, 1, 1, NULL, (int *)NULL)
 ; return 0; }
 EOF
-if { (eval echo configure:26642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
+if { (eval echo configure:26654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
   rm -rf conftest*
 
       echo "$as_me:$LINENO: result: int *" >&5
@@ -29318,7 +29330,7 @@
 ln -s Copyright COPYING
 
 # keep on one line for cygwin c.f. #130896
-                                                                                                                                                      ac_config_files="$ac_config_files libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py"
+                                                                                                                                                                ac_config_files="$ac_config_files libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -29902,6 +29914,7 @@
   "include/libxml/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/libxml/Makefile" ;;
   "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
   "doc/examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/examples/Makefile" ;;
+  "doc/devhelp/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/devhelp/Makefile" ;;
   "example/Makefile" ) CONFIG_FILES="$CONFIG_FILES example/Makefile" ;;
   "python/Makefile" ) CONFIG_FILES="$CONFIG_FILES python/Makefile" ;;
   "python/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES python/tests/Makefile" ;;
@@ -30024,7 +30037,6 @@
 s, at AUTOMAKE@,$AUTOMAKE,;t t
 s, at AUTOHEADER@,$AUTOHEADER,;t t
 s, at MAKEINFO@,$MAKEINFO,;t t
-s, at AMTAR@,$AMTAR,;t t
 s, at install_sh@,$install_sh,;t t
 s, at STRIP@,$STRIP,;t t
 s, at ac_ct_STRIP@,$ac_ct_STRIP,;t t
@@ -30033,6 +30045,9 @@
 s, at AWK@,$AWK,;t t
 s, at SET_MAKE@,$SET_MAKE,;t t
 s, at am__leading_dot@,$am__leading_dot,;t t
+s, at AMTAR@,$AMTAR,;t t
+s, at am__tar@,$am__tar,;t t
+s, at am__untar@,$am__untar,;t t
 s, at CC@,$CC,;t t
 s, at CFLAGS@,$CFLAGS,;t t
 s, at LDFLAGS@,$LDFLAGS,;t t
@@ -30804,27 +30819,21 @@
   else
     continue
   fi
-  grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
-  # Extract the definition of DEP_FILES from the Makefile without
-  # running `make'.
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
   DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
   test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
   # When using ansi2knr, U may be empty or an underscore; expand it
   U=`sed -n 's/^U = //p' < "$mf"`
-  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
-  # We invoke sed twice because it is the simplest approach to
-  # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n '
-    /^DEP_FILES = .*\\\\$/ {
-      s/^DEP_FILES = //
-      :loop
-	s/\\\\$//
-	p
-	n
-	/\\\\$/ b loop
-      p
-    }
-    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
     # Make sure the directory exists.
     test -f "$dirpart/$file" && continue

Modified: packages/libxml2/trunk/configure.in
===================================================================
--- packages/libxml2/trunk/configure.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/configure.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -5,7 +5,7 @@
 
 LIBXML_MAJOR_VERSION=2
 LIBXML_MINOR_VERSION=6
-LIBXML_MICRO_VERSION=21
+LIBXML_MICRO_VERSION=22
 LIBXML_MICRO_VERSION_SUFFIX=
 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
 LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -1317,6 +1317,6 @@
 ln -s Copyright COPYING
 
 # keep on one line for cygwin c.f. #130896
-AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
+AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
 
 chmod +x xml2-config python/setup.py

Modified: packages/libxml2/trunk/debian/changelog
===================================================================
--- packages/libxml2/trunk/debian/changelog	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/debian/changelog	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,3 +1,12 @@
+libxml2 (2.6.22-1) unstable; urgency=low
+
+  * New upstream release
+  * error.c: Reenable support of validation errors in structured error
+    handler.
+  * autogen.sh: Use automake1.9, as upstream does, and run it.
+
+ -- Mike Hommey <glandium at debian.org>  Tue, 13 Sep 2005 18:04:10 +0200
+
 libxml2 (2.6.21-1) unstable; urgency=low
 
   * New upstream release

Modified: packages/libxml2/trunk/debugXML.c
===================================================================
--- packages/libxml2/trunk/debugXML.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/debugXML.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -1065,7 +1065,8 @@
         return;
     }
     xmlCtxtDumpOneNode(ctxt, node);
-    if ((node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
+    if ((node->type != XML_NAMESPACE_DECL) && 
+        (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
         ctxt->depth++;
         xmlCtxtDumpNodeList(ctxt, node->children);
         ctxt->depth--;

Modified: packages/libxml2/trunk/depcomp
===================================================================
--- packages/libxml2/trunk/depcomp	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/depcomp	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2004-04-25.13
+scriptversion=2005-07-09.11
 
-# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 # 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
@@ -17,8 +17,8 @@
 
 # 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -43,17 +43,18 @@
   depmode     Dependency tracking mode.
   source      Source file read by `PROGRAMS ARGS'.
   object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
   tmpdepfile  Temporary file to use when outputing dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake at gnu.org>.
 EOF
-    exit 0
+    exit $?
     ;;
   -v | --v*)
     echo "depcomp $scriptversion"
-    exit 0
+    exit $?
     ;;
 esac
 
@@ -61,18 +62,10 @@
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
 fi
-# `libtool' can also be set to `yes' or `no'.
 
-if test -z "$depfile"; then
-   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
-   dir=`echo "$object" | sed 's,/.*$,/,'`
-   if test "$dir" = "$object"; then
-      dir=
-   fi
-   # FIXME: should be _deps on DOS.
-   depfile="$dir.deps/$base"
-fi
-
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
@@ -294,33 +287,43 @@
    base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 
    if test "$libtool" = yes; then
-      # Dependencies are output in .lo.d with libtool 1.4.
-      # They are output in .o.d with libtool 1.5.
-      tmpdepfile1="$dir.libs/$base.lo.d"
-      tmpdepfile2="$dir.libs/$base.o.d"
-      tmpdepfile3="$dir.libs/$base.d"
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
       "$@" -Wc,-MD
    else
-      tmpdepfile1="$dir$base.o.d"
-      tmpdepfile2="$dir$base.d"
-      tmpdepfile3="$dir$base.d"
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
       "$@" -MD
    fi
 
    stat=$?
    if test $stat -eq 0; then :
    else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
       exit $stat
    fi
 
-   if test -f "$tmpdepfile1"; then
-      tmpdepfile="$tmpdepfile1"
-   elif test -f "$tmpdepfile2"; then
-      tmpdepfile="$tmpdepfile2"
-   else
-      tmpdepfile="$tmpdepfile3"
-   fi
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
    if test -f "$tmpdepfile"; then
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
       # That's a tab and a space in the [].
@@ -464,7 +467,8 @@
   done
 
   "$@" -E |
-    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
     sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"

Modified: packages/libxml2/trunk/doc/APIchunk10.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk10.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk10.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -415,6 +415,7 @@
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ANYATTR_SKIP">XML_SCHEMAS_ANYATTR_SKIP</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ANYATTR_STRICT">XML_SCHEMAS_ANYATTR_STRICT</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_NSDEFAULT">XML_SCHEMAS_ELEM_NSDEFAULT</a><br />
+<a href="html/libxml-schemasInternals.html#_xmlSchema">_xmlSchema</a><br />
 <a href="html/libxml-parserInternals.html#xmlNamespaceParseNCName">xmlNamespaceParseNCName</a><br />
 <a href="html/libxml-parserInternals.html#xmlNamespaceParseNSDef">xmlNamespaceParseNSDef</a><br />
 <a href="html/libxml-parserInternals.html#xmlNamespaceParseQName">xmlNamespaceParseQName</a><br />
@@ -529,6 +530,7 @@
 <a href="html/libxml-tree.html#_xmlRef">_xmlRef</a><br />
 </dd><dt>attribute-list</dt><dd><a href="html/libxml-parserInternals.html#xmlParseDefaultDecl">xmlParseDefaultDecl</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseEntityRef">xmlParseEntityRef</a><br />
+</dd><dt>attributeFormDefault</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ATTR">XML_SCHEMAS_QUALIF_ATTR</a><br />
 </dd><dt>augmented</dt><dd><a href="html/libxml-DOCBparser.html#docbParseDocument">docbParseDocument</a><br />
 <a href="html/libxml-HTMLparser.html#htmlParseDocument">htmlParseDocument</a><br />
 <a href="html/libxml-parser.html#xmlParseDocument">xmlParseDocument</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk14.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk14.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk14.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -73,6 +73,7 @@
 </dd><dt>element-</dt><dd><a href="html/libxml-xpath.html#xmlXPathOrderDocElems">xmlXPathOrderDocElems</a><br />
 </dd><dt>element-node</dt><dd><a href="html/libxml-tree.html#xmlDOMWrapReconcileNamespaces">xmlDOMWrapReconcileNamespaces</a><br />
 </dd><dt>element-nodes</dt><dd><a href="html/libxml-tree.html#xmlDOMWrapReconcileNamespaces">xmlDOMWrapReconcileNamespaces</a><br />
+</dd><dt>elementFormDefault</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ELEM">XML_SCHEMAS_QUALIF_ELEM</a><br />
 </dd><dt>elementdecl</dt><dd><a href="html/libxml-parserInternals.html#xmlParseElementDecl">xmlParseElementDecl</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseMarkupDecl">xmlParseMarkupDecl</a><br />
 </dd><dt>elements</dt><dd><a href="html/libxml-catalog.html#XML_CATALOGS_NAMESPACE">XML_CATALOGS_NAMESPACE</a><br />
@@ -80,7 +81,6 @@
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ATTR_GLOBAL">XML_SCHEMAS_ATTR_GLOBAL</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ATTR_NSDEFAULT">XML_SCHEMAS_ATTR_NSDEFAULT</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_NSDEFAULT">XML_SCHEMAS_ELEM_NSDEFAULT</a><br />
-<a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ELEM">XML_SCHEMAS_QUALIF_ELEM</a><br />
 <a href="html/libxml-tree.html#_xmlDtd">_xmlDtd</a><br />
 <a href="html/libxml-HTMLparser.html#htmlElementAllowedHere">htmlElementAllowedHere</a><br />
 <a href="html/libxml-HTMLparser.html#htmlNodeStatus">htmlNodeStatus</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk15.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk15.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk15.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -190,6 +190,7 @@
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_FIXED">XML_SCHEMAS_ELEM_FIXED</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseDefaultDecl">xmlParseDefaultDecl</a><br />
 <a href="html/libxml-xmlschemastypes.html#xmlSchemaGetCanonValue">xmlSchemaGetCanonValue</a><br />
+</dd><dt>fixup</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FIXUP_1">XML_SCHEMAS_TYPE_FIXUP_1</a><br />
 </dd><dt>flag</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_CIRCULAR">XML_SCHEMAS_ELEM_CIRCULAR</a><br />
 <a href="html/libxml-HTMLtree.html#htmlSetMetaEncoding">htmlSetMetaEncoding</a><br />
 <a href="html/libxml-SAX.html#initxmlDefaultSAXHandler">initxmlDefaultSAXHandler</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk16.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk16.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk16.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -261,7 +261,6 @@
 <a href="html/libxml-nanohttp.html#xmlNanoHTTPMimeType">xmlNanoHTTPMimeType</a><br />
 </dd><dt>heading</dt><dd><a href="html/libxml-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a><br />
 </dd><dt>helper</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_CIRCULAR">XML_SCHEMAS_ELEM_CIRCULAR</a><br />
-<a href="html/libxml-schemasInternals.html#_xmlSchema">_xmlSchema</a><br />
 </dd><dt>here</dt><dd><a href="html/libxml-xpath.html#_xmlXPathContext">_xmlXPathContext</a><br />
 <a href="html/libxml-HTMLparser.html#htmlNodeStatus">htmlNodeStatus</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseAttValue">xmlParseAttValue</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk17.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk17.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk17.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -525,8 +525,7 @@
 <a href="html/libxml-nanoftp.html#xmlNanoFTPDele">xmlNanoFTPDele</a><br />
 <a href="html/libxml-xmlschemastypes.html#xmlSchemaGetBuiltInListSimpleTypeItemType">xmlSchemaGetBuiltInListSimpleTypeItemType</a><br />
 <a href="html/libxml-xpath.html#xmlXPathNodeSetItem">xmlXPathNodeSetItem</a><br />
-</dd><dt>items</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchema">_xmlSchema</a><br />
-<a href="html/libxml-xpathInternals.html#valuePush">valuePush</a><br />
+</dd><dt>items</dt><dd><a href="html/libxml-xpathInternals.html#valuePush">valuePush</a><br />
 <a href="html/libxml-hash.html#xmlHashCopy">xmlHashCopy</a><br />
 <a href="html/libxml-hash.html#xmlHashFree">xmlHashFree</a><br />
 <a href="html/libxml-hash.html#xmlHashScan">xmlHashScan</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk2.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk2.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk2.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -133,7 +133,8 @@
 </dd><dt>DefaultDecl</dt><dd><a href="html/libxml-parserInternals.html#xmlParseAttributeListDecl">xmlParseAttributeListDecl</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseDefaultDecl">xmlParseDefaultDecl</a><br />
 </dd><dt>Deletes</dt><dd><a href="html/libxml-list.html#xmlListDelete">xmlListDelete</a><br />
-</dd><dt>Deprecated</dt><dd><a href="html/libxml-HTMLparser.html#htmlAttrAllowed">htmlAttrAllowed</a><br />
+</dd><dt>Deprecated</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchema">_xmlSchema</a><br />
+<a href="html/libxml-HTMLparser.html#htmlAttrAllowed">htmlAttrAllowed</a><br />
 <a href="html/libxml-entities.html#xmlCleanupPredefinedEntities">xmlCleanupPredefinedEntities</a><br />
 <a href="html/libxml-valid.html#xmlCopyElementContent">xmlCopyElementContent</a><br />
 <a href="html/libxml-valid.html#xmlFreeElementContent">xmlFreeElementContent</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk23.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk23.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk23.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -212,6 +212,7 @@
 </dd><dt>recursively</dt><dd><a href="html/libxml-catalog.html#xmlLoadACatalog">xmlLoadACatalog</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseAttValue">xmlParseAttValue</a><br />
 </dd><dt>redeclared</dt><dd><a href="html/libxml-tree.html#xmlReconciliateNs">xmlReconciliateNs</a><br />
+</dd><dt>redef</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchemaAttributeGroup">_xmlSchemaAttributeGroup</a><br />
 </dd><dt>redefinition</dt><dd><a href="html/libxml-parserInternals.html#xmlErrMemory">xmlErrMemory</a><br />
 </dd><dt>redefinitions</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchemaType">_xmlSchemaType</a><br />
 </dd><dt>redir</dt><dd><a href="html/libxml-nanohttp.html#xmlNanoHTTPMethodRedir">xmlNanoHTTPMethodRedir</a><br />
@@ -451,9 +452,7 @@
 <a href="html/libxml-xmlschemastypes.html#xmlSchemaCollapseString">xmlSchemaCollapseString</a><br />
 <a href="html/libxml-xmlschemastypes.html#xmlSchemaWhiteSpaceReplace">xmlSchemaWhiteSpaceReplace</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathStringFunction">xmlXPathStringFunction</a><br />
-</dd><dt>requires</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ATTR">XML_SCHEMAS_QUALIF_ATTR</a><br />
-<a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ELEM">XML_SCHEMAS_QUALIF_ELEM</a><br />
-<a href="html/libxml-HTMLparser.html#_htmlElemDesc">_htmlElemDesc</a><br />
+</dd><dt>requires</dt><dd><a href="html/libxml-HTMLparser.html#_htmlElemDesc">_htmlElemDesc</a><br />
 <a href="html/libxml-c14n.html#xmlC14NDocSaveTo">xmlC14NDocSaveTo</a><br />
 <a href="html/libxml-c14n.html#xmlC14NExecute">xmlC14NExecute</a><br />
 <a href="html/libxml-tree.html#xmlGetLineNo">xmlGetLineNo</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk24.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk24.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk24.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -502,6 +502,7 @@
 </dd><dt>split</dt><dd><a href="html/libxml-xpathInternals.html#xmlXPathIdFunction">xmlXPathIdFunction</a><br />
 </dd><dt>stacked</dt><dd><a href="html/libxml-xpath.html#_xmlXPathParserContext">_xmlXPathParserContext</a><br />
 <a href="html/libxml-parserInternals.html#xmlPushInput">xmlPushInput</a><br />
+</dd><dt>stage</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FIXUP_1">XML_SCHEMAS_TYPE_FIXUP_1</a><br />
 </dd><dt>stamps</dt><dd><a href="html/libxml-xpath.html#xmlXPathOrderDocElems">xmlXPathOrderDocElems</a><br />
 </dd><dt>standalone</dt><dd><a href="html/libxml-tree.html#_xmlDoc">_xmlDoc</a><br />
 <a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk28.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk28.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk28.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -390,6 +390,7 @@
 </dd><dt>xmlSaveOptions</dt><dd><a href="html/libxml-xmlsave.html#xmlSaveToFd">xmlSaveToFd</a><br />
 <a href="html/libxml-xmlsave.html#xmlSaveToFilename">xmlSaveToFilename</a><br />
 <a href="html/libxml-xmlsave.html#xmlSaveToIO">xmlSaveToIO</a><br />
+</dd><dt>xmlSchemaAttributeGroupPtr</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchemaAttributeGroup">_xmlSchemaAttributeGroup</a><br />
 </dd><dt>xmlSchemaSAXPlug</dt><dd><a href="html/libxml-xmlschemas.html#xmlSchemaSAXUnplug">xmlSchemaSAXUnplug</a><br />
 </dd><dt>xmlSchemaValType</dt><dd><a href="html/libxml-xmlschemastypes.html#xmlSchemaGetValType">xmlSchemaGetValType</a><br />
 </dd><dt>xmlSchemaValidOption</dt><dd><a href="html/libxml-xmlschemas.html#xmlSchemaSetValidOptions">xmlSchemaSetValidOptions</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk3.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk3.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk3.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -73,7 +73,8 @@
 <a href="html/libxml-parser.html#xmlParserFindNodeInfo">xmlParserFindNodeInfo</a><br />
 <a href="html/libxml-parser.html#xmlParserFindNodeInfoIndex">xmlParserFindNodeInfoIndex</a><br />
 </dd><dt>Finds</dt><dd><a href="html/libxml-xmlregexp.html#xmlExpIsNillable">xmlExpIsNillable</a><br />
-</dd><dt>First</dt><dd><a href="html/libxml-entities.html#_xmlEntity">_xmlEntity</a><br />
+</dd><dt>First</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FIXUP_1">XML_SCHEMAS_TYPE_FIXUP_1</a><br />
+<a href="html/libxml-entities.html#_xmlEntity">_xmlEntity</a><br />
 </dd><dt>Fixed</dt><dd><a href="html/libxml-parserInternals.html#xmlParseDefaultDecl">xmlParseDefaultDecl</a><br />
 <a href="html/libxml-valid.html#xmlValidateOneAttribute">xmlValidateOneAttribute</a><br />
 <a href="html/libxml-valid.html#xmlValidateOneNamespace">xmlValidateOneNamespace</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk4.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk4.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk4.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -143,8 +143,7 @@
 </dd><dt>Method</dt><dd><a href="html/libxml-xmlreader.html#xmlTextReaderGetRemainder">xmlTextReaderGetRemainder</a><br />
 </dd><dt>Mime-Type</dt><dd><a href="html/libxml-nanohttp.html#xmlNanoHTTPMimeType">xmlNanoHTTPMimeType</a><br />
 </dd><dt>Minimal</dt><dd><a href="html/libxml-xmlregexp.html#xmlExpParse">xmlExpParse</a><br />
-</dd><dt>Misc</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchema">_xmlSchema</a><br />
-<a href="html/libxml-parser.html#xmlParseDocument">xmlParseDocument</a><br />
+</dd><dt>Misc</dt><dd><a href="html/libxml-parser.html#xmlParseDocument">xmlParseDocument</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseMisc">xmlParseMisc</a><br />
 </dd><dt>MiscellaneousMathematicalSymbols-A</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsMiscellaneousMathematicalSymbolsA">xmlUCSIsMiscellaneousMathematicalSymbolsA</a><br />
 </dd><dt>MiscellaneousMathematicalSymbols-B</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsMiscellaneousMathematicalSymbolsB">xmlUCSIsMiscellaneousMathematicalSymbolsB</a><br />

Modified: packages/libxml2/trunk/doc/APIchunk6.html
===================================================================
--- packages/libxml2/trunk/doc/APIchunk6.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIchunk6.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -109,6 +109,7 @@
 </dd><dt>Recurse</dt><dd><a href="html/libxml-tree.html#xmlSearchNsByHref">xmlSearchNsByHref</a><br />
 </dd><dt>Recursion</dt><dd><a href="html/libxml-parserInternals.html#xmlParsePEReference">xmlParsePEReference</a><br />
 <a href="html/libxml-parserInternals.html#xmlParserHandlePEReference">xmlParserHandlePEReference</a><br />
+</dd><dt>Redefinitions</dt><dd><a href="html/libxml-schemasInternals.html#_xmlSchemaAttributeGroup">_xmlSchemaAttributeGroup</a><br />
 </dd><dt>Ref</dt><dd><a href="html/libxml-tree.html#_xmlRef">_xmlRef</a><br />
 <a href="html/libxml-valid.html#xmlAddRef">xmlAddRef</a><br />
 <a href="html/libxml-valid.html#xmlFreeRefTable">xmlFreeRefTable</a><br />
@@ -130,6 +131,8 @@
 </dd><dt>Reference:</dt><dd><a href="html/libxml-xmlreader.html#xmlTextReaderNodeType">xmlTextReaderNodeType</a><br />
 </dd><dt>References</dt><dd><a href="html/libxml-uri.html#xmlBuildURI">xmlBuildURI</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseAttribute">xmlParseAttribute</a><br />
+</dd><dt>Reflects</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ATTR">XML_SCHEMAS_QUALIF_ATTR</a><br />
+<a href="html/libxml-schemasInternals.html#XML_SCHEMAS_QUALIF_ELEM">XML_SCHEMAS_QUALIF_ELEM</a><br />
 </dd><dt>Refresh</dt><dd><a href="html/libxml-xmlIO.html#xmlParserInputBufferRead">xmlParserInputBufferRead</a><br />
 </dd><dt>Reg</dt><dd><a href="html/libxml-xmlautomata.html#xmlAutomataCompile">xmlAutomataCompile</a><br />
 </dd><dt>Register</dt><dd><a href="html/libxml-valid.html#xmlAddAttributeDecl">xmlAddAttributeDecl</a><br />

Modified: packages/libxml2/trunk/doc/APIfiles.html
===================================================================
--- packages/libxml2/trunk/doc/APIfiles.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIfiles.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -576,37 +576,6 @@
 </p><h2><a name="parser" id="parser">Module parser</a>:</h2><p><a href="html/libxml-parser.html#XML_COMPLETE_ATTRS">XML_COMPLETE_ATTRS</a><br />
 <a href="html/libxml-parser.html#XML_DEFAULT_VERSION">XML_DEFAULT_VERSION</a><br />
 <a href="html/libxml-parser.html#XML_DETECT_IDS">XML_DETECT_IDS</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_AUTOMATA">XML_FEATURE_AUTOMATA</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_C14N">XML_FEATURE_C14N</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_CATALOG">XML_FEATURE_CATALOG</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_DEBUG">XML_FEATURE_DEBUG</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_DEBUG_MEM">XML_FEATURE_DEBUG_MEM</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_DEBUG_RUN">XML_FEATURE_DEBUG_RUN</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_EXPR">XML_FEATURE_EXPR</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_FTP">XML_FEATURE_FTP</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_HTML">XML_FEATURE_HTML</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_HTTP">XML_FEATURE_HTTP</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_ICONV">XML_FEATURE_ICONV</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_ISO8859X">XML_FEATURE_ISO8859X</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_LEGACY">XML_FEATURE_LEGACY</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_MODULES">XML_FEATURE_MODULES</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_NONE">XML_FEATURE_NONE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_OUTPUT">XML_FEATURE_OUTPUT</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_PATTERN">XML_FEATURE_PATTERN</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_PUSH">XML_FEATURE_PUSH</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_READER">XML_FEATURE_READER</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_REGEXP">XML_FEATURE_REGEXP</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_SAX1">XML_FEATURE_SAX1</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_SCHEMAS">XML_FEATURE_SCHEMAS</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_SCHEMATRON">XML_FEATURE_SCHEMATRON</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_THREAD">XML_FEATURE_THREAD</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_TREE">XML_FEATURE_TREE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_UNICODE">XML_FEATURE_UNICODE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_VALID">XML_FEATURE_VALID</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_WRITER">XML_FEATURE_WRITER</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_XINCLUDE">XML_FEATURE_XINCLUDE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_XPATH">XML_FEATURE_XPATH</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_XPTR">XML_FEATURE_XPTR</a><br />
 <a href="html/libxml-parser.html#XML_PARSER_ATTRIBUTE_VALUE">XML_PARSER_ATTRIBUTE_VALUE</a><br />
 <a href="html/libxml-parser.html#XML_PARSER_CDATA_SECTION">XML_PARSER_CDATA_SECTION</a><br />
 <a href="html/libxml-parser.html#XML_PARSER_COMMENT">XML_PARSER_COMMENT</a><br />
@@ -650,6 +619,37 @@
 <a href="html/libxml-parser.html#XML_PARSE_XINCLUDE">XML_PARSE_XINCLUDE</a><br />
 <a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br />
 <a href="html/libxml-parser.html#XML_SKIP_IDS">XML_SKIP_IDS</a><br />
+<a href="html/libxml-parser.html#XML_WITH_AUTOMATA">XML_WITH_AUTOMATA</a><br />
+<a href="html/libxml-parser.html#XML_WITH_C14N">XML_WITH_C14N</a><br />
+<a href="html/libxml-parser.html#XML_WITH_CATALOG">XML_WITH_CATALOG</a><br />
+<a href="html/libxml-parser.html#XML_WITH_DEBUG">XML_WITH_DEBUG</a><br />
+<a href="html/libxml-parser.html#XML_WITH_DEBUG_MEM">XML_WITH_DEBUG_MEM</a><br />
+<a href="html/libxml-parser.html#XML_WITH_DEBUG_RUN">XML_WITH_DEBUG_RUN</a><br />
+<a href="html/libxml-parser.html#XML_WITH_EXPR">XML_WITH_EXPR</a><br />
+<a href="html/libxml-parser.html#XML_WITH_FTP">XML_WITH_FTP</a><br />
+<a href="html/libxml-parser.html#XML_WITH_HTML">XML_WITH_HTML</a><br />
+<a href="html/libxml-parser.html#XML_WITH_HTTP">XML_WITH_HTTP</a><br />
+<a href="html/libxml-parser.html#XML_WITH_ICONV">XML_WITH_ICONV</a><br />
+<a href="html/libxml-parser.html#XML_WITH_ISO8859X">XML_WITH_ISO8859X</a><br />
+<a href="html/libxml-parser.html#XML_WITH_LEGACY">XML_WITH_LEGACY</a><br />
+<a href="html/libxml-parser.html#XML_WITH_MODULES">XML_WITH_MODULES</a><br />
+<a href="html/libxml-parser.html#XML_WITH_NONE">XML_WITH_NONE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_OUTPUT">XML_WITH_OUTPUT</a><br />
+<a href="html/libxml-parser.html#XML_WITH_PATTERN">XML_WITH_PATTERN</a><br />
+<a href="html/libxml-parser.html#XML_WITH_PUSH">XML_WITH_PUSH</a><br />
+<a href="html/libxml-parser.html#XML_WITH_READER">XML_WITH_READER</a><br />
+<a href="html/libxml-parser.html#XML_WITH_REGEXP">XML_WITH_REGEXP</a><br />
+<a href="html/libxml-parser.html#XML_WITH_SAX1">XML_WITH_SAX1</a><br />
+<a href="html/libxml-parser.html#XML_WITH_SCHEMAS">XML_WITH_SCHEMAS</a><br />
+<a href="html/libxml-parser.html#XML_WITH_SCHEMATRON">XML_WITH_SCHEMATRON</a><br />
+<a href="html/libxml-parser.html#XML_WITH_THREAD">XML_WITH_THREAD</a><br />
+<a href="html/libxml-parser.html#XML_WITH_TREE">XML_WITH_TREE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_UNICODE">XML_WITH_UNICODE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_VALID">XML_WITH_VALID</a><br />
+<a href="html/libxml-parser.html#XML_WITH_WRITER">XML_WITH_WRITER</a><br />
+<a href="html/libxml-parser.html#XML_WITH_XINCLUDE">XML_WITH_XINCLUDE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_XPATH">XML_WITH_XPATH</a><br />
+<a href="html/libxml-parser.html#XML_WITH_XPTR">XML_WITH_XPTR</a><br />
 <a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
 <a href="html/libxml-parser.html#_xmlParserInput">_xmlParserInput</a><br />
 <a href="html/libxml-parser.html#_xmlParserNodeInfo">_xmlParserNodeInfo</a><br />
@@ -1094,6 +1094,7 @@
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FINAL_LIST">XML_SCHEMAS_TYPE_FINAL_LIST</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FINAL_RESTRICTION">XML_SCHEMAS_TYPE_FINAL_RESTRICTION</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FINAL_UNION">XML_SCHEMAS_TYPE_FINAL_UNION</a><br />
+<a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FIXUP_1">XML_SCHEMAS_TYPE_FIXUP_1</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_GLOBAL">XML_SCHEMAS_TYPE_GLOBAL</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_HAS_FACETS">XML_SCHEMAS_TYPE_HAS_FACETS</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_INTERNAL_INVALID">XML_SCHEMAS_TYPE_INTERNAL_INVALID</a><br />
@@ -2316,6 +2317,7 @@
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_ELEMENT_2_1">XML_SCHEMAP_SRC_ELEMENT_2_1</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_ELEMENT_2_2">XML_SCHEMAP_SRC_ELEMENT_2_2</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_ELEMENT_3">XML_SCHEMAP_SRC_ELEMENT_3</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT">XML_SCHEMAP_SRC_IMPORT</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT_1_1">XML_SCHEMAP_SRC_IMPORT_1_1</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT_1_2">XML_SCHEMAP_SRC_IMPORT_1_2</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT_2">XML_SCHEMAP_SRC_IMPORT_2</a><br />
@@ -2368,6 +2370,10 @@
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD">XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_UNKNOWN_TYPE">XML_SCHEMAP_UNKNOWN_TYPE</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_UNKNOWN_UNION_CHILD">XML_SCHEMAP_UNKNOWN_UNION_CHILD</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH">XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_ATTR_REDECL_PROH">XML_SCHEMAP_WARN_ATTR_REDECL_PROH</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_SKIP_SCHEMA">XML_SCHEMAP_WARN_SKIP_SCHEMA</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_UNLOCATED_SCHEMA">XML_SCHEMAP_WARN_UNLOCATED_SCHEMA</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER">XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAV_ATTRINVALID">XML_SCHEMAV_ATTRINVALID</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAV_ATTRUNKNOWN">XML_SCHEMAV_ATTRUNKNOWN</a><br />
@@ -2743,6 +2749,8 @@
 <a href="html/libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a><br />
 </p><h2><a name="xmlsave" id="xmlsave">Module xmlsave</a>:</h2><p><a href="html/libxml-xmlsave.html#XML_SAVE_FORMAT">XML_SAVE_FORMAT</a><br />
 <a href="html/libxml-xmlsave.html#XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a><br />
+<a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br />
+<a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br />
 <a href="html/libxml-xmlsave.html#xmlSaveClose">xmlSaveClose</a><br />
 <a href="html/libxml-xmlsave.html#xmlSaveCtxt">xmlSaveCtxt</a><br />
 <a href="html/libxml-xmlsave.html#xmlSaveCtxtPtr">xmlSaveCtxtPtr</a><br />

Modified: packages/libxml2/trunk/doc/APIsymbols.html
===================================================================
--- packages/libxml2/trunk/doc/APIsymbols.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/APIsymbols.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -413,37 +413,6 @@
 <a href="html/libxml-entities.html#XML_EXTERNAL_GENERAL_PARSED_ENTITY">XML_EXTERNAL_GENERAL_PARSED_ENTITY</a><br />
 <a href="html/libxml-entities.html#XML_EXTERNAL_GENERAL_UNPARSED_ENTITY">XML_EXTERNAL_GENERAL_UNPARSED_ENTITY</a><br />
 <a href="html/libxml-entities.html#XML_EXTERNAL_PARAMETER_ENTITY">XML_EXTERNAL_PARAMETER_ENTITY</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_AUTOMATA">XML_FEATURE_AUTOMATA</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_C14N">XML_FEATURE_C14N</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_CATALOG">XML_FEATURE_CATALOG</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_DEBUG">XML_FEATURE_DEBUG</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_DEBUG_MEM">XML_FEATURE_DEBUG_MEM</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_DEBUG_RUN">XML_FEATURE_DEBUG_RUN</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_EXPR">XML_FEATURE_EXPR</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_FTP">XML_FEATURE_FTP</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_HTML">XML_FEATURE_HTML</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_HTTP">XML_FEATURE_HTTP</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_ICONV">XML_FEATURE_ICONV</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_ISO8859X">XML_FEATURE_ISO8859X</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_LEGACY">XML_FEATURE_LEGACY</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_MODULES">XML_FEATURE_MODULES</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_NONE">XML_FEATURE_NONE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_OUTPUT">XML_FEATURE_OUTPUT</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_PATTERN">XML_FEATURE_PATTERN</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_PUSH">XML_FEATURE_PUSH</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_READER">XML_FEATURE_READER</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_REGEXP">XML_FEATURE_REGEXP</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_SAX1">XML_FEATURE_SAX1</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_SCHEMAS">XML_FEATURE_SCHEMAS</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_SCHEMATRON">XML_FEATURE_SCHEMATRON</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_THREAD">XML_FEATURE_THREAD</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_TREE">XML_FEATURE_TREE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_UNICODE">XML_FEATURE_UNICODE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_VALID">XML_FEATURE_VALID</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_WRITER">XML_FEATURE_WRITER</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_XINCLUDE">XML_FEATURE_XINCLUDE</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_XPATH">XML_FEATURE_XPATH</a><br />
-<a href="html/libxml-parser.html#XML_FEATURE_XPTR">XML_FEATURE_XPTR</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_C14N">XML_FROM_C14N</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_CATALOG">XML_FROM_CATALOG</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_CHECK">XML_FROM_CHECK</a><br />
@@ -806,6 +775,8 @@
 <a href="html/libxml-xmlerror.html#XML_SAVE_NOT_UTF8">XML_SAVE_NOT_UTF8</a><br />
 <a href="html/libxml-xmlsave.html#XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a><br />
 <a href="html/libxml-xmlerror.html#XML_SAVE_NO_DOCTYPE">XML_SAVE_NO_DOCTYPE</a><br />
+<a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br />
+<a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br />
 <a href="html/libxml-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING">XML_SAVE_UNKNOWN_ENCODING</a><br />
 <a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_ATTRFORMDEFAULT_VALUE">XML_SCHEMAP_ATTRFORMDEFAULT_VALUE</a><br />
@@ -938,6 +909,7 @@
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_ELEMENT_2_1">XML_SCHEMAP_SRC_ELEMENT_2_1</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_ELEMENT_2_2">XML_SCHEMAP_SRC_ELEMENT_2_2</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_ELEMENT_3">XML_SCHEMAP_SRC_ELEMENT_3</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT">XML_SCHEMAP_SRC_IMPORT</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT_1_1">XML_SCHEMAP_SRC_IMPORT_1_1</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT_1_2">XML_SCHEMAP_SRC_IMPORT_1_2</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_SRC_IMPORT_2">XML_SCHEMAP_SRC_IMPORT_2</a><br />
@@ -990,6 +962,10 @@
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD">XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_UNKNOWN_TYPE">XML_SCHEMAP_UNKNOWN_TYPE</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_UNKNOWN_UNION_CHILD">XML_SCHEMAP_UNKNOWN_UNION_CHILD</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH">XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_ATTR_REDECL_PROH">XML_SCHEMAP_WARN_ATTR_REDECL_PROH</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_SKIP_SCHEMA">XML_SCHEMAP_WARN_SKIP_SCHEMA</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_UNLOCATED_SCHEMA">XML_SCHEMAP_WARN_UNLOCATED_SCHEMA</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER">XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ANYATTR_LAX">XML_SCHEMAS_ANYATTR_LAX</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ANYATTR_SKIP">XML_SCHEMAS_ANYATTR_SKIP</a><br />
@@ -1121,6 +1097,7 @@
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FINAL_LIST">XML_SCHEMAS_TYPE_FINAL_LIST</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FINAL_RESTRICTION">XML_SCHEMAS_TYPE_FINAL_RESTRICTION</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FINAL_UNION">XML_SCHEMAS_TYPE_FINAL_UNION</a><br />
+<a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_FIXUP_1">XML_SCHEMAS_TYPE_FIXUP_1</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_GLOBAL">XML_SCHEMAS_TYPE_GLOBAL</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_HAS_FACETS">XML_SCHEMAS_TYPE_HAS_FACETS</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_INTERNAL_INVALID">XML_SCHEMAS_TYPE_INTERNAL_INVALID</a><br />
@@ -1301,6 +1278,37 @@
 <a href="html/libxml-xmlerror.html#XML_WAR_SPACE_VALUE">XML_WAR_SPACE_VALUE</a><br />
 <a href="html/libxml-xmlerror.html#XML_WAR_UNDECLARED_ENTITY">XML_WAR_UNDECLARED_ENTITY</a><br />
 <a href="html/libxml-xmlerror.html#XML_WAR_UNKNOWN_VERSION">XML_WAR_UNKNOWN_VERSION</a><br />
+<a href="html/libxml-parser.html#XML_WITH_AUTOMATA">XML_WITH_AUTOMATA</a><br />
+<a href="html/libxml-parser.html#XML_WITH_C14N">XML_WITH_C14N</a><br />
+<a href="html/libxml-parser.html#XML_WITH_CATALOG">XML_WITH_CATALOG</a><br />
+<a href="html/libxml-parser.html#XML_WITH_DEBUG">XML_WITH_DEBUG</a><br />
+<a href="html/libxml-parser.html#XML_WITH_DEBUG_MEM">XML_WITH_DEBUG_MEM</a><br />
+<a href="html/libxml-parser.html#XML_WITH_DEBUG_RUN">XML_WITH_DEBUG_RUN</a><br />
+<a href="html/libxml-parser.html#XML_WITH_EXPR">XML_WITH_EXPR</a><br />
+<a href="html/libxml-parser.html#XML_WITH_FTP">XML_WITH_FTP</a><br />
+<a href="html/libxml-parser.html#XML_WITH_HTML">XML_WITH_HTML</a><br />
+<a href="html/libxml-parser.html#XML_WITH_HTTP">XML_WITH_HTTP</a><br />
+<a href="html/libxml-parser.html#XML_WITH_ICONV">XML_WITH_ICONV</a><br />
+<a href="html/libxml-parser.html#XML_WITH_ISO8859X">XML_WITH_ISO8859X</a><br />
+<a href="html/libxml-parser.html#XML_WITH_LEGACY">XML_WITH_LEGACY</a><br />
+<a href="html/libxml-parser.html#XML_WITH_MODULES">XML_WITH_MODULES</a><br />
+<a href="html/libxml-parser.html#XML_WITH_NONE">XML_WITH_NONE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_OUTPUT">XML_WITH_OUTPUT</a><br />
+<a href="html/libxml-parser.html#XML_WITH_PATTERN">XML_WITH_PATTERN</a><br />
+<a href="html/libxml-parser.html#XML_WITH_PUSH">XML_WITH_PUSH</a><br />
+<a href="html/libxml-parser.html#XML_WITH_READER">XML_WITH_READER</a><br />
+<a href="html/libxml-parser.html#XML_WITH_REGEXP">XML_WITH_REGEXP</a><br />
+<a href="html/libxml-parser.html#XML_WITH_SAX1">XML_WITH_SAX1</a><br />
+<a href="html/libxml-parser.html#XML_WITH_SCHEMAS">XML_WITH_SCHEMAS</a><br />
+<a href="html/libxml-parser.html#XML_WITH_SCHEMATRON">XML_WITH_SCHEMATRON</a><br />
+<a href="html/libxml-parser.html#XML_WITH_THREAD">XML_WITH_THREAD</a><br />
+<a href="html/libxml-parser.html#XML_WITH_TREE">XML_WITH_TREE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_UNICODE">XML_WITH_UNICODE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_VALID">XML_WITH_VALID</a><br />
+<a href="html/libxml-parser.html#XML_WITH_WRITER">XML_WITH_WRITER</a><br />
+<a href="html/libxml-parser.html#XML_WITH_XINCLUDE">XML_WITH_XINCLUDE</a><br />
+<a href="html/libxml-parser.html#XML_WITH_XPATH">XML_WITH_XPATH</a><br />
+<a href="html/libxml-parser.html#XML_WITH_XPTR">XML_WITH_XPTR</a><br />
 <a href="html/libxml-xmlerror.html#XML_XINCLUDE_BUILD_FAILED">XML_XINCLUDE_BUILD_FAILED</a><br />
 <a href="html/libxml-xmlerror.html#XML_XINCLUDE_DEPRECATED_NS">XML_XINCLUDE_DEPRECATED_NS</a><br />
 <a href="html/libxml-tree.html#XML_XINCLUDE_END">XML_XINCLUDE_END</a><br />

Modified: packages/libxml2/trunk/doc/Makefile.am
===================================================================
--- packages/libxml2/trunk/doc/Makefile.am	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/Makefile.am	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-SUBDIRS=examples
+SUBDIRS=devhelp examples
 
 # The top-level SGML file.
 DOC_MAIN_XML_FILE=gnome-xml.xml

Modified: packages/libxml2/trunk/doc/Makefile.in
===================================================================
--- packages/libxml2/trunk/doc/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,6 +33,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 subdir = doc
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -242,6 +243,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -271,7 +274,7 @@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-SUBDIRS = examples
+SUBDIRS = devhelp examples
 
 # The top-level SGML file.
 DOC_MAIN_XML_FILE = gnome-xml.xml
@@ -392,7 +395,13 @@
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -404,7 +413,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -412,7 +421,13 @@
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -433,7 +448,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -533,15 +548,17 @@
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || mkdir "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="../$(top_distdir)" \
-	        distdir="../$(distdir)/$$subdir" \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -573,7 +590,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"

Modified: packages/libxml2/trunk/doc/apibuild.py
===================================================================
--- packages/libxml2/trunk/doc/apibuild.py	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/apibuild.py	2005-09-13 16:06:20 UTC (rev 478)
@@ -679,9 +679,54 @@
 
 	return token
 
-     #
-     # Parse a comment block associate to a macro
-     #
+    #
+    # Parse a comment block associate to a typedef
+    #
+    def parseTypeComment(self, name, quiet = 0):
+        if name[0:2] == '__':
+	    quiet = 1
+
+        args = []
+	desc = ""
+
+        if self.comment == None:
+	    if not quiet:
+		self.warning("Missing comment for type %s" % (name))
+	    return((args, desc))
+        if self.comment[0] != '*':
+	    if not quiet:
+		self.warning("Missing * in type comment for %s" % (name))
+	    return((args, desc))
+	lines = string.split(self.comment, '\n')
+	if lines[0] == '*':
+	    del lines[0]
+	if lines[0] != "* %s:" % (name):
+	    if not quiet:
+		self.warning("Misformatted type comment for %s" % (name))
+		self.warning("  Expecting '* %s:' got '%s'" % (name, lines[0]))
+	    return((args, desc))
+	del lines[0]
+	while len(lines) > 0 and lines[0] == '*':
+	    del lines[0]
+	desc = ""
+	while len(lines) > 0:
+	    l = lines[0]
+	    while len(l) > 0 and l[0] == '*':
+	        l = l[1:]
+	    l = string.strip(l)
+	    desc = desc + " " + l
+	    del lines[0]
+		     
+	desc = string.strip(desc)
+
+	if quiet == 0:
+	    if desc == "":
+	        self.warning("Type comment for %s lack description of the macro" % (name))
+
+	return(desc)
+    #
+    # Parse a comment block associate to a macro
+    #
     def parseMacroComment(self, name, quiet = 0):
         if name[0:2] == '__':
 	    quiet = 1
@@ -1025,8 +1070,10 @@
 					"struct", type)
 			base_type = "struct " + name
 	            else:
+			# TODO report missing or misformatted comments
+			info = self.parseTypeComment(name, 1)
 			self.index_add(name, self.filename, not self.is_header,
-		                    "typedef", type)
+		                    "typedef", type, info)
 		token = self.token()
 	    else:
 		self.error("parsing typedef: expecting a name")
@@ -1713,8 +1760,17 @@
 	    else:
 	        output.write("/>\n");
 	else :
-	    output.write("    <typedef name='%s' file='%s' type='%s'/>\n" % (
-	             name, self.modulename_file(id.header), id.info))
+	    output.write("    <typedef name='%s' file='%s' type='%s'" % (
+	                 name, self.modulename_file(id.header), id.info))
+            try:
+		desc = id.extra
+		if desc != None and desc != "":
+		    output.write(">\n      <info>%s</info>\n" % (escape(desc)))
+		    output.write("    </typedef>\n")
+		else:
+		    output.write("/>\n")
+	    except:
+		output.write("/>\n")
 
     def serialize_variable(self, output, name):
         id = self.idx.variables[name]

Copied: packages/libxml2/trunk/doc/devhelp (from rev 477, packages/libxml2/branches/upstream/current/doc/devhelp)

Modified: packages/libxml2/trunk/doc/devhelp/Makefile.in
===================================================================
--- packages/libxml2/branches/upstream/current/doc/devhelp/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/devhelp/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -110,6 +110,9 @@
 LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
 MAKEINFO = @MAKEINFO@
 MODULE_EXTENSION = @MODULE_EXTENSION@
 MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@
@@ -320,7 +323,7 @@
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
@@ -329,9 +332,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/devhelp/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/devhelp/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  doc/devhelp/Makefile
+	  $(AUTOMAKE) --foreign  doc/devhelp/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -345,9 +348,9 @@
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
-$(top_srcdir)/configure:  $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
 mostlyclean-libtool:

Modified: packages/libxml2/trunk/doc/examples/Makefile.in
===================================================================
--- packages/libxml2/trunk/doc/examples/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/examples/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,8 +14,6 @@
 
 @SET_MAKE@
 
-SOURCES = $(io1_SOURCES) $(io2_SOURCES) $(parse1_SOURCES) $(parse2_SOURCES) $(parse3_SOURCES) $(parse4_SOURCES) $(reader1_SOURCES) $(reader2_SOURCES) $(reader3_SOURCES) $(reader4_SOURCES) $(testWriter_SOURCES) $(tree1_SOURCES) $(tree2_SOURCES) $(xpath1_SOURCES) $(xpath2_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -36,6 +34,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 noinst_PROGRAMS = reader3$(EXEEXT) io2$(EXEEXT) reader1$(EXEEXT) \
 	reader2$(EXEEXT) reader4$(EXEEXT) testWriter$(EXEEXT) \
@@ -88,21 +87,13 @@
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
- at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/io1.Po ./$(DEPDIR)/io2.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/parse1.Po ./$(DEPDIR)/parse2.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/parse3.Po ./$(DEPDIR)/parse4.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/reader1.Po ./$(DEPDIR)/reader2.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/reader3.Po ./$(DEPDIR)/reader4.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/testWriter.Po ./$(DEPDIR)/tree1.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/tree2.Po ./$(DEPDIR)/xpath1.Po \
- at AMDEP_TRUE@	./$(DEPDIR)/xpath2.Po
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(io1_SOURCES) $(io2_SOURCES) $(parse1_SOURCES) \
 	$(parse2_SOURCES) $(parse3_SOURCES) $(parse4_SOURCES) \
@@ -299,6 +290,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -506,24 +499,21 @@
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
@@ -634,7 +624,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"

Modified: packages/libxml2/trunk/doc/html/libxml-parser.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-parser.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-parser.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -193,37 +193,37 @@
 <h3><a name="XML_SAX2_MAGIC" id="XML_SAX2_MAGIC"></a>Macro: XML_SAX2_MAGIC</h3><pre>#define XML_SAX2_MAGIC</pre><p>Special constant found in SAX2 blocks initialized fields</p>
 <h3><a name="XML_SKIP_IDS" id="XML_SKIP_IDS"></a>Macro: XML_SKIP_IDS</h3><pre>#define XML_SKIP_IDS</pre><p>Bit in the loadsubset context field to tell to not do ID/REFs registration. Used to initialize <a href="libxml-globals.html#xmlLoadExtDtdDefaultValue">xmlLoadExtDtdDefaultValue</a> in some special cases.</p>
 <h3>Enum <a name="xmlFeature" id="xmlFeature">xmlFeature</a></h3><pre class="programlisting">Enum xmlFeature {
-    <a name="XML_FEATURE_THREAD" id="XML_FEATURE_THREAD">XML_FEATURE_THREAD</a> = 1
-    <a name="XML_FEATURE_TREE" id="XML_FEATURE_TREE">XML_FEATURE_TREE</a> = 2
-    <a name="XML_FEATURE_OUTPUT" id="XML_FEATURE_OUTPUT">XML_FEATURE_OUTPUT</a> = 3
-    <a name="XML_FEATURE_PUSH" id="XML_FEATURE_PUSH">XML_FEATURE_PUSH</a> = 4
-    <a name="XML_FEATURE_READER" id="XML_FEATURE_READER">XML_FEATURE_READER</a> = 5
-    <a name="XML_FEATURE_PATTERN" id="XML_FEATURE_PATTERN">XML_FEATURE_PATTERN</a> = 6
-    <a name="XML_FEATURE_WRITER" id="XML_FEATURE_WRITER">XML_FEATURE_WRITER</a> = 7
-    <a name="XML_FEATURE_SAX1" id="XML_FEATURE_SAX1">XML_FEATURE_SAX1</a> = 8
-    <a name="XML_FEATURE_FTP" id="XML_FEATURE_FTP">XML_FEATURE_FTP</a> = 9
-    <a name="XML_FEATURE_HTTP" id="XML_FEATURE_HTTP">XML_FEATURE_HTTP</a> = 10
-    <a name="XML_FEATURE_VALID" id="XML_FEATURE_VALID">XML_FEATURE_VALID</a> = 11
-    <a name="XML_FEATURE_HTML" id="XML_FEATURE_HTML">XML_FEATURE_HTML</a> = 12
-    <a name="XML_FEATURE_LEGACY" id="XML_FEATURE_LEGACY">XML_FEATURE_LEGACY</a> = 13
-    <a name="XML_FEATURE_C14N" id="XML_FEATURE_C14N">XML_FEATURE_C14N</a> = 14
-    <a name="XML_FEATURE_CATALOG" id="XML_FEATURE_CATALOG">XML_FEATURE_CATALOG</a> = 15
-    <a name="XML_FEATURE_XPATH" id="XML_FEATURE_XPATH">XML_FEATURE_XPATH</a> = 16
-    <a name="XML_FEATURE_XPTR" id="XML_FEATURE_XPTR">XML_FEATURE_XPTR</a> = 17
-    <a name="XML_FEATURE_XINCLUDE" id="XML_FEATURE_XINCLUDE">XML_FEATURE_XINCLUDE</a> = 18
-    <a name="XML_FEATURE_ICONV" id="XML_FEATURE_ICONV">XML_FEATURE_ICONV</a> = 19
-    <a name="XML_FEATURE_ISO8859X" id="XML_FEATURE_ISO8859X">XML_FEATURE_ISO8859X</a> = 20
-    <a name="XML_FEATURE_UNICODE" id="XML_FEATURE_UNICODE">XML_FEATURE_UNICODE</a> = 21
-    <a name="XML_FEATURE_REGEXP" id="XML_FEATURE_REGEXP">XML_FEATURE_REGEXP</a> = 22
-    <a name="XML_FEATURE_AUTOMATA" id="XML_FEATURE_AUTOMATA">XML_FEATURE_AUTOMATA</a> = 23
-    <a name="XML_FEATURE_EXPR" id="XML_FEATURE_EXPR">XML_FEATURE_EXPR</a> = 24
-    <a name="XML_FEATURE_SCHEMAS" id="XML_FEATURE_SCHEMAS">XML_FEATURE_SCHEMAS</a> = 25
-    <a name="XML_FEATURE_SCHEMATRON" id="XML_FEATURE_SCHEMATRON">XML_FEATURE_SCHEMATRON</a> = 26
-    <a name="XML_FEATURE_MODULES" id="XML_FEATURE_MODULES">XML_FEATURE_MODULES</a> = 27
-    <a name="XML_FEATURE_DEBUG" id="XML_FEATURE_DEBUG">XML_FEATURE_DEBUG</a> = 28
-    <a name="XML_FEATURE_DEBUG_MEM" id="XML_FEATURE_DEBUG_MEM">XML_FEATURE_DEBUG_MEM</a> = 29
-    <a name="XML_FEATURE_DEBUG_RUN" id="XML_FEATURE_DEBUG_RUN">XML_FEATURE_DEBUG_RUN</a> = 30
-    <a name="XML_FEATURE_NONE" id="XML_FEATURE_NONE">XML_FEATURE_NONE</a> = 99999 : just to be sure of allocation size
+    <a name="XML_WITH_THREAD" id="XML_WITH_THREAD">XML_WITH_THREAD</a> = 1
+    <a name="XML_WITH_TREE" id="XML_WITH_TREE">XML_WITH_TREE</a> = 2
+    <a name="XML_WITH_OUTPUT" id="XML_WITH_OUTPUT">XML_WITH_OUTPUT</a> = 3
+    <a name="XML_WITH_PUSH" id="XML_WITH_PUSH">XML_WITH_PUSH</a> = 4
+    <a name="XML_WITH_READER" id="XML_WITH_READER">XML_WITH_READER</a> = 5
+    <a name="XML_WITH_PATTERN" id="XML_WITH_PATTERN">XML_WITH_PATTERN</a> = 6
+    <a name="XML_WITH_WRITER" id="XML_WITH_WRITER">XML_WITH_WRITER</a> = 7
+    <a name="XML_WITH_SAX1" id="XML_WITH_SAX1">XML_WITH_SAX1</a> = 8
+    <a name="XML_WITH_FTP" id="XML_WITH_FTP">XML_WITH_FTP</a> = 9
+    <a name="XML_WITH_HTTP" id="XML_WITH_HTTP">XML_WITH_HTTP</a> = 10
+    <a name="XML_WITH_VALID" id="XML_WITH_VALID">XML_WITH_VALID</a> = 11
+    <a name="XML_WITH_HTML" id="XML_WITH_HTML">XML_WITH_HTML</a> = 12
+    <a name="XML_WITH_LEGACY" id="XML_WITH_LEGACY">XML_WITH_LEGACY</a> = 13
+    <a name="XML_WITH_C14N" id="XML_WITH_C14N">XML_WITH_C14N</a> = 14
+    <a name="XML_WITH_CATALOG" id="XML_WITH_CATALOG">XML_WITH_CATALOG</a> = 15
+    <a name="XML_WITH_XPATH" id="XML_WITH_XPATH">XML_WITH_XPATH</a> = 16
+    <a name="XML_WITH_XPTR" id="XML_WITH_XPTR">XML_WITH_XPTR</a> = 17
+    <a name="XML_WITH_XINCLUDE" id="XML_WITH_XINCLUDE">XML_WITH_XINCLUDE</a> = 18
+    <a name="XML_WITH_ICONV" id="XML_WITH_ICONV">XML_WITH_ICONV</a> = 19
+    <a name="XML_WITH_ISO8859X" id="XML_WITH_ISO8859X">XML_WITH_ISO8859X</a> = 20
+    <a name="XML_WITH_UNICODE" id="XML_WITH_UNICODE">XML_WITH_UNICODE</a> = 21
+    <a name="XML_WITH_REGEXP" id="XML_WITH_REGEXP">XML_WITH_REGEXP</a> = 22
+    <a name="XML_WITH_AUTOMATA" id="XML_WITH_AUTOMATA">XML_WITH_AUTOMATA</a> = 23
+    <a name="XML_WITH_EXPR" id="XML_WITH_EXPR">XML_WITH_EXPR</a> = 24
+    <a name="XML_WITH_SCHEMAS" id="XML_WITH_SCHEMAS">XML_WITH_SCHEMAS</a> = 25
+    <a name="XML_WITH_SCHEMATRON" id="XML_WITH_SCHEMATRON">XML_WITH_SCHEMATRON</a> = 26
+    <a name="XML_WITH_MODULES" id="XML_WITH_MODULES">XML_WITH_MODULES</a> = 27
+    <a name="XML_WITH_DEBUG" id="XML_WITH_DEBUG">XML_WITH_DEBUG</a> = 28
+    <a name="XML_WITH_DEBUG_MEM" id="XML_WITH_DEBUG_MEM">XML_WITH_DEBUG_MEM</a> = 29
+    <a name="XML_WITH_DEBUG_RUN" id="XML_WITH_DEBUG_RUN">XML_WITH_DEBUG_RUN</a> = 30
+    <a name="XML_WITH_NONE" id="XML_WITH_NONE">XML_WITH_NONE</a> = 99999 : just to be sure of allocation size
 }
 </pre><h3>Enum <a name="xmlParserInputState" id="xmlParserInputState">xmlParserInputState</a></h3><pre class="programlisting">Enum xmlParserInputState {
     <a name="XML_PARSER_EOF" id="XML_PARSER_EOF">XML_PARSER_EOF</a> = -1 : nothing is to be parsed

Modified: packages/libxml2/trunk/doc/html/libxml-schemasInternals.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-schemasInternals.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-schemasInternals.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -10,7 +10,7 @@
 </style><style type="text/css">
       div.deprecated pre.programlisting {border-style: double;border-color:red}
       pre.programlisting {border-style: double;background: #EECFA1}
-    </style><title>Module schemasInternals from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module schemasInternals from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://www.blastwave.org/packages.php/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://rubyforge.org/projects/xml-tools/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-relaxng.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-relaxng.html">relaxng</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-schematron.html">schematron</a></th><td><a accesskey="n" href="libxml-schematron.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>internal interfaces for the XML Schemas handling and schema validity checking </p><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANYATTR_LAX">XML_SCHEMAS_ANYATTR_LAX</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANYATTR_SKIP">XML_SCHEMAS_ANYATTR_SKIP</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANYATTR_STRICT">XML_SCHEMAS_ANYATTR_STRICT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANY_LAX">XML_SCHEMAS_ANY_LAX</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANY_SKIP">XML_SCHEMAS_ANY_SKIP</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANY_STRICT">XML_SCHEMAS_ANY_STRICT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTRGROUP_GLOBAL">XML_SCHEMAS_ATTRGROUP_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTRGROUP_MARKED">XML_SCHEMAS_ATTRGROUP_MARKED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED">XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_FIXED">XML_SCHEMAS_ATTR_FIXED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_GLOBAL">XML_SCHEMAS_ATTR_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_INTERNAL_RESOLVED">XML_SCHEMAS_ATTR_INTERNAL_RESOLVED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_NSDEFAULT">XML_SCHEMAS_ATTR_NSDEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_USE_OPTIONAL">XML_SCHEMAS_ATTR_USE_OPTIONAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_USE_PROHIBITED">XML_SCHEMAS_ATTR_USE_PROHIBITED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_USE_REQUIRED">XML_SCHEMAS_ATTR_USE_REQUIRED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION">XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION">XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION">XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_ABSTRACT">XML_SCHEMAS_ELEM_ABSTRACT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_ABSENT">XML_SCHEMAS_ELEM_BLOCK_ABSENT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_EXTENSION">XML_SCHEMAS_ELEM_BLOCK_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_RESTRICTION">XML_SCHEMAS_ELEM_BLOCK_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION">XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_CIRCULAR">XML_SCHEMAS_ELEM_CIRCULAR</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_DEFAULT">XML_SCHEMAS_ELEM_DEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FINAL_ABSENT">XML_SCHEMAS_ELEM_FINAL_ABSENT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FINAL_EXTENSION">XML_SCHEMAS_ELEM_FINAL_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FINAL_RESTRICTION">XML_SCHEMAS_ELEM_FINAL_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FIXED">XML_SCHEMAS_ELEM_FIXED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_GLOBAL">XML_SCHEMAS_ELEM_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_INTERNAL_CHECKED">XML_SCHEMAS_ELEM_INTERNAL_CHECKED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_INTERNAL_RESOLVED">XML_SCHEMAS_ELEM_INTERNAL_RESOLVED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_NILLABLE">XML_SCHEMAS_ELEM_NILLABLE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_NSDEFAULT">XML_SCHEMAS_ELEM_NSDEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_REF">XML_SCHEMAS_ELEM_REF</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD">XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_TOPLEVEL">XML_SCHEMAS_ELEM_TOPLEVEL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_COLLAPSE">XML_SCHEMAS_FACET_COLLAPSE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_PRESERVE">XML_SCHEMAS_FACET_PRESERVE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_REPLACE">XML_SCHEMAS_FACET_REPLACE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_UNKNOWN">XML_SCHEMAS_FACET_UNKNOWN</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_EXTENSION">XML_SCHEMAS_FINAL_DEFAULT_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_LIST">XML_SCHEMAS_FINAL_DEFAULT_LIST</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION">XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_UNION">XML_SCHEMAS_FINAL_DEFAULT_UNION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_INCLUDING_CONVERT_NS">XML_SCHEMAS_INCLUDING_CONVERT_NS</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_QUALIF_ATTR">XML_SCHEMAS_QUALIF_ATTR</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_QUALIF_ELEM">XML_SCHEMAS_QUALIF_ELEM</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_ABSTRACT">XML_SCHEMAS_TYPE_ABSTRACT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BLOCK_DEFAULT">XML_SCHEMAS_TYPE_BLOCK_DEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BLOCK_EXTENSION">XML_SCHEMAS_TYPE_BLOCK_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BLOCK_RESTRICTION">XML_SCHEMAS_TYPE_BLOCK_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE">XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION">XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION">XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FACETSNEEDVALUE">XML_SCHEMAS_TYPE_FACETSNEEDVALUE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_DEFAULT">XML_SCHEMAS_TYPE_FINAL_DEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_EXTENSION">XML_SCHEMAS_TYPE_FINAL_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_LIST">XML_SCHEMAS_TYPE_FINAL_LIST</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_RESTRICTION">XML_SCHEMAS_TYPE_FINAL_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_UNION">XML_SCHEMAS_TYPE_FINAL_UNION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_GLOBAL">XML_SCHEMAS_TYPE_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_HAS_FACETS">XML_SCHEMAS_TYPE_HAS_FACETS</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_INTERNAL_INVALID">XML_SCHEMAS_TYPE_INTERNAL_INVALID</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_INTERNAL_RESOLVED">XML_SCHEMAS_TYPE_INTERNAL_RESOLVED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_MARKED">XML_SCHEMAS_TYPE_MARKED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_MIXED">XML_SCHEMAS_TYPE_MIXED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_NORMVALUENEEDED">XML_SCHEMAS_TYPE_NORMVALUENEEDED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD">XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_ABSENT">XML_SCHEMAS_TYPE_VARIETY_ABSENT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_ATOMIC">XML_SCHEMAS_TYPE_VARIETY_ATOMIC</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_LIST">XML_SCHEMAS_TYPE_VARIETY_LIST</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_UNION">XML_SCHEMAS_TYPE_VARIETY_UNION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE">XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE">XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_WHITESPACE_REPLACE">XML_SCHEMAS_TYPE_WHITESPACE_REPLACE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_WILDCARD_COMPLETE">XML_SCHEMAS_WILDCARD_COMPLETE</a></pre><pre class="programlisting">Structure <a href="#xmlSchemaAnnot">xmlSchemaAnnot</a><br />struct _xmlSchemaAnnot
+    </style><title>Module schemasInternals from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module schemasInternals from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://www.blastwave.org/packages.php/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://rubyforge.org/projects/xml-tools/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-relaxng.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-relaxng.html">relaxng</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-schematron.html">schematron</a></th><td><a accesskey="n" href="libxml-schematron.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>internal interfaces for the XML Schemas handling and schema validity checking </p><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANYATTR_LAX">XML_SCHEMAS_ANYATTR_LAX</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANYATTR_SKIP">XML_SCHEMAS_ANYATTR_SKIP</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANYATTR_STRICT">XML_SCHEMAS_ANYATTR_STRICT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANY_LAX">XML_SCHEMAS_ANY_LAX</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANY_SKIP">XML_SCHEMAS_ANY_SKIP</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ANY_STRICT">XML_SCHEMAS_ANY_STRICT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTRGROUP_GLOBAL">XML_SCHEMAS_ATTRGROUP_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTRGROUP_MARKED">XML_SCHEMAS_ATTRGROUP_MARKED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED">XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_FIXED">XML_SCHEMAS_ATTR_FIXED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_GLOBAL">XML_SCHEMAS_ATTR_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_INTERNAL_RESOLVED">XML_SCHEMAS_ATTR_INTERNAL_RESOLVED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_NSDEFAULT">XML_SCHEMAS_ATTR_NSDEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_USE_OPTIONAL">XML_SCHEMAS_ATTR_USE_OPTIONAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_USE_PROHIBITED">XML_SCHEMAS_ATTR_USE_PROHIBITED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ATTR_USE_REQUIRED">XML_SCHEMAS_ATTR_USE_REQUIRED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION">XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION">XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION">XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_ABSTRACT">XML_SCHEMAS_ELEM_ABSTRACT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_ABSENT">XML_SCHEMAS_ELEM_BLOCK_ABSENT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_EXTENSION">XML_SCHEMAS_ELEM_BLOCK_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_RESTRICTION">XML_SCHEMAS_ELEM_BLOCK_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION">XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_CIRCULAR">XML_SCHEMAS_ELEM_CIRCULAR</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_DEFAULT">XML_SCHEMAS_ELEM_DEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FINAL_ABSENT">XML_SCHEMAS_ELEM_FINAL_ABSENT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FINAL_EXTENSION">XML_SCHEMAS_ELEM_FINAL_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FINAL_RESTRICTION">XML_SCHEMAS_ELEM_FINAL_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_FIXED">XML_SCHEMAS_ELEM_FIXED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_GLOBAL">XML_SCHEMAS_ELEM_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_INTERNAL_CHECKED">XML_SCHEMAS_ELEM_INTERNAL_CHECKED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_INTERNAL_RESOLVED">XML_SCHEMAS_ELEM_INTERNAL_RESOLVED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_NILLABLE">XML_SCHEMAS_ELEM_NILLABLE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_NSDEFAULT">XML_SCHEMAS_ELEM_NSDEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_REF">XML_SCHEMAS_ELEM_REF</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD">XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_ELEM_TOPLEVEL">XML_SCHEMAS_ELEM_TOPLEVEL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_COLLAPSE">XML_SCHEMAS_FACET_COLLAPSE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_PRESERVE">XML_SCHEMAS_FACET_PRESERVE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_REPLACE">XML_SCHEMAS_FACET_REPLACE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FACET_UNKNOWN">XML_SCHEMAS_FACET_UNKNOWN</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_EXTENSION">XML_SCHEMAS_FINAL_DEFAULT_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_LIST">XML_SCHEMAS_FINAL_DEFAULT_LIST</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION">XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_FINAL_DEFAULT_UNION">XML_SCHEMAS_FINAL_DEFAULT_UNION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_INCLUDING_CONVERT_NS">XML_SCHEMAS_INCLUDING_CONVERT_NS</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_QUALIF_ATTR">XML_SCHEMAS_QUALIF_ATTR</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_QUALIF_ELEM">XML_SCHEMAS_QUALIF_ELEM</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_ABSTRACT">XML_SCHEMAS_TYPE_ABSTRACT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BLOCK_DEFAULT">XML_SCHEMAS_TYPE_BLOCK_DEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BLOCK_EXTENSION">XML_SCHEMAS_TYPE_BLOCK_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BLOCK_RESTRICTION">XML_SCHEMAS_TYPE_BLOCK_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE">XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION">XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION">XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FACETSNEEDVALUE">XML_SCHEMAS_TYPE_FACETSNEEDVALUE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_DEFAULT">XML_SCHEMAS_TYPE_FINAL_DEFAULT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_EXTENSION">XML_SCHEMAS_TYPE_FINAL_EXTENSION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_LIST">XML_SCHEMAS_TYPE_FINAL_LIST</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_RESTRICTION">XML_SCHEMAS_TYPE_FINAL_RESTRICTION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FINAL_UNION">XML_SCHEMAS_TYPE_FINAL_UNION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_FIXUP_1">XML_SCHEMAS_TYPE_FIXUP_1</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_GLOBAL">XML_SCHEMAS_TYPE_GLOBAL</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_HAS_FACETS">XML_SCHEMAS_TYPE_HAS_FACETS</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_INTERNAL_INVALID">XML_SCHEMAS_TYPE_INTERNAL_INVALID</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_INTERNAL_RESOLVED">XML_SCHEMAS_TYPE_INTERNAL_RESOLVED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_MARKED">XML_SCHEMAS_TYPE_MARKED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_MIXED">XML_SCHEMAS_TYPE_MIXED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_NORMVALUENEEDED">XML_SCHEMAS_TYPE_NORMVALUENEEDED</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD">XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_ABSENT">XML_SCHEMAS_TYPE_VARIETY_ABSENT</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_ATOMIC">XML_SCHEMAS_TYPE_VARIETY_ATOMIC</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_LIST">XML_SCHEMAS_TYPE_VARIETY_LIST</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_VARIETY_UNION">XML_SCHEMAS_TYPE_VARIETY_UNION</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE">XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE">XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_TYPE_WHITESPACE_REPLACE">XML_SCHEMAS_TYPE_WHITESPACE_REPLACE</a></pre><pre class="programlisting">#define <a href="#XML_SCHEMAS_WILDCARD_COMPLETE">XML_SCHEMAS_WILDCARD_COMPLETE</a></pre><pre class="programlisting">Structure <a href="#xmlSchemaAnnot">xmlSchemaAnnot</a><br />struct _xmlSchemaAnnot
 </pre><pre class="programlisting">Typedef <a href="libxml-schemasInternals.html#xmlSchemaAnnot">xmlSchemaAnnot</a> * <a name="xmlSchemaAnnotPtr" id="xmlSchemaAnnotPtr">xmlSchemaAnnotPtr</a>
 </pre><pre class="programlisting">Structure <a href="#xmlSchemaAttribute">xmlSchemaAttribute</a><br />struct _xmlSchemaAttribute
 </pre><pre class="programlisting">Structure <a href="#xmlSchemaAttributeGroup">xmlSchemaAttributeGroup</a><br />struct _xmlSchemaAttributeGroup
@@ -90,8 +90,8 @@
 <h3><a name="XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION" id="XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION"></a>Macro: XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION</h3><pre>#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION</pre><p>the schema has "restriction" in the set of finalDefault.</p>
 <h3><a name="XML_SCHEMAS_FINAL_DEFAULT_UNION" id="XML_SCHEMAS_FINAL_DEFAULT_UNION"></a>Macro: XML_SCHEMAS_FINAL_DEFAULT_UNION</h3><pre>#define XML_SCHEMAS_FINAL_DEFAULT_UNION</pre><p>the schema has "union" in the set of finalDefault.</p>
 <h3><a name="XML_SCHEMAS_INCLUDING_CONVERT_NS" id="XML_SCHEMAS_INCLUDING_CONVERT_NS"></a>Macro: XML_SCHEMAS_INCLUDING_CONVERT_NS</h3><pre>#define XML_SCHEMAS_INCLUDING_CONVERT_NS</pre><p>the schema is currently including an other schema with no target namespace.</p>
-<h3><a name="XML_SCHEMAS_QUALIF_ATTR" id="XML_SCHEMAS_QUALIF_ATTR"></a>Macro: XML_SCHEMAS_QUALIF_ATTR</h3><pre>#define XML_SCHEMAS_QUALIF_ATTR</pre><p>the schema requires qualified attributes</p>
-<h3><a name="XML_SCHEMAS_QUALIF_ELEM" id="XML_SCHEMAS_QUALIF_ELEM"></a>Macro: XML_SCHEMAS_QUALIF_ELEM</h3><pre>#define XML_SCHEMAS_QUALIF_ELEM</pre><p>the schema requires qualified elements</p>
+<h3><a name="XML_SCHEMAS_QUALIF_ATTR" id="XML_SCHEMAS_QUALIF_ATTR"></a>Macro: XML_SCHEMAS_QUALIF_ATTR</h3><pre>#define XML_SCHEMAS_QUALIF_ATTR</pre><p>Reflects attributeFormDefault == qualified in an XML schema document.</p>
+<h3><a name="XML_SCHEMAS_QUALIF_ELEM" id="XML_SCHEMAS_QUALIF_ELEM"></a>Macro: XML_SCHEMAS_QUALIF_ELEM</h3><pre>#define XML_SCHEMAS_QUALIF_ELEM</pre><p>Reflects elementFormDefault == qualified in an XML schema document.</p>
 <h3><a name="XML_SCHEMAS_TYPE_ABSTRACT" id="XML_SCHEMAS_TYPE_ABSTRACT"></a>Macro: XML_SCHEMAS_TYPE_ABSTRACT</h3><pre>#define XML_SCHEMAS_TYPE_ABSTRACT</pre><p>the simple/complexType is abstract.</p>
 <h3><a name="XML_SCHEMAS_TYPE_BLOCK_DEFAULT" id="XML_SCHEMAS_TYPE_BLOCK_DEFAULT"></a>Macro: XML_SCHEMAS_TYPE_BLOCK_DEFAULT</h3><pre>#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT</pre><p>the complexType did not specify 'block' so use the default of the &lt;schema&gt; item.</p>
 <h3><a name="XML_SCHEMAS_TYPE_BLOCK_EXTENSION" id="XML_SCHEMAS_TYPE_BLOCK_EXTENSION"></a>Macro: XML_SCHEMAS_TYPE_BLOCK_EXTENSION</h3><pre>#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION</pre><p>the complexType has a 'block' of "extension".</p>
@@ -105,6 +105,7 @@
 <h3><a name="XML_SCHEMAS_TYPE_FINAL_LIST" id="XML_SCHEMAS_TYPE_FINAL_LIST"></a>Macro: XML_SCHEMAS_TYPE_FINAL_LIST</h3><pre>#define XML_SCHEMAS_TYPE_FINAL_LIST</pre><p>the simpleType has a final of "list".</p>
 <h3><a name="XML_SCHEMAS_TYPE_FINAL_RESTRICTION" id="XML_SCHEMAS_TYPE_FINAL_RESTRICTION"></a>Macro: XML_SCHEMAS_TYPE_FINAL_RESTRICTION</h3><pre>#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION</pre><p>the simpleType/complexType has a final of "restriction".</p>
 <h3><a name="XML_SCHEMAS_TYPE_FINAL_UNION" id="XML_SCHEMAS_TYPE_FINAL_UNION"></a>Macro: XML_SCHEMAS_TYPE_FINAL_UNION</h3><pre>#define XML_SCHEMAS_TYPE_FINAL_UNION</pre><p>the simpleType has a final of "union".</p>
+<h3><a name="XML_SCHEMAS_TYPE_FIXUP_1" id="XML_SCHEMAS_TYPE_FIXUP_1"></a>Macro: XML_SCHEMAS_TYPE_FIXUP_1</h3><pre>#define XML_SCHEMAS_TYPE_FIXUP_1</pre><p>First stage of fixup was done.</p>
 <h3><a name="XML_SCHEMAS_TYPE_GLOBAL" id="XML_SCHEMAS_TYPE_GLOBAL"></a>Macro: XML_SCHEMAS_TYPE_GLOBAL</h3><pre>#define XML_SCHEMAS_TYPE_GLOBAL</pre><p>the type is global</p>
 <h3><a name="XML_SCHEMAS_TYPE_HAS_FACETS" id="XML_SCHEMAS_TYPE_HAS_FACETS"></a>Macro: XML_SCHEMAS_TYPE_HAS_FACETS</h3><pre>#define XML_SCHEMAS_TYPE_HAS_FACETS</pre><p>has facets</p>
 <h3><a name="XML_SCHEMAS_TYPE_INTERNAL_INVALID" id="XML_SCHEMAS_TYPE_INTERNAL_INVALID"></a>Macro: XML_SCHEMAS_TYPE_INTERNAL_INVALID</h3><pre>#define XML_SCHEMAS_TYPE_INTERNAL_INVALID</pre><p>indicates that the type is invalid</p>
@@ -158,7 +159,7 @@
     <a href="libxml-schemasInternals.html#xmlSchemaWildcardPtr">xmlSchemaWildcardPtr</a>	attributeWildcard
     const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	refPrefix
     <a href="libxml-schemasInternals.html#xmlSchemaAttributeGroupPtr">xmlSchemaAttributeGroupPtr</a>	refItem	: The referenced <a href="libxml-SAX.html#attribute">attribute</a> group
-    const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	targetNamespace
+    const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	targetNamespace	: <a href="libxml-schemasInternals.html#xmlSchemaAttributeGroupPtr">xmlSchemaAttributeGroupPtr</a> redef Redefi
 }</pre><h3><a name="xmlSchemaAttributeLink" id="xmlSchemaAttributeLink">Structure xmlSchemaAttributeLink</a></h3><pre class="programlisting">Structure xmlSchemaAttributeLink<br />struct _xmlSchemaAttributeLink {
     struct _xmlSchemaAttributeLink *	next	: the next <a href="libxml-SAX.html#attribute">attribute</a> link ...
     struct _xmlSchemaAttribute *	attr	: the linked <a href="libxml-SAX.html#attribute">attribute</a>

Modified: packages/libxml2/trunk/doc/html/libxml-xmlautomata.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlautomata.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlautomata.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -38,9 +38,13 @@
 <h2>Description</h2>
 <h3><a name="xmlAutomata" id="xmlAutomata">Structure xmlAutomata</a></h3><pre class="programlisting">Structure xmlAutomata<br />struct _xmlAutomata {
 The content of this structure is not made public by the API.
-}</pre><h3><a name="xmlAutomataState" id="xmlAutomataState">Structure xmlAutomataState</a></h3><pre class="programlisting">Structure xmlAutomataState<br />struct _xmlAutomataState {
+}</pre>
+      A libxml automata description, It can be compiled into a regexp
+    <h3><a name="xmlAutomataState" id="xmlAutomataState">Structure xmlAutomataState</a></h3><pre class="programlisting">Structure xmlAutomataState<br />struct _xmlAutomataState {
 The content of this structure is not made public by the API.
-}</pre><h3><a name="xmlAutomataCompile" id="xmlAutomataCompile"></a>Function: xmlAutomataCompile</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a>	xmlAutomataCompile	(<a href="libxml-xmlautomata.html#xmlAutomataPtr">xmlAutomataPtr</a> am)<br />
+}</pre>
+      A state int the automata description,
+    <h3><a name="xmlAutomataCompile" id="xmlAutomataCompile"></a>Function: xmlAutomataCompile</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a>	xmlAutomataCompile	(<a href="libxml-xmlautomata.html#xmlAutomataPtr">xmlAutomataPtr</a> am)<br />
 </pre><p>Compile the automata into a Reg Exp ready for being executed. The automata should be free after this point.</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>am</tt></i>:</span></td><td>an automata</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the compiled regexp or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlAutomataGetInitState" id="xmlAutomataGetInitState"></a>Function: xmlAutomataGetInitState</h3><pre class="programlisting"><a href="libxml-xmlautomata.html#xmlAutomataStatePtr">xmlAutomataStatePtr</a>	xmlAutomataGetInitState	(<a href="libxml-xmlautomata.html#xmlAutomataPtr">xmlAutomataPtr</a> am)<br />
 </pre><p>Initial state lookup</p>

Modified: packages/libxml2/trunk/doc/html/libxml-xmlerror.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlerror.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlerror.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -756,6 +756,11 @@
     <a name="XML_SCHEMAP_A_PROPS_CORRECT_2" id="XML_SCHEMAP_A_PROPS_CORRECT_2">XML_SCHEMAP_A_PROPS_CORRECT_2</a> = 3079 : 3079
     <a name="XML_SCHEMAP_C_PROPS_CORRECT" id="XML_SCHEMAP_C_PROPS_CORRECT">XML_SCHEMAP_C_PROPS_CORRECT</a> = 3080 : 3080
     <a name="XML_SCHEMAP_SRC_REDEFINE" id="XML_SCHEMAP_SRC_REDEFINE">XML_SCHEMAP_SRC_REDEFINE</a> = 3081 : 3081
+    <a name="XML_SCHEMAP_SRC_IMPORT" id="XML_SCHEMAP_SRC_IMPORT">XML_SCHEMAP_SRC_IMPORT</a> = 3082 : 3082
+    <a name="XML_SCHEMAP_WARN_SKIP_SCHEMA" id="XML_SCHEMAP_WARN_SKIP_SCHEMA">XML_SCHEMAP_WARN_SKIP_SCHEMA</a> = 3083 : 3083
+    <a name="XML_SCHEMAP_WARN_UNLOCATED_SCHEMA" id="XML_SCHEMAP_WARN_UNLOCATED_SCHEMA">XML_SCHEMAP_WARN_UNLOCATED_SCHEMA</a> = 3084 : 3084
+    <a name="XML_SCHEMAP_WARN_ATTR_REDECL_PROH" id="XML_SCHEMAP_WARN_ATTR_REDECL_PROH">XML_SCHEMAP_WARN_ATTR_REDECL_PROH</a> = 3085 : 3085
+    <a name="XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH" id="XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH">XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH</a> = 3086 : 3085
     <a name="XML_MODULE_OPEN" id="XML_MODULE_OPEN">XML_MODULE_OPEN</a> = 4900 : 4900
     <a name="XML_MODULE_CLOSE" id="XML_MODULE_CLOSE">XML_MODULE_CLOSE</a> = 4901 : 4901
     <a name="XML_CHECK_FOUND_ELEMENT" id="XML_CHECK_FOUND_ELEMENT">XML_CHECK_FOUND_ELEMENT</a> = 5000

Modified: packages/libxml2/trunk/doc/html/libxml-xmlmodule.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlmodule.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlmodule.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -25,7 +25,9 @@
     <a name="XML_MODULE_LAZY" id="XML_MODULE_LAZY">XML_MODULE_LAZY</a> = 1 : lazy binding
     <a name="XML_MODULE_LOCAL" id="XML_MODULE_LOCAL">XML_MODULE_LOCAL</a> = 2 : local binding
 }
-</pre><h3><a name="xmlModuleClose" id="xmlModuleClose"></a>Function: xmlModuleClose</h3><pre class="programlisting">int	xmlModuleClose			(<a href="libxml-xmlmodule.html#xmlModulePtr">xmlModulePtr</a> module)<br />
+</pre>
+      A handle to a dynamically loaded module
+    <h3><a name="xmlModuleClose" id="xmlModuleClose"></a>Function: xmlModuleClose</h3><pre class="programlisting">int	xmlModuleClose			(<a href="libxml-xmlmodule.html#xmlModulePtr">xmlModulePtr</a> module)<br />
 </pre><p>The close operations unload the associated module and free the data associated to the module.</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>module</tt></i>:</span></td><td>the module handle</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of argument error and -2 if the module could not be closed/unloaded.</td></tr></tbody></table></div><h3><a name="xmlModuleFree" id="xmlModuleFree"></a>Function: xmlModuleFree</h3><pre class="programlisting">int	xmlModuleFree			(<a href="libxml-xmlmodule.html#xmlModulePtr">xmlModulePtr</a> module)<br />
 </pre><p>The free operations free the data associated to the module but does not unload the associated shared library which may still be in use.</p>

Modified: packages/libxml2/trunk/doc/html/libxml-xmlreader.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlreader.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlreader.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -147,7 +147,9 @@
     <a name="XML_TEXTREADER_MODE_CLOSED" id="XML_TEXTREADER_MODE_CLOSED">XML_TEXTREADER_MODE_CLOSED</a> = 4
     <a name="XML_TEXTREADER_MODE_READING" id="XML_TEXTREADER_MODE_READING">XML_TEXTREADER_MODE_READING</a> = 5
 }
-</pre><h3><a name="xmlFreeTextReader" id="xmlFreeTextReader"></a>Function: xmlFreeTextReader</h3><pre class="programlisting">void	xmlFreeTextReader		(<a href="libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader)<br />
+</pre>
+      Pointer to an xmlReader context.
+    <h3><a name="xmlFreeTextReader" id="xmlFreeTextReader"></a>Function: xmlFreeTextReader</h3><pre class="programlisting">void	xmlFreeTextReader		(<a href="libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader)<br />
 </pre><p>Deallocate all the resources associated to the reader</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>reader</tt></i>:</span></td><td>the <a href="libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a></td></tr></tbody></table></div><h3><a name="xmlNewTextReader" id="xmlNewTextReader"></a>Function: xmlNewTextReader</h3><pre class="programlisting"><a href="libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a>	xmlNewTextReader	(<a href="libxml-tree.html#xmlParserInputBufferPtr">xmlParserInputBufferPtr</a> input, <br />						 const char * URI)<br />
 </pre><p>Create an <a href="libxml-xmlreader.html#xmlTextReader">xmlTextReader</a> structure fed with @input</p>

Modified: packages/libxml2/trunk/doc/html/libxml-xmlregexp.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlregexp.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlregexp.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -71,9 +71,13 @@
 }
 </pre><h3><a name="xmlRegExecCtxt" id="xmlRegExecCtxt">Structure xmlRegExecCtxt</a></h3><pre class="programlisting">Structure xmlRegExecCtxt<br />struct _xmlRegExecCtxt {
 The content of this structure is not made public by the API.
-}</pre><h3><a name="xmlRegexp" id="xmlRegexp">Structure xmlRegexp</a></h3><pre class="programlisting">Structure xmlRegexp<br />struct _xmlRegexp {
+}</pre>
+      A libxml progressive regular expression evaluation context
+    <h3><a name="xmlRegexp" id="xmlRegexp">Structure xmlRegexp</a></h3><pre class="programlisting">Structure xmlRegexp<br />struct _xmlRegexp {
 The content of this structure is not made public by the API.
-}</pre><h3><a name="xmlExpCtxtNbCons" id="xmlExpCtxtNbCons"></a>Function: xmlExpCtxtNbCons</h3><pre class="programlisting">int	xmlExpCtxtNbCons		(<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt)<br />
+}</pre>
+      A libxml regular expression, they can actually be far more complex thank the POSIX regex expressions.
+    <h3><a name="xmlExpCtxtNbCons" id="xmlExpCtxtNbCons"></a>Function: xmlExpCtxtNbCons</h3><pre class="programlisting">int	xmlExpCtxtNbCons		(<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt)<br />
 </pre><p>Debugging facility provides the number of allocated nodes over lifetime</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an expression context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of nodes ever allocated or -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlExpCtxtNbNodes" id="xmlExpCtxtNbNodes"></a>Function: xmlExpCtxtNbNodes</h3><pre class="programlisting">int	xmlExpCtxtNbNodes		(<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt)<br />
 </pre><p>Debugging facility provides the number of allocated nodes at a that point</p>

Modified: packages/libxml2/trunk/doc/html/libxml-xmlsave.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlsave.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlsave.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -29,6 +29,8 @@
 }</pre><h3>Enum <a name="xmlSaveOption" id="xmlSaveOption">xmlSaveOption</a></h3><pre class="programlisting">Enum xmlSaveOption {
     <a name="XML_SAVE_FORMAT" id="XML_SAVE_FORMAT">XML_SAVE_FORMAT</a> = 1 : format save output
     <a name="XML_SAVE_NO_DECL" id="XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a> = 2 : drop the xml declaration
+    <a name="XML_SAVE_NO_EMPTY" id="XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a> = 4 : no empty tags
+    <a name="XML_SAVE_NO_XHTML" id="XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a> = 8 : disable XHTML1 specific rules
 }
 </pre><h3><a name="xmlSaveClose" id="xmlSaveClose"></a>Function: xmlSaveClose</h3><pre class="programlisting">int	xmlSaveClose			(<a href="libxml-xmlsave.html#xmlSaveCtxtPtr">xmlSaveCtxtPtr</a> ctxt)<br />
 </pre><p>Close a document saving context, i.e. make sure that all bytes have been output and free the associated data.</p>

Modified: packages/libxml2/trunk/doc/html/libxml-xmlschemas.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlschemas.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlschemas.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -74,7 +74,7 @@
     int	preserve	: whether to free the document
     int	counter	: used to give ononymous components uniqu
     <a href="libxml-hash.html#xmlHashTablePtr">xmlHashTablePtr</a>	idcDef
-    void *	volatiles	: Misc. helper items (e.g. <a href="libxml-SAX.html#reference">reference</a> item
+    void *	volatiles	: Deprecated; not used anymore.
 }</pre><h3><a name="xmlSchemaParserCtxt" id="xmlSchemaParserCtxt">Structure xmlSchemaParserCtxt</a></h3><pre class="programlisting">Structure xmlSchemaParserCtxt<br />struct _xmlSchemaParserCtxt {
 The content of this structure is not made public by the API.
 }</pre><h3><a name="xmlSchemaSAXPlugStruct" id="xmlSchemaSAXPlugStruct">Structure xmlSchemaSAXPlugStruct</a></h3><pre class="programlisting">Structure xmlSchemaSAXPlugStruct<br />struct _xmlSchemaSAXPlug {

Modified: packages/libxml2/trunk/doc/html/libxml-xmlstring.html
===================================================================
--- packages/libxml2/trunk/doc/html/libxml-xmlstring.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/html/libxml-xmlstring.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -43,7 +43,9 @@
 <pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	<a href="#xmlUTF8Strsub">xmlUTF8Strsub</a>		(const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br />					 int start, <br />					 int len)</pre>
 <h2>Description</h2>
 <h3><a name="BAD_CAST" id="BAD_CAST"></a>Macro: BAD_CAST</h3><pre>#define BAD_CAST</pre><p>Macro to cast a string to an <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * when one know its safe.</p>
-<h3><a name="xmlCharStrdup" id="xmlCharStrdup"></a>Function: xmlCharStrdup</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	xmlCharStrdup		(const char * cur)<br />
+
+      This is a basic byte in an UTF-8 encoded string. It's unsigned allowing to pinpoint case where char * are assigned to xmlChar * (possibly making serialization back impossible).
+    <h3><a name="xmlCharStrdup" id="xmlCharStrdup"></a>Function: xmlCharStrdup</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	xmlCharStrdup		(const char * cur)<br />
 </pre><p>a strdup for char's to xmlChar's</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the input char *</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * or NULL</td></tr></tbody></table></div><h3><a name="xmlCharStrndup" id="xmlCharStrndup"></a>Function: xmlCharStrndup</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> *	xmlCharStrndup		(const char * cur, <br />					 int len)<br />
 </pre><p>a strndup for char's to xmlChar's</p>

Modified: packages/libxml2/trunk/doc/libxml2-api.xml
===================================================================
--- packages/libxml2/trunk/doc/libxml2-api.xml	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/libxml2-api.xml	2005-09-13 16:06:20 UTC (rev 478)
@@ -663,78 +663,78 @@
      <exports symbol='XML_SAX2_MAGIC' type='macro'/>
      <exports symbol='XML_DETECT_IDS' type='macro'/>
      <exports symbol='XML_DEFAULT_VERSION' type='macro'/>
-     <exports symbol='XML_FEATURE_SCHEMAS' type='enum'/>
-     <exports symbol='XML_FEATURE_TREE' type='enum'/>
+     <exports symbol='XML_WITH_SCHEMATRON' type='enum'/>
+     <exports symbol='XML_PARSER_ENTITY_DECL' type='enum'/>
      <exports symbol='XML_PARSER_CONTENT' type='enum'/>
-     <exports symbol='XML_FEATURE_XINCLUDE' type='enum'/>
      <exports symbol='XML_PARSE_NOBLANKS' type='enum'/>
-     <exports symbol='XML_FEATURE_OUTPUT' type='enum'/>
-     <exports symbol='XML_FEATURE_PUSH' type='enum'/>
-     <exports symbol='XML_FEATURE_FTP' type='enum'/>
+     <exports symbol='XML_WITH_PATTERN' type='enum'/>
+     <exports symbol='XML_PARSE_NODICT' type='enum'/>
+     <exports symbol='XML_PARSER_SYSTEM_LITERAL' type='enum'/>
+     <exports symbol='XML_WITH_REGEXP' type='enum'/>
      <exports symbol='XML_PARSER_PI' type='enum'/>
-     <exports symbol='XML_FEATURE_EXPR' type='enum'/>
-     <exports symbol='XML_FEATURE_UNICODE' type='enum'/>
-     <exports symbol='XML_FEATURE_WRITER' type='enum'/>
-     <exports symbol='XML_PARSER_ENTITY_DECL' type='enum'/>
+     <exports symbol='XML_WITH_FTP' type='enum'/>
+     <exports symbol='XML_WITH_XPATH' type='enum'/>
+     <exports symbol='XML_WITH_HTML' type='enum'/>
+     <exports symbol='XML_WITH_WRITER' type='enum'/>
+     <exports symbol='XML_WITH_C14N' type='enum'/>
+     <exports symbol='XML_PARSE_PUSH_DOM' type='enum'/>
      <exports symbol='XML_PARSER_PROLOG' type='enum'/>
-     <exports symbol='XML_PARSER_MISC' type='enum'/>
-     <exports symbol='XML_FEATURE_C14N' type='enum'/>
+     <exports symbol='XML_PARSE_NONET' type='enum'/>
+     <exports symbol='XML_WITH_HTTP' type='enum'/>
+     <exports symbol='XML_PARSER_EPILOG' type='enum'/>
      <exports symbol='XML_PARSER_END_TAG' type='enum'/>
+     <exports symbol='XML_WITH_DEBUG' type='enum'/>
      <exports symbol='XML_PARSE_DTDVALID' type='enum'/>
-     <exports symbol='XML_FEATURE_DEBUG_MEM' type='enum'/>
-     <exports symbol='XML_PARSE_READER' type='enum'/>
-     <exports symbol='XML_FEATURE_THREAD' type='enum'/>
-     <exports symbol='XML_FEATURE_SAX1' type='enum'/>
+     <exports symbol='XML_PARSE_DOM' type='enum'/>
+     <exports symbol='XML_PARSER_ATTRIBUTE_VALUE' type='enum'/>
      <exports symbol='XML_PARSE_PUSH_SAX' type='enum'/>
+     <exports symbol='XML_WITH_TREE' type='enum'/>
      <exports symbol='XML_PARSE_RECOVER' type='enum'/>
-     <exports symbol='XML_FEATURE_ICONV' type='enum'/>
-     <exports symbol='XML_FEATURE_READER' type='enum'/>
-     <exports symbol='XML_PARSE_NONET' type='enum'/>
+     <exports symbol='XML_WITH_SCHEMAS' type='enum'/>
      <exports symbol='XML_PARSE_PEDANTIC' type='enum'/>
-     <exports symbol='XML_FEATURE_AUTOMATA' type='enum'/>
      <exports symbol='XML_PARSER_EOF' type='enum'/>
-     <exports symbol='XML_FEATURE_LEGACY' type='enum'/>
      <exports symbol='XML_PARSER_CDATA_SECTION' type='enum'/>
-     <exports symbol='XML_FEATURE_REGEXP' type='enum'/>
-     <exports symbol='XML_PARSE_NOENT' type='enum'/>
+     <exports symbol='XML_WITH_LEGACY' type='enum'/>
      <exports symbol='XML_PARSE_XINCLUDE' type='enum'/>
-     <exports symbol='XML_PARSE_NOCDATA' type='enum'/>
-     <exports symbol='XML_PARSER_ATTRIBUTE_VALUE' type='enum'/>
-     <exports symbol='XML_PARSE_NODICT' type='enum'/>
-     <exports symbol='XML_FEATURE_DEBUG' type='enum'/>
+     <exports symbol='XML_PARSE_NOXINCNODE' type='enum'/>
+     <exports symbol='XML_WITH_NONE' type='enum'/>
+     <exports symbol='XML_WITH_OUTPUT' type='enum'/>
+     <exports symbol='XML_WITH_XINCLUDE' type='enum'/>
+     <exports symbol='XML_WITH_PUSH' type='enum'/>
+     <exports symbol='XML_PARSE_READER' type='enum'/>
+     <exports symbol='XML_WITH_THREAD' type='enum'/>
      <exports symbol='XML_PARSE_SAX' type='enum'/>
-     <exports symbol='XML_FEATURE_PATTERN' type='enum'/>
+     <exports symbol='XML_PARSE_NOENT' type='enum'/>
      <exports symbol='XML_PARSER_ENTITY_VALUE' type='enum'/>
      <exports symbol='XML_PARSE_DTDLOAD' type='enum'/>
-     <exports symbol='XML_FEATURE_HTML' type='enum'/>
      <exports symbol='XML_PARSE_DTDATTR' type='enum'/>
      <exports symbol='XML_PARSE_NOWARNING' type='enum'/>
-     <exports symbol='XML_PARSER_EPILOG' type='enum'/>
+     <exports symbol='XML_WITH_VALID' type='enum'/>
      <exports symbol='XML_PARSE_NOERROR' type='enum'/>
-     <exports symbol='XML_PARSE_DOM' type='enum'/>
-     <exports symbol='XML_PARSE_PUSH_DOM' type='enum'/>
-     <exports symbol='XML_FEATURE_CATALOG' type='enum'/>
-     <exports symbol='XML_FEATURE_MODULES' type='enum'/>
-     <exports symbol='XML_FEATURE_NONE' type='enum'/>
+     <exports symbol='XML_WITH_ISO8859X' type='enum'/>
+     <exports symbol='XML_WITH_EXPR' type='enum'/>
      <exports symbol='XML_PARSE_NSCLEAN' type='enum'/>
-     <exports symbol='XML_FEATURE_XPATH' type='enum'/>
+     <exports symbol='XML_WITH_UNICODE' type='enum'/>
+     <exports symbol='XML_WITH_CATALOG' type='enum'/>
+     <exports symbol='XML_WITH_MODULES' type='enum'/>
+     <exports symbol='XML_WITH_XPTR' type='enum'/>
+     <exports symbol='XML_PARSE_NOCDATA' type='enum'/>
      <exports symbol='XML_PARSE_COMPACT' type='enum'/>
      <exports symbol='XML_PARSE_SAX1' type='enum'/>
-     <exports symbol='XML_PARSE_NOXINCNODE' type='enum'/>
+     <exports symbol='XML_WITH_READER' type='enum'/>
      <exports symbol='XML_PARSER_DTD' type='enum'/>
-     <exports symbol='XML_FEATURE_SCHEMATRON' type='enum'/>
+     <exports symbol='XML_PARSER_MISC' type='enum'/>
      <exports symbol='XML_PARSER_START' type='enum'/>
-     <exports symbol='XML_PARSER_SYSTEM_LITERAL' type='enum'/>
+     <exports symbol='XML_WITH_DEBUG_MEM' type='enum'/>
      <exports symbol='XML_PARSE_UNKNOWN' type='enum'/>
      <exports symbol='XML_PARSER_START_TAG' type='enum'/>
-     <exports symbol='XML_FEATURE_ISO8859X' type='enum'/>
      <exports symbol='XML_PARSER_IGNORE' type='enum'/>
      <exports symbol='XML_PARSER_COMMENT' type='enum'/>
      <exports symbol='XML_PARSER_PUBLIC_LITERAL' type='enum'/>
-     <exports symbol='XML_FEATURE_DEBUG_RUN' type='enum'/>
-     <exports symbol='XML_FEATURE_HTTP' type='enum'/>
-     <exports symbol='XML_FEATURE_XPTR' type='enum'/>
-     <exports symbol='XML_FEATURE_VALID' type='enum'/>
+     <exports symbol='XML_WITH_ICONV' type='enum'/>
+     <exports symbol='XML_WITH_AUTOMATA' type='enum'/>
+     <exports symbol='XML_WITH_DEBUG_RUN' type='enum'/>
+     <exports symbol='XML_WITH_SAX1' type='enum'/>
      <exports symbol='xmlParserNodeInfoSeqPtr' type='typedef'/>
      <exports symbol='xmlSAXHandlerV1' type='typedef'/>
      <exports symbol='xmlParserInputState' type='typedef'/>
@@ -1097,7 +1097,7 @@
      <author>Daniel Veillard </author>
      <exports symbol='XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION' type='macro'/>
      <exports symbol='XML_SCHEMAS_FINAL_DEFAULT_EXTENSION' type='macro'/>
-     <exports symbol='XML_SCHEMAS_TYPE_VARIETY_UNION' type='macro'/>
+     <exports symbol='XML_SCHEMAS_TYPE_FIXUP_1' type='macro'/>
      <exports symbol='XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION' type='macro'/>
      <exports symbol='XML_SCHEMAS_ELEM_CIRCULAR' type='macro'/>
      <exports symbol='XML_SCHEMAS_QUALIF_ATTR' type='macro'/>
@@ -1106,7 +1106,7 @@
      <exports symbol='XML_SCHEMAS_ATTR_USE_REQUIRED' type='macro'/>
      <exports symbol='XML_SCHEMAS_FACET_COLLAPSE' type='macro'/>
      <exports symbol='XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE' type='macro'/>
-     <exports symbol='XML_SCHEMAS_TYPE_WHITESPACE_REPLACE' type='macro'/>
+     <exports symbol='XML_SCHEMAS_TYPE_VARIETY_UNION' type='macro'/>
      <exports symbol='XML_SCHEMAS_ANY_STRICT' type='macro'/>
      <exports symbol='XML_SCHEMAS_TYPE_INTERNAL_RESOLVED' type='macro'/>
      <exports symbol='XML_SCHEMAS_QUALIF_ELEM' type='macro'/>
@@ -1129,6 +1129,7 @@
      <exports symbol='XML_SCHEMAS_TYPE_FINAL_LIST' type='macro'/>
      <exports symbol='XML_SCHEMAS_ATTR_USE_OPTIONAL' type='macro'/>
      <exports symbol='XML_SCHEMAS_ATTR_NSDEFAULT' type='macro'/>
+     <exports symbol='XML_SCHEMAS_TYPE_WHITESPACE_REPLACE' type='macro'/>
      <exports symbol='XML_SCHEMAS_TYPE_BLOCK_RESTRICTION' type='macro'/>
      <exports symbol='XML_SCHEMAS_ANYATTR_STRICT' type='macro'/>
      <exports symbol='XML_SCHEMAS_FACET_UNKNOWN' type='macro'/>
@@ -1921,6 +1922,7 @@
      <exports symbol='XML_SCHEMAP_ELEM_NONAME_NOREF' type='enum'/>
      <exports symbol='XML_CHECK_NOT_DTD' type='enum'/>
      <exports symbol='XML_SCHEMAP_S4S_ATTR_MISSING' type='enum'/>
+     <exports symbol='XML_SCHEMAP_SRC_IMPORT' type='enum'/>
      <exports symbol='XML_SCHEMAV_VALUE' type='enum'/>
      <exports symbol='XML_XPATH_UNKNOWN_FUNC_ERROR' type='enum'/>
      <exports symbol='XML_ERR_DOCUMENT_START' type='enum'/>
@@ -1967,6 +1969,7 @@
      <exports symbol='XML_FROM_MODULE' type='enum'/>
      <exports symbol='XML_SCHEMAV_EXTRACONTENT' type='enum'/>
      <exports symbol='XML_RNGP_ELEM_CONTENT_EMPTY' type='enum'/>
+     <exports symbol='XML_SCHEMAP_WARN_UNLOCATED_SCHEMA' type='enum'/>
      <exports symbol='XML_IO_EMLINK' type='enum'/>
      <exports symbol='XML_CHECK_X' type='enum'/>
      <exports symbol='XML_RNGP_ANYNAME_ATTR_ANCESTOR' type='enum'/>
@@ -2118,6 +2121,7 @@
      <exports symbol='XML_ERR_ENTITYREF_IN_PROLOG' type='enum'/>
      <exports symbol='XML_SCHEMAV_CVC_IDC' type='enum'/>
      <exports symbol='XML_IO_ENOTTY' type='enum'/>
+     <exports symbol='XML_SCHEMAP_WARN_SKIP_SCHEMA' type='enum'/>
      <exports symbol='XML_DTD_UNKNOWN_NOTATION' type='enum'/>
      <exports symbol='XML_FROM_DATATYPE' type='enum'/>
      <exports symbol='XML_ERR_WARNING' type='enum'/>
@@ -2127,6 +2131,7 @@
      <exports symbol='XML_SCHEMAP_UNKNOWN_UNION_CHILD' type='enum'/>
      <exports symbol='XML_XPATH_MEMORY_ERROR' type='enum'/>
      <exports symbol='XML_SCHEMAP_NOROOT' type='enum'/>
+     <exports symbol='XML_SCHEMAP_WARN_ATTR_REDECL_PROH' type='enum'/>
      <exports symbol='XML_SCHEMAV_CVC_ELT_3_2_1' type='enum'/>
      <exports symbol='XML_SCHEMAV_CVC_ELT_3_2_2' type='enum'/>
      <exports symbol='XML_XPATH_UNCLOSED_ERROR' type='enum'/>
@@ -2620,6 +2625,7 @@
      <exports symbol='XML_ERR_TAG_NOT_FINISHED' type='enum'/>
      <exports symbol='XML_ERR_LTSLASH_REQUIRED' type='enum'/>
      <exports symbol='XML_SCHEMAP_REDEFINED_ATTRGROUP' type='enum'/>
+     <exports symbol='XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH' type='enum'/>
      <exports symbol='XML_ERR_PEREF_IN_INT_SUBSET' type='enum'/>
      <exports symbol='XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2' type='enum'/>
      <exports symbol='XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3' type='enum'/>
@@ -2926,7 +2932,9 @@
      <summary>the XML document serializer</summary>
      <description>API to save document or subtree of document </description>
      <author>Daniel Veillard </author>
+     <exports symbol='XML_SAVE_NO_EMPTY' type='enum'/>
      <exports symbol='XML_SAVE_NO_DECL' type='enum'/>
+     <exports symbol='XML_SAVE_NO_XHTML' type='enum'/>
      <exports symbol='XML_SAVE_FORMAT' type='enum'/>
      <exports symbol='xmlSaveOption' type='typedef'/>
      <exports symbol='xmlSaveCtxt' type='typedef'/>
@@ -4176,10 +4184,10 @@
       <info>the schema is currently including an other schema with no target namespace.</info>
     </macro>
     <macro name='XML_SCHEMAS_QUALIF_ATTR' file='schemasInternals'>
-      <info>the schema requires qualified attributes</info>
+      <info>Reflects attributeFormDefault == qualified in an XML schema document.</info>
     </macro>
     <macro name='XML_SCHEMAS_QUALIF_ELEM' file='schemasInternals'>
-      <info>the schema requires qualified elements</info>
+      <info>Reflects elementFormDefault == qualified in an XML schema document.</info>
     </macro>
     <macro name='XML_SCHEMAS_TYPE_ABSTRACT' file='schemasInternals'>
       <info>the simple/complexType is abstract.</info>
@@ -4220,6 +4228,9 @@
     <macro name='XML_SCHEMAS_TYPE_FINAL_UNION' file='schemasInternals'>
       <info>the simpleType has a final of &quot;union&quot;.</info>
     </macro>
+    <macro name='XML_SCHEMAS_TYPE_FIXUP_1' file='schemasInternals'>
+      <info>First stage of fixup was done.</info>
+    </macro>
     <macro name='XML_SCHEMAS_TYPE_GLOBAL' file='schemasInternals'>
       <info>the type is global</info>
     </macro>
@@ -4783,37 +4794,6 @@
     <enum name='XML_EXTERNAL_GENERAL_PARSED_ENTITY' file='entities' value='2' type='xmlEntityType'/>
     <enum name='XML_EXTERNAL_GENERAL_UNPARSED_ENTITY' file='entities' value='3' type='xmlEntityType'/>
     <enum name='XML_EXTERNAL_PARAMETER_ENTITY' file='entities' value='5' type='xmlEntityType'/>
-    <enum name='XML_FEATURE_AUTOMATA' file='parser' value='23' type='xmlFeature'/>
-    <enum name='XML_FEATURE_C14N' file='parser' value='14' type='xmlFeature'/>
-    <enum name='XML_FEATURE_CATALOG' file='parser' value='15' type='xmlFeature'/>
-    <enum name='XML_FEATURE_DEBUG' file='parser' value='28' type='xmlFeature'/>
-    <enum name='XML_FEATURE_DEBUG_MEM' file='parser' value='29' type='xmlFeature'/>
-    <enum name='XML_FEATURE_DEBUG_RUN' file='parser' value='30' type='xmlFeature'/>
-    <enum name='XML_FEATURE_EXPR' file='parser' value='24' type='xmlFeature'/>
-    <enum name='XML_FEATURE_FTP' file='parser' value='9' type='xmlFeature'/>
-    <enum name='XML_FEATURE_HTML' file='parser' value='12' type='xmlFeature'/>
-    <enum name='XML_FEATURE_HTTP' file='parser' value='10' type='xmlFeature'/>
-    <enum name='XML_FEATURE_ICONV' file='parser' value='19' type='xmlFeature'/>
-    <enum name='XML_FEATURE_ISO8859X' file='parser' value='20' type='xmlFeature'/>
-    <enum name='XML_FEATURE_LEGACY' file='parser' value='13' type='xmlFeature'/>
-    <enum name='XML_FEATURE_MODULES' file='parser' value='27' type='xmlFeature'/>
-    <enum name='XML_FEATURE_NONE' file='parser' value='99999' type='xmlFeature' info=' just to be sure of allocation size'/>
-    <enum name='XML_FEATURE_OUTPUT' file='parser' value='3' type='xmlFeature'/>
-    <enum name='XML_FEATURE_PATTERN' file='parser' value='6' type='xmlFeature'/>
-    <enum name='XML_FEATURE_PUSH' file='parser' value='4' type='xmlFeature'/>
-    <enum name='XML_FEATURE_READER' file='parser' value='5' type='xmlFeature'/>
-    <enum name='XML_FEATURE_REGEXP' file='parser' value='22' type='xmlFeature'/>
-    <enum name='XML_FEATURE_SAX1' file='parser' value='8' type='xmlFeature'/>
-    <enum name='XML_FEATURE_SCHEMAS' file='parser' value='25' type='xmlFeature'/>
-    <enum name='XML_FEATURE_SCHEMATRON' file='parser' value='26' type='xmlFeature'/>
-    <enum name='XML_FEATURE_THREAD' file='parser' value='1' type='xmlFeature'/>
-    <enum name='XML_FEATURE_TREE' file='parser' value='2' type='xmlFeature'/>
-    <enum name='XML_FEATURE_UNICODE' file='parser' value='21' type='xmlFeature'/>
-    <enum name='XML_FEATURE_VALID' file='parser' value='11' type='xmlFeature'/>
-    <enum name='XML_FEATURE_WRITER' file='parser' value='7' type='xmlFeature'/>
-    <enum name='XML_FEATURE_XINCLUDE' file='parser' value='18' type='xmlFeature'/>
-    <enum name='XML_FEATURE_XPATH' file='parser' value='16' type='xmlFeature'/>
-    <enum name='XML_FEATURE_XPTR' file='parser' value='17' type='xmlFeature'/>
     <enum name='XML_FROM_C14N' file='xmlerror' value='21' type='xmlErrorDomain' info='The Canonicalization module'/>
     <enum name='XML_FROM_CATALOG' file='xmlerror' value='20' type='xmlErrorDomain' info='The Catalog module'/>
     <enum name='XML_FROM_CHECK' file='xmlerror' value='24' type='xmlErrorDomain' info='The error checking module'/>
@@ -5170,8 +5150,10 @@
     <enum name='XML_SAVE_CHAR_INVALID' file='xmlerror' value='1401' type='xmlParserErrors' info='1401'/>
     <enum name='XML_SAVE_FORMAT' file='xmlsave' value='1' type='xmlSaveOption' info='format save output'/>
     <enum name='XML_SAVE_NOT_UTF8' file='xmlerror' value='1400' type='xmlParserErrors'/>
-    <enum name='XML_SAVE_NO_DECL' file='xmlsave' value='2' type='xmlSaveOption' info=' drop the xml declaration'/>
+    <enum name='XML_SAVE_NO_DECL' file='xmlsave' value='2' type='xmlSaveOption' info='drop the xml declaration'/>
     <enum name='XML_SAVE_NO_DOCTYPE' file='xmlerror' value='1402' type='xmlParserErrors' info='1402'/>
+    <enum name='XML_SAVE_NO_EMPTY' file='xmlsave' value='4' type='xmlSaveOption' info='no empty tags'/>
+    <enum name='XML_SAVE_NO_XHTML' file='xmlsave' value='8' type='xmlSaveOption' info=' disable XHTML1 specific rules'/>
     <enum name='XML_SAVE_UNKNOWN_ENCODING' file='xmlerror' value='1403' type='xmlParserErrors' info='1403'/>
     <enum name='XML_SCHEMAP_ATTRFORMDEFAULT_VALUE' file='xmlerror' value='1701' type='xmlParserErrors' info='1701'/>
     <enum name='XML_SCHEMAP_ATTRGRP_NONAME_NOREF' file='xmlerror' value='1702' type='xmlParserErrors' info='1702'/>
@@ -5303,6 +5285,7 @@
     <enum name='XML_SCHEMAP_SRC_ELEMENT_2_1' file='xmlerror' value='3039' type='xmlParserErrors' info='3039'/>
     <enum name='XML_SCHEMAP_SRC_ELEMENT_2_2' file='xmlerror' value='3040' type='xmlParserErrors' info='3040'/>
     <enum name='XML_SCHEMAP_SRC_ELEMENT_3' file='xmlerror' value='3041' type='xmlParserErrors' info='3041'/>
+    <enum name='XML_SCHEMAP_SRC_IMPORT' file='xmlerror' value='3082' type='xmlParserErrors' info='3082'/>
     <enum name='XML_SCHEMAP_SRC_IMPORT_1_1' file='xmlerror' value='3064' type='xmlParserErrors' info='3064'/>
     <enum name='XML_SCHEMAP_SRC_IMPORT_1_2' file='xmlerror' value='3065' type='xmlParserErrors' info='3065'/>
     <enum name='XML_SCHEMAP_SRC_IMPORT_2' file='xmlerror' value='3066' type='xmlParserErrors' info='3066'/>
@@ -5355,6 +5338,10 @@
     <enum name='XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD' file='xmlerror' value='1752' type='xmlParserErrors' info='1752'/>
     <enum name='XML_SCHEMAP_UNKNOWN_TYPE' file='xmlerror' value='1753' type='xmlParserErrors' info='1753'/>
     <enum name='XML_SCHEMAP_UNKNOWN_UNION_CHILD' file='xmlerror' value='1754' type='xmlParserErrors' info='1754'/>
+    <enum name='XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH' file='xmlerror' value='3086' type='xmlParserErrors' info='3085'/>
+    <enum name='XML_SCHEMAP_WARN_ATTR_REDECL_PROH' file='xmlerror' value='3085' type='xmlParserErrors' info='3085'/>
+    <enum name='XML_SCHEMAP_WARN_SKIP_SCHEMA' file='xmlerror' value='3083' type='xmlParserErrors' info='3083'/>
+    <enum name='XML_SCHEMAP_WARN_UNLOCATED_SCHEMA' file='xmlerror' value='3084' type='xmlParserErrors' info='3084'/>
     <enum name='XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER' file='xmlerror' value='1792' type='xmlParserErrors' info='1792'/>
     <enum name='XML_SCHEMAS_ANYSIMPLETYPE' file='schemasInternals' value='46' type='xmlSchemaValType'/>
     <enum name='XML_SCHEMAS_ANYTYPE' file='schemasInternals' value='45' type='xmlSchemaValType'/>
@@ -5585,6 +5572,37 @@
     <enum name='XML_WAR_SPACE_VALUE' file='xmlerror' value='102' type='xmlParserErrors' info='102'/>
     <enum name='XML_WAR_UNDECLARED_ENTITY' file='xmlerror' value='27' type='xmlParserErrors' info='27'/>
     <enum name='XML_WAR_UNKNOWN_VERSION' file='xmlerror' value='97' type='xmlParserErrors' info='97'/>
+    <enum name='XML_WITH_AUTOMATA' file='parser' value='23' type='xmlFeature'/>
+    <enum name='XML_WITH_C14N' file='parser' value='14' type='xmlFeature'/>
+    <enum name='XML_WITH_CATALOG' file='parser' value='15' type='xmlFeature'/>
+    <enum name='XML_WITH_DEBUG' file='parser' value='28' type='xmlFeature'/>
+    <enum name='XML_WITH_DEBUG_MEM' file='parser' value='29' type='xmlFeature'/>
+    <enum name='XML_WITH_DEBUG_RUN' file='parser' value='30' type='xmlFeature'/>
+    <enum name='XML_WITH_EXPR' file='parser' value='24' type='xmlFeature'/>
+    <enum name='XML_WITH_FTP' file='parser' value='9' type='xmlFeature'/>
+    <enum name='XML_WITH_HTML' file='parser' value='12' type='xmlFeature'/>
+    <enum name='XML_WITH_HTTP' file='parser' value='10' type='xmlFeature'/>
+    <enum name='XML_WITH_ICONV' file='parser' value='19' type='xmlFeature'/>
+    <enum name='XML_WITH_ISO8859X' file='parser' value='20' type='xmlFeature'/>
+    <enum name='XML_WITH_LEGACY' file='parser' value='13' type='xmlFeature'/>
+    <enum name='XML_WITH_MODULES' file='parser' value='27' type='xmlFeature'/>
+    <enum name='XML_WITH_NONE' file='parser' value='99999' type='xmlFeature' info=' just to be sure of allocation size'/>
+    <enum name='XML_WITH_OUTPUT' file='parser' value='3' type='xmlFeature'/>
+    <enum name='XML_WITH_PATTERN' file='parser' value='6' type='xmlFeature'/>
+    <enum name='XML_WITH_PUSH' file='parser' value='4' type='xmlFeature'/>
+    <enum name='XML_WITH_READER' file='parser' value='5' type='xmlFeature'/>
+    <enum name='XML_WITH_REGEXP' file='parser' value='22' type='xmlFeature'/>
+    <enum name='XML_WITH_SAX1' file='parser' value='8' type='xmlFeature'/>
+    <enum name='XML_WITH_SCHEMAS' file='parser' value='25' type='xmlFeature'/>
+    <enum name='XML_WITH_SCHEMATRON' file='parser' value='26' type='xmlFeature'/>
+    <enum name='XML_WITH_THREAD' file='parser' value='1' type='xmlFeature'/>
+    <enum name='XML_WITH_TREE' file='parser' value='2' type='xmlFeature'/>
+    <enum name='XML_WITH_UNICODE' file='parser' value='21' type='xmlFeature'/>
+    <enum name='XML_WITH_VALID' file='parser' value='11' type='xmlFeature'/>
+    <enum name='XML_WITH_WRITER' file='parser' value='7' type='xmlFeature'/>
+    <enum name='XML_WITH_XINCLUDE' file='parser' value='18' type='xmlFeature'/>
+    <enum name='XML_WITH_XPATH' file='parser' value='16' type='xmlFeature'/>
+    <enum name='XML_WITH_XPTR' file='parser' value='17' type='xmlFeature'/>
     <enum name='XML_XINCLUDE_BUILD_FAILED' file='xmlerror' value='1609' type='xmlParserErrors' info='1609'/>
     <enum name='XML_XINCLUDE_DEPRECATED_NS' file='xmlerror' value='1617' type='xmlParserErrors' info='1617'/>
     <enum name='XML_XINCLUDE_END' file='tree' value='20' type='xmlElementType'/>
@@ -5767,9 +5785,13 @@
     <typedef name='xmlAttributeTablePtr' file='valid' type='xmlAttributeTable *'/>
     <typedef name='xmlAttributeType' file='tree' type='enum'/>
     <struct name='xmlAutomata' file='xmlautomata' type='struct _xmlAutomata'/>
-    <typedef name='xmlAutomataPtr' file='xmlautomata' type='xmlAutomata *'/>
+    <typedef name='xmlAutomataPtr' file='xmlautomata' type='xmlAutomata *'>
+      <info>A libxml automata description, It can be compiled into a regexp</info>
+    </typedef>
     <struct name='xmlAutomataState' file='xmlautomata' type='struct _xmlAutomataState'/>
-    <typedef name='xmlAutomataStatePtr' file='xmlautomata' type='xmlAutomataState *'/>
+    <typedef name='xmlAutomataStatePtr' file='xmlautomata' type='xmlAutomataState *'>
+      <info>A state int the automata description,</info>
+    </typedef>
     <struct name='xmlBuffer' file='tree' type='struct _xmlBuffer'>
       <field name='content' type='xmlChar *' info=' The buffer content UTF8'/>
       <field name='use' type='unsigned int' info=' The buffer size used'/>
@@ -5799,7 +5821,9 @@
       <field name='high' type='unsigned short' info=''/>
     </struct>
     <typedef name='xmlChSRangePtr' file='chvalid' type='xmlChSRange *'/>
-    <typedef name='xmlChar' file='xmlstring' type='unsigned char'/>
+    <typedef name='xmlChar' file='xmlstring' type='unsigned char'>
+      <info>This is a basic byte in an UTF-8 encoded string. It&apos;s unsigned allowing to pinpoint case where char * are assigned to xmlChar * (possibly making serialization back impossible).</info>
+    </typedef>
     <typedef name='xmlCharEncoding' file='encoding' type='enum'/>
     <struct name='xmlCharEncodingHandler' file='encoding' type='struct _xmlCharEncodingHandler'>
       <field name='name' type='char *' info=''/>
@@ -6007,7 +6031,9 @@
     <typedef name='xmlLocationSetPtr' file='xpointer' type='xmlLocationSet *'/>
     <struct name='xmlModule' file='xmlmodule' type='struct _xmlModule'/>
     <typedef name='xmlModuleOption' file='xmlmodule' type='enum'/>
-    <typedef name='xmlModulePtr' file='xmlmodule' type='xmlModule *'/>
+    <typedef name='xmlModulePtr' file='xmlmodule' type='xmlModule *'>
+      <info>A handle to a dynamically loaded module</info>
+    </typedef>
     <struct name='xmlMutex' file='threads' type='struct _xmlMutex'/>
     <typedef name='xmlMutexPtr' file='threads' type='xmlMutex *'/>
     <struct name='xmlNode' file='tree' type='struct _xmlNode'>
@@ -6222,9 +6248,13 @@
     <struct name='xmlRefTable' file='valid' type='struct _xmlHashTable'/>
     <typedef name='xmlRefTablePtr' file='valid' type='xmlRefTable *'/>
     <struct name='xmlRegExecCtxt' file='xmlregexp' type='struct _xmlRegExecCtxt'/>
-    <typedef name='xmlRegExecCtxtPtr' file='xmlregexp' type='xmlRegExecCtxt *'/>
+    <typedef name='xmlRegExecCtxtPtr' file='xmlregexp' type='xmlRegExecCtxt *'>
+      <info>A libxml progressive regular expression evaluation context</info>
+    </typedef>
     <struct name='xmlRegexp' file='xmlregexp' type='struct _xmlRegexp'/>
-    <typedef name='xmlRegexpPtr' file='xmlregexp' type='xmlRegexp *'/>
+    <typedef name='xmlRegexpPtr' file='xmlregexp' type='xmlRegexp *'>
+      <info>A libxml regular expression, they can actually be far more complex thank the POSIX regex expressions.</info>
+    </typedef>
     <struct name='xmlRelaxNG' file='relaxng' type='struct _xmlRelaxNG'/>
     <struct name='xmlRelaxNGParserCtxt' file='relaxng' type='struct _xmlRelaxNGParserCtxt'/>
     <typedef name='xmlRelaxNGParserCtxtPtr' file='relaxng' type='xmlRelaxNGParserCtxt *'/>
@@ -6330,7 +6360,7 @@
       <field name='preserve' type='int' info=' whether to free the document'/>
       <field name='counter' type='int' info=' used to give ononymous components unique names'/>
       <field name='idcDef' type='xmlHashTablePtr' info=''/>
-      <field name='volatiles' type='void *' info=' Misc. helper items (e.g. reference items)'/>
+      <field name='volatiles' type='void *' info=' Deprecated; not used anymore.'/>
     </struct>
     <struct name='xmlSchemaAnnot' file='schemasInternals' type='struct _xmlSchemaAnnot'>
       <field name='next' type='struct _xmlSchemaAnnot *' info=''/>
@@ -6372,7 +6402,7 @@
       <field name='attributeWildcard' type='xmlSchemaWildcardPtr' info=''/>
       <field name='refPrefix' type='const xmlChar *' info=''/>
       <field name='refItem' type='xmlSchemaAttributeGroupPtr' info=' The referenced attribute group'/>
-      <field name='targetNamespace' type='const xmlChar *' info=''/>
+      <field name='targetNamespace' type='const xmlChar *' info=' xmlSchemaAttributeGroupPtr redef Redefinitions'/>
     </struct>
     <typedef name='xmlSchemaAttributeGroupPtr' file='schemasInternals' type='xmlSchemaAttributeGroup *'/>
     <struct name='xmlSchemaAttributeLink' file='schemasInternals' type='struct _xmlSchemaAttributeLink'>
@@ -6529,7 +6559,9 @@
     <struct name='xmlTextReader' file='xmlreader' type='struct _xmlTextReader'/>
     <typedef name='xmlTextReaderLocatorPtr' file='xmlreader' type='void *'/>
     <typedef name='xmlTextReaderMode' file='xmlreader' type='enum'/>
-    <typedef name='xmlTextReaderPtr' file='xmlreader' type='xmlTextReader *'/>
+    <typedef name='xmlTextReaderPtr' file='xmlreader' type='xmlTextReader *'>
+      <info>Pointer to an xmlReader context.</info>
+    </typedef>
     <struct name='xmlTextWriter' file='xmlwriter' type='struct _xmlTextWriter'/>
     <typedef name='xmlTextWriterPtr' file='xmlwriter' type='xmlTextWriter *'/>
     <struct name='xmlURI' file='uri' type='struct _xmlURI'>

Modified: packages/libxml2/trunk/doc/libxml2.xsa
===================================================================
--- packages/libxml2/trunk/doc/libxml2.xsa	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/libxml2.xsa	2005-09-13 16:06:20 UTC (rev 478)
@@ -8,47 +8,45 @@
   </vendor>
   <product id="libxml2">
     <name>libxml2</name>
-    <version>2.6.20</version>
-    <last-release> Jul 10 2005</last-release>
+    <version>2.6.21</version>
+    <last-release> Sep 4 2005</last-release>
     <info-url>http://xmlsoft.org/</info-url>
-    <changes>   -  build fixes: Windows build (Rob Richards), Mingw compilation (Igor
-       Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and
-       andriy at google.com), use gcc weak references to pthread to avoid the
-       pthread dependancy on Linux, compilation problem (Steve Nairn),
-       compiling of subset (Morten Welinder), IPv6/ss_family compilation
-       (William Brack), compilation when disabling parts of the library,
-       standalone test distribution.
-       
-   -  bug fixes: bug in lang(), memory cleanup on errors (William Brack),
-       HTTP query strings (Aron Stansvik), memory leak in DTD (William),
-       integer overflow in XPath (William), nanoftp buffer size, pattern
-       "." apth fixup (Kasimier), leak in tree reported by Malcolm Rowe,
-       replaceNode patch (Brent Hendricks), CDATA with NULL content
-       (Mark Vakoc), xml:base fixup on XInclude (William), pattern
-       fixes (William), attribute bug in exclusive c14n (Aleksey Sanin),
-       xml:space and xml:lang with SAX2 (Rob Richards), namespace 
-       trouble in complex parsing (Malcolm Rowe), XSD type QNames fixes
-       (Kasimier), XPath streaming fixups (William), RelaxNG bug (Rob Richards),
-       Schemas for Schemas fixes (Kasimier), removal of ID (Rob Richards),
-       a small RelaxNG leak, HTML parsing in push mode bug (James Bursa),
-       failure to detect UTF-8 parsing bugs in CDATA sections, areBlanks()
-       heuristic failure, duplicate attributes in DTD bug (William).
-       
-   -  improvements: lot of work on Schemas by Kasimier Buchcik both on 
-       conformance and streaming, Schemas validation messages (Kasimier
-       Buchcik, Matthew Burgess), namespace removal at the python level
-       (Brent Hendricks), Update to new Schemas regression tests from
-       W3C/Nist (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation
-       of xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert),
-       standalone test framework and programs, new DOM import APIs
-       xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and
-       xmlDOMWrapRemoveNode(), extension of xmllint capabilities for
-       SAX and Schemas regression tests, xmlStopParser() available in
-       pull mode too, ienhancement to xmllint --shell namespaces support,
-       Windows port of the standalone testing tools (Kasimier and William),
-       xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug()
-       SAX Schemas APIs, Schemas xmlReader support.
-       
+    <changes>   - build fixes: Cygwin portability fixes (Gerrit P. Haase), calling
+      convention problems on Windows (Marcus Boerger), cleanups based on
+      Linus' sparse tool, update of win32/configure.js (Rob Richards),
+      remove warnings on Windows(Marcus Boerger), compilation without SAX1,
+      detection of the Python binary, use $GCC inestad of $CC = 'gcc' (Andrew
+      W. Nosenko), compilation/link with threads and old gcc, compile
+      problem by C370 on Z/OS, 
+   - bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8
+      bug (Jiri Netolicky), XPath NaN compare bug (William Brack), 
+      htmlParseScript potential bug, Schemas regexp handling of spaces,
+      Base64 Schemas comparisons NIST passes, automata build error xsd:all,
+      xmlGetNodePath for namespaced attributes (Alexander Pohoyda),
+      xmlSchemas foreign namespaces handling, XML Schemas facet comparison
+      (Kupriyanov Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier
+      Buchcik), xml: namespace ahndling in Schemas (Kasimier), empty model
+      group in Schemas (Kasimier), wilcard in Schemas (Kasimier), URI 
+      composition (William), xs:anyType in Schemas (Kasimier), Python resolver
+      emmitting error messages directly, Python xmlAttr.parent (Jakub Piotr
+      Clapa), trying to fix the file path/URI conversion, 
+      xmlTextReaderGetAttribute fix (Rob Richards), xmlSchemaFreeAnnot memleak
+      (Kasimier), HTML UTF-8 serialization, streaming XPath, Schemas determinism
+      detection problem, XInclude bug, Schemas context type (Dean Hill),
+      validation fix (Derek Poon), xmlTextReaderGetAttribute[Ns] namespaces
+      (Rob Richards), Schemas type fix (Kuba Nowakowski), UTF-8 parser bug,
+      error in encoding handling, xmlGetLineNo fixes, bug on entities handling,
+      entity name extraction in error handling with XInclude, text nodes
+      in HTML body tags (Gary Coady), xml:id and IDness at the treee level
+      fixes, XPath streaming patterns bugs.
+   - improvements: structured interfaces for schemas and RNG error reports
+      (Marcus Boerger), optimization of the char data inner loop parsing
+      (thanks to Behdad Esfahbod for the idea), schematron validation
+      though not finished yet, xmlSaveOption to omit XML declaration,
+      keyref match error reports (Kasimier), formal expression handling
+      code not plugged yet, more lax mode for the HTML parser, 
+      parser XML_PARSE_COMPACT option for text nodes allocation.
+   - documentation: xmllint man page had --nonet duplicated
 
 </changes>
   </product>

Modified: packages/libxml2/trunk/doc/news.html
===================================================================
--- packages/libxml2/trunk/doc/news.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/news.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -12,7 +12,21 @@
   <li>Finishing up <a href="http://www.w3.org/TR/xmlschema-1/">XML
   Schemas</a></li>
 </ul><p>The <a href="ChangeLog.html">change log</a> describes the recents commits
-to the <a href="http://cvs.gnome.org/viewcvs/libxml2/">CVS</a> code base.</p><p>There is the list of public releases:</p><h3>2.6.21: Sep 4 2005</h3><ul><li>build fixes: Cygwin portability fixes (Gerrit P. Haase), calling
+to the <a href="http://cvs.gnome.org/viewcvs/libxml2/">CVS</a> code base.</p><p>There is the list of public releases:</p><h3>2.6.22: Sep 12 2005</h3><ul><li>build fixes: compile without schematron (Stéphane Bidoul)</li>
+  <li>bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i,
+      CDATA push parser bug, xmlElemDump problem with XHTML1 doc, 
+      XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx,
+      fix some output formatting for meta element (Rob Richards),
+      script and style XHTML1 serialization (David Madore), Attribute
+      derivation fixups in XSD (Kasimier Buchcik), better IDC error
+      reports (Kasimier Buchcik)
+      </li>
+  <li>improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards),
+      add XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements
+      preparing for derive (Kasimier Buchcik).</li>
+  <li>documentation: generation of gtk-doc like docs, integration with
+      devhelp.</li>
+</ul><h3>2.6.21: Sep 4 2005</h3><ul><li>build fixes: Cygwin portability fixes (Gerrit P. Haase), calling
       convention problems on Windows (Marcus Boerger), cleanups based on
       Linus' sparse tool, update of win32/configure.js (Rob Richards),
       remove warnings on Windows(Marcus Boerger), compilation without SAX1,

Modified: packages/libxml2/trunk/doc/xml.html
===================================================================
--- packages/libxml2/trunk/doc/xml.html	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/doc/xml.html	2005-09-13 16:06:20 UTC (rev 478)
@@ -716,6 +716,23 @@
 
 <p>There is the list of public releases:</p>
 
+<h3>2.6.22: Sep 12 2005</h3>
+<ul>
+  <li>build fixes: compile without schematron (Stéphane Bidoul)</li>
+  <li>bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i,
+      CDATA push parser bug, xmlElemDump problem with XHTML1 doc, 
+      XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx,
+      fix some output formatting for meta element (Rob Richards),
+      script and style XHTML1 serialization (David Madore), Attribute
+      derivation fixups in XSD (Kasimier Buchcik), better IDC error
+      reports (Kasimier Buchcik)
+      </li>
+  <li>improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards),
+      add XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements
+      preparing for derive (Kasimier Buchcik).</li>
+  <li>documentation: generation of gtk-doc like docs, integration with
+      devhelp.</li>
+</ul>
 <h3>2.6.21: Sep 4 2005</h3>
 <ul>
   <li>build fixes: Cygwin portability fixes (Gerrit P. Haase), calling

Modified: packages/libxml2/trunk/error.c
===================================================================
--- packages/libxml2/trunk/error.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/error.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -459,7 +459,7 @@
         return;
     if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
         (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
-	(domain == XML_FROM_IO)) {
+	(domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
 	ctxt = (xmlParserCtxtPtr) ctx;
 	if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
 	    (ctxt->sax->initialized == XML_SAX2_MAGIC))

Modified: packages/libxml2/trunk/example/Makefile.in
===================================================================
--- packages/libxml2/trunk/example/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/example/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,8 +14,6 @@
 
 @SET_MAKE@
 
-SOURCES = $(gjobread_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -36,6 +34,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 noinst_PROGRAMS = gjobread$(EXEEXT)
 subdir = example
@@ -56,14 +55,13 @@
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
- at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/gjobread.Po
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(gjobread_SOURCES)
 DIST_SOURCES = $(gjobread_SOURCES)
@@ -252,6 +250,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -344,24 +344,21 @@
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
@@ -472,7 +469,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"

Modified: packages/libxml2/trunk/include/Makefile.in
===================================================================
--- packages/libxml2/trunk/include/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,6 +33,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 subdir = include
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -238,6 +239,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -319,7 +322,13 @@
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -331,7 +340,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -339,7 +348,13 @@
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -360,7 +375,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -459,15 +474,17 @@
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || mkdir "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="../$(top_distdir)" \
-	        distdir="../$(distdir)/$$subdir" \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -496,7 +513,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"

Modified: packages/libxml2/trunk/include/libxml/Makefile.in
===================================================================
--- packages/libxml2/trunk/include/libxml/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -34,6 +34,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 subdir = include/libxml
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
@@ -48,6 +49,12 @@
 CONFIG_CLEAN_FILES = xmlversion.h
 SOURCES =
 DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(xmlincdir)"
 xmlincHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(xmlinc_HEADERS)
@@ -236,6 +243,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -365,7 +374,7 @@
 	test -z "$(xmlincdir)" || $(mkdir_p) "$(DESTDIR)$(xmlincdir)"
 	@list='$(xmlinc_HEADERS)'; for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " $(xmlincHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(xmlincdir)/$$f'"; \
 	  $(xmlincHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(xmlincdir)/$$f"; \
 	done
@@ -373,7 +382,7 @@
 uninstall-xmlincHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(xmlinc_HEADERS)'; for p in $$list; do \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  f=$(am__strip_dir) \
 	  echo " rm -f '$(DESTDIR)$(xmlincdir)/$$f'"; \
 	  rm -f "$(DESTDIR)$(xmlincdir)/$$f"; \
 	done
@@ -479,7 +488,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -537,8 +546,8 @@
 	clean-libtool ctags distclean distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
-	install-data-am install-exec install-exec-am install-info \
-	install-info-am install-man install-strip \
+	install-data-am install-exec install-exec-am install-exec-hook \
+	install-info install-info-am install-man install-strip \
 	install-xmlincHEADERS installcheck installcheck-am installdirs \
 	maintainer-clean maintainer-clean-generic mostlyclean \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \

Modified: packages/libxml2/trunk/include/libxml/parser.h
===================================================================
--- packages/libxml2/trunk/include/libxml/parser.h	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/parser.h	2005-09-13 16:06:20 UTC (rev 478)
@@ -1171,39 +1171,40 @@
  *
  * Used to examine the existance of features that can be enabled
  * or disabled at compile-time.
+ * They used to be called XML_FEATURE_xxx but this clashed with Expat
  */
 typedef enum {
-    XML_FEATURE_THREAD = 1,
-    XML_FEATURE_TREE = 2,
-    XML_FEATURE_OUTPUT = 3,
-    XML_FEATURE_PUSH = 4,
-    XML_FEATURE_READER = 5,
-    XML_FEATURE_PATTERN = 6,
-    XML_FEATURE_WRITER = 7,
-    XML_FEATURE_SAX1 = 8,
-    XML_FEATURE_FTP = 9,
-    XML_FEATURE_HTTP = 10,
-    XML_FEATURE_VALID = 11,
-    XML_FEATURE_HTML = 12,
-    XML_FEATURE_LEGACY = 13,
-    XML_FEATURE_C14N = 14,
-    XML_FEATURE_CATALOG = 15,
-    XML_FEATURE_XPATH = 16,
-    XML_FEATURE_XPTR = 17,
-    XML_FEATURE_XINCLUDE = 18,
-    XML_FEATURE_ICONV = 19,
-    XML_FEATURE_ISO8859X = 20,
-    XML_FEATURE_UNICODE = 21,
-    XML_FEATURE_REGEXP = 22,
-    XML_FEATURE_AUTOMATA = 23,
-    XML_FEATURE_EXPR = 24,
-    XML_FEATURE_SCHEMAS = 25,
-    XML_FEATURE_SCHEMATRON = 26,
-    XML_FEATURE_MODULES = 27,
-    XML_FEATURE_DEBUG = 28,
-    XML_FEATURE_DEBUG_MEM = 29,
-    XML_FEATURE_DEBUG_RUN = 30,
-    XML_FEATURE_NONE = 99999 /* just to be sure of allocation size */
+    XML_WITH_THREAD = 1,
+    XML_WITH_TREE = 2,
+    XML_WITH_OUTPUT = 3,
+    XML_WITH_PUSH = 4,
+    XML_WITH_READER = 5,
+    XML_WITH_PATTERN = 6,
+    XML_WITH_WRITER = 7,
+    XML_WITH_SAX1 = 8,
+    XML_WITH_FTP = 9,
+    XML_WITH_HTTP = 10,
+    XML_WITH_VALID = 11,
+    XML_WITH_HTML = 12,
+    XML_WITH_LEGACY = 13,
+    XML_WITH_C14N = 14,
+    XML_WITH_CATALOG = 15,
+    XML_WITH_XPATH = 16,
+    XML_WITH_XPTR = 17,
+    XML_WITH_XINCLUDE = 18,
+    XML_WITH_ICONV = 19,
+    XML_WITH_ISO8859X = 20,
+    XML_WITH_UNICODE = 21,
+    XML_WITH_REGEXP = 22,
+    XML_WITH_AUTOMATA = 23,
+    XML_WITH_EXPR = 24,
+    XML_WITH_SCHEMAS = 25,
+    XML_WITH_SCHEMATRON = 26,
+    XML_WITH_MODULES = 27,
+    XML_WITH_DEBUG = 28,
+    XML_WITH_DEBUG_MEM = 29,
+    XML_WITH_DEBUG_RUN = 30,
+    XML_WITH_NONE = 99999 /* just to be sure of allocation size */
 } xmlFeature;
 
 XMLPUBFUN int XMLCALL

Modified: packages/libxml2/trunk/include/libxml/schemasInternals.h
===================================================================
--- packages/libxml2/trunk/include/libxml/schemasInternals.h	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/schemasInternals.h	2005-09-13 16:06:20 UTC (rev 478)
@@ -356,6 +356,7 @@
     const xmlChar *refPrefix;
     xmlSchemaAttributeGroupPtr refItem; /* The referenced attribute group */
     const xmlChar *targetNamespace;
+    /* xmlSchemaAttributeGroupPtr redef;*/  /* Redefinitions */
 };
 
 /**
@@ -553,6 +554,13 @@
 #define XML_SCHEMAS_TYPE_NORMVALUENEEDED    1 << 28
 
 /**
+ * XML_SCHEMAS_TYPE_FIXUP_1:
+ *
+ * First stage of fixup was done.
+ */
+#define XML_SCHEMAS_TYPE_FIXUP_1    1 << 29
+
+/**
  * _xmlSchemaType:
  *
  * Schemas type definition.
@@ -801,16 +809,24 @@
     const xmlChar *targetNamespace;
 };
 
+/*
+* Actually all those flags used for the schema should sit
+* on the schema parser context, since they are used only
+* during parsing an XML schema document, and not available
+* on the component level as per spec.
+*/
 /**
  * XML_SCHEMAS_QUALIF_ELEM:
  *
- * the schema requires qualified elements
+ * Reflects elementFormDefault == qualified in
+ * an XML schema document.
  */
 #define XML_SCHEMAS_QUALIF_ELEM                1 << 0
 /**
  * XML_SCHEMAS_QUALIF_ATTR:
  *
- * the schema requires qualified attributes
+ * Reflects attributeFormDefault == qualified in
+ * an XML schema document.
  */
 #define XML_SCHEMAS_QUALIF_ATTR            1 << 1
 /**
@@ -891,7 +907,7 @@
     int preserve;        /* whether to free the document */
     int counter; /* used to give ononymous components unique names */
     xmlHashTablePtr idcDef;
-    void *volatiles; /* Misc. helper items (e.g. reference items) */    
+    void *volatiles; /* Deprecated; not used anymore. */
 };
 
 XMLPUBFUN void XMLCALL         xmlSchemaFreeType        (xmlSchemaTypePtr type);

Modified: packages/libxml2/trunk/include/libxml/xmlerror.h
===================================================================
--- packages/libxml2/trunk/include/libxml/xmlerror.h	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/xmlerror.h	2005-09-13 16:06:20 UTC (rev 478)
@@ -762,6 +762,11 @@
     XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */
     XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */
     XML_SCHEMAP_SRC_REDEFINE, /* 3081 */
+    XML_SCHEMAP_SRC_IMPORT, /* 3082 */
+    XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */
+    XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */
+    XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */
+    XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */
     XML_MODULE_OPEN = 4900, /* 4900 */
     XML_MODULE_CLOSE, /* 4901 */
     XML_CHECK_FOUND_ELEMENT = 5000,

Modified: packages/libxml2/trunk/include/libxml/xmlsave.h
===================================================================
--- packages/libxml2/trunk/include/libxml/xmlsave.h	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/xmlsave.h	2005-09-13 16:06:20 UTC (rev 478)
@@ -28,7 +28,9 @@
  */
 typedef enum {
     XML_SAVE_FORMAT     = 1<<0,	/* format save output */
-    XML_SAVE_NO_DECL    = 1<<1	/* drop the xml declaration */
+    XML_SAVE_NO_DECL    = 1<<1,	/* drop the xml declaration */
+    XML_SAVE_NO_EMPTY	= 1<<2, /* no empty tags */
+    XML_SAVE_NO_XHTML	= 1<<3  /* disable XHTML1 specific rules */
 } xmlSaveOption;
 
 

Modified: packages/libxml2/trunk/include/libxml/xmlstring.h
===================================================================
--- packages/libxml2/trunk/include/libxml/xmlstring.h	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/xmlstring.h	2005-09-13 16:06:20 UTC (rev 478)
@@ -25,7 +25,6 @@
  * It's unsigned allowing to pinpoint case where char * are assigned
  * to xmlChar * (possibly making serialization back impossible).
  */
-
 typedef unsigned char xmlChar;
 
 /**

Modified: packages/libxml2/trunk/include/libxml/xmlversion.h
===================================================================
--- packages/libxml2/trunk/include/libxml/xmlversion.h	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/include/libxml/xmlversion.h	2005-09-13 16:06:20 UTC (rev 478)
@@ -29,28 +29,28 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXML_DOTTED_VERSION "2.6.21"
+#define LIBXML_DOTTED_VERSION "2.6.22"
 
 /**
  * LIBXML_VERSION:
  *
  * the version number: 1.2.3 value is 1002003
  */
-#define LIBXML_VERSION 20621
+#define LIBXML_VERSION 20622
 
 /**
  * LIBXML_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "1002003"
  */
-#define LIBXML_VERSION_STRING "20621"
+#define LIBXML_VERSION_STRING "20622"
 
 /**
  * LIBXML_VERSION_EXTRA:
  *
  * extra version information, used to show a CVS compilation
  */
-#define LIBXML_VERSION_EXTRA "-CVS2619"
+#define LIBXML_VERSION_EXTRA "-CVS2634"
 
 /**
  * LIBXML_TEST_VERSION:
@@ -58,7 +58,7 @@
  * Macro to check that the libxml version in use is compatible with
  * the version the software has been compiled against
  */
-#define LIBXML_TEST_VERSION xmlCheckVersion(20621);
+#define LIBXML_TEST_VERSION xmlCheckVersion(20622);
 
 #ifndef VMS
 #if 0

Modified: packages/libxml2/trunk/install-sh
===================================================================
--- packages/libxml2/trunk/install-sh	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/install-sh	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2004-04-01.17
+scriptversion=2005-05-14.22
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -58,9 +58,6 @@
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-transformbasename=
-transform_arg=
-instcmd="$mvprog"
 chmodcmd="$chmodprog 0755"
 chowncmd=
 chgrpcmd=
@@ -70,23 +67,27 @@
 src=
 dst=
 dir_arg=
+dstarg=
+no_target_directory=
 
-usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 -d DIRECTORIES...
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
 
-In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
-In the second, create the directory path DIR.
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
 
 Options:
--b=TRANSFORMBASENAME
--c         copy source (using $cpprog) instead of moving (using $mvprog).
+-c         (ignored)
 -d         create directories instead of installing files.
--g GROUP   $chgrp installed files to GROUP.
--m MODE    $chmod installed files to MODE.
--o USER    $chown installed files to USER.
--s         strip installed files (using $stripprog).
--t=TRANSFORM
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
 --help     display this help and exit.
 --version  display version info and exit.
 
@@ -96,14 +97,9 @@
 
 while test -n "$1"; do
   case $1 in
-    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-        shift
+    -c) shift
         continue;;
 
-    -c) instcmd=$cpprog
-        shift
-        continue;;
-
     -d) dir_arg=true
         shift
         continue;;
@@ -113,7 +109,7 @@
         shift
         continue;;
 
-    --help) echo "$usage"; exit 0;;
+    --help) echo "$usage"; exit $?;;
 
     -m) chmodcmd="$chmodprog $2"
         shift
@@ -129,14 +125,20 @@
         shift
         continue;;
 
-    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
-        shift
-        continue;;
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
 
-    --version) echo "$0 $scriptversion"; exit 0;;
+    -T) no_target_directory=true
+	shift
+	continue;;
 
+    --version) echo "$0 $scriptversion"; exit $?;;
+
     *)  # When -d is used, all remaining arguments are directories to create.
-	test -n "$dir_arg" && break
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
         # Otherwise, the last argument is the destination.  Remove it from $@.
 	for arg
 	do
@@ -174,13 +176,13 @@
     src=
 
     if test -d "$dst"; then
-      instcmd=:
+      mkdircmd=:
       chmodcmd=
     else
-      instcmd=$mkdirprog
+      mkdircmd=$mkdirprog
     fi
   else
-    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
     if test ! -f "$src" && test ! -d "$src"; then
@@ -202,12 +204,16 @@
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
       dst=$dst/`basename "$src"`
     fi
   fi
 
   # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
 
   # Make sure that the destination directory exists.
 
@@ -220,7 +226,8 @@
     oIFS=$IFS
     # Some sh's can't handle IFS=/ for some reason.
     IFS='%'
-    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
     IFS=$oIFS
 
     pathcomp=
@@ -229,51 +236,42 @@
       pathcomp=$pathcomp$1
       shift
       if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp" || lasterr=$?
+        $mkdirprog "$pathcomp"
 	# mkdir can fail with a `File exist' error in case several
 	# install-sh are creating the directory concurrently.  This
 	# is OK.
-	test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
+	test -d "$pathcomp" || exit
       fi
       pathcomp=$pathcomp/
     done
   fi
 
   if test -n "$dir_arg"; then
-    $doit $instcmd "$dst" \
+    $doit $mkdircmd "$dst" \
       && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
       && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
 
   else
-    # If we're going to rename the final executable, determine the name now.
-    if test -z "$transformarg"; then
-      dstfile=`basename "$dst"`
-    else
-      dstfile=`basename "$dst" $transformbasename \
-               | sed $transformarg`$transformbasename
-    fi
+    dstfile=`basename "$dst"`
 
-    # don't allow the sed command to completely eliminate the filename.
-    test -z "$dstfile" && dstfile=`basename "$dst"`
-
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
     rmtmp=$dstdir/_rm.$$_
 
     # Trap to clean up those temp files at exit.
-    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
     trap '(exit $?); exit' 1 2 13 15
 
-    # Move or copy the file name to the temp name
-    $doit $instcmd "$src" "$dsttmp" &&
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
 
     # 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.
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
     #
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
@@ -298,7 +296,7 @@
 	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
 	       || {
 		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-		 (exit 1); exit
+		 (exit 1); exit 1
 	       }
 	     else
 	       :
@@ -309,12 +307,12 @@
 	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
 	 }
     }
-  fi || { (exit 1); exit; }
+  fi || { (exit 1); exit 1; }
 done
 
 # The final little trick to "correctly" pass the exit status to the exit trap.
 {
-  (exit 0); exit
+  (exit 0); exit 0
 }
 
 # Local variables:

Modified: packages/libxml2/trunk/libxml.spec.in
===================================================================
--- packages/libxml2/trunk/libxml.spec.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/libxml.spec.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -131,6 +131,10 @@
 %doc doc/*.html doc/html doc/*.gif doc/*.png
 %doc doc/tutorial doc/libxml2-api.xml.gz
 %doc doc/examples
+%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp
+%doc %{_datadir}/gtk-doc/html/libxml2/*.html
+%doc %{_datadir}/gtk-doc/html/libxml2/*.png
+%doc %{_datadir}/gtk-doc/html/libxml2/*.css
 
 %{_libdir}/lib*.so
 %{_libdir}/*a
@@ -143,8 +147,8 @@
 %defattr(-, root, root)
 
 %doc AUTHORS ChangeLog.gz NEWS README Copyright
-%{_libdir}/python*/site-packages/libxml2.py
-%{_libdir}/python*/site-packages/drv_libxml2.py
+%{_libdir}/python*/site-packages/libxml2.py*
+%{_libdir}/python*/site-packages/drv_libxml2.py*
 %{_libdir}/python*/site-packages/libxml2mod*
 %doc python/TODO
 %doc python/libxml2class.txt

Modified: packages/libxml2/trunk/libxml2.spec
===================================================================
--- packages/libxml2/trunk/libxml2.spec	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/libxml2.spec	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,6 +1,6 @@
 Summary: Library providing XML and HTML support
 Name: libxml2
-Version: 2.6.21
+Version: 2.6.22
 Release: 1
 License: MIT
 Group: Development/Libraries
@@ -131,6 +131,10 @@
 %doc doc/*.html doc/html doc/*.gif doc/*.png
 %doc doc/tutorial doc/libxml2-api.xml.gz
 %doc doc/examples
+%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp
+%doc %{_datadir}/gtk-doc/html/libxml2/*.html
+%doc %{_datadir}/gtk-doc/html/libxml2/*.png
+%doc %{_datadir}/gtk-doc/html/libxml2/*.css
 
 %{_libdir}/lib*.so
 %{_libdir}/*a
@@ -143,8 +147,8 @@
 %defattr(-, root, root)
 
 %doc AUTHORS ChangeLog.gz NEWS README Copyright
-%{_libdir}/python*/site-packages/libxml2.py
-%{_libdir}/python*/site-packages/drv_libxml2.py
+%{_libdir}/python*/site-packages/libxml2.py*
+%{_libdir}/python*/site-packages/drv_libxml2.py*
 %{_libdir}/python*/site-packages/libxml2mod*
 %doc python/TODO
 %doc python/libxml2class.txt
@@ -153,8 +157,8 @@
 %doc doc/python.html
 
 %changelog
-* Sun Sep  4 2005 Daniel Veillard <veillard at redhat.com>
-- upstream release 2.6.21 see http://xmlsoft.org/news.html
+* Mon Sep 12 2005 Daniel Veillard <veillard at redhat.com>
+- upstream release 2.6.22 see http://xmlsoft.org/news.html
 
 * Thu Jan  2 2003 Daniel Veillard <veillard at redhat.com>
 - integrated drv_libxml2 xml.sax driver from Stéphane Bidoul

Modified: packages/libxml2/trunk/missing
===================================================================
--- packages/libxml2/trunk/missing	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/missing	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2003-09-02.23
+scriptversion=2005-06-08.21
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
 #   Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
@@ -19,8 +19,8 @@
 
 # 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -60,12 +60,7 @@
     msg="probably too old"
   fi
   ;;
-esac
 
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
-
   -h|--h|--he|--hel|--help)
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
@@ -92,10 +87,12 @@
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Send bug reports to <bug-automake at gnu.org>."
+    exit $?
     ;;
 
   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
     echo "missing $scriptversion (GNU Automake)"
+    exit $?
     ;;
 
   -*)
@@ -104,12 +101,42 @@
     exit 1
     ;;
 
-  aclocal*)
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
        exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
     fi
+    ;;
+esac
 
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
@@ -119,11 +146,6 @@
     ;;
 
   autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -133,11 +155,6 @@
     ;;
 
   autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -157,11 +174,6 @@
     ;;
 
   automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
@@ -173,11 +185,6 @@
     ;;
 
   autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -254,11 +261,6 @@
     ;;
 
   help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
 	 you modified a dependency of a manual page.  You may need the
@@ -279,11 +281,6 @@
     ;;
 
   makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -291,20 +288,23 @@
          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."
+    # The file to touch is that specified with -o ...
     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`
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
     touch $file
     ;;
 
   tar)
     shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
 
     # We have already tried tar in the generic part.
     # Look for gnutar/gtar before invocation to avoid ugly error

Modified: packages/libxml2/trunk/mkinstalldirs
===================================================================
--- packages/libxml2/trunk/mkinstalldirs	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/mkinstalldirs	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,7 +1,7 @@
 #! /bin/sh
 # mkinstalldirs --- make directory hierarchy
 
-scriptversion=2004-02-15.20
+scriptversion=2005-06-29.22
 
 # Original author: Noah Friedman <friedman at prep.ai.mit.edu>
 # Created: 1993-05-16
@@ -12,7 +12,7 @@
 # <automake-patches at gnu.org>.
 
 errstatus=0
-dirmode=""
+dirmode=
 
 usage="\
 Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
@@ -27,7 +27,7 @@
   case $1 in
     -h | --help | --h*)         # -h for help
       echo "$usage"
-      exit 0
+      exit $?
       ;;
     -m)                         # -m PERM arg
       shift
@@ -37,7 +37,7 @@
       ;;
     --version)
       echo "$0 $scriptversion"
-      exit 0
+      exit $?
       ;;
     --)                         # stop option processing
       shift
@@ -103,13 +103,21 @@
 
 for file
 do
-  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  case $file in
+    /*) pathcomp=/ ;;
+    *)  pathcomp= ;;
+  esac
+  oIFS=$IFS
+  IFS=/
+  set fnord $file
   shift
+  IFS=$oIFS
 
-  pathcomp=
   for d
   do
-    pathcomp="$pathcomp$d"
+    test "x$d" = x && continue
+
+    pathcomp=$pathcomp$d
     case $pathcomp in
       -*) pathcomp=./$pathcomp ;;
     esac
@@ -124,7 +132,7 @@
       else
 	if test ! -z "$dirmode"; then
 	  echo "chmod $dirmode $pathcomp"
-	  lasterr=""
+	  lasterr=
 	  chmod "$dirmode" "$pathcomp" || lasterr=$?
 
 	  if test ! -z "$lasterr"; then
@@ -134,7 +142,7 @@
       fi
     fi
 
-    pathcomp="$pathcomp/"
+    pathcomp=$pathcomp/
   done
 done
 

Modified: packages/libxml2/trunk/parser.c
===================================================================
--- packages/libxml2/trunk/parser.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/parser.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -601,181 +601,181 @@
 xmlHasFeature(xmlFeature feature)
 {
     switch (feature) {
-	case XML_FEATURE_THREAD:
+	case XML_WITH_THREAD:
 #ifdef LIBXML_THREAD_ENABLED
 	    return(1);
 #else
 	    return(0);
 #endif
-        case XML_FEATURE_TREE:
+        case XML_WITH_TREE:
 #ifdef LIBXML_TREE_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_OUTPUT:
+        case XML_WITH_OUTPUT:
 #ifdef LIBXML_OUTPUT_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_PUSH:
+        case XML_WITH_PUSH:
 #ifdef LIBXML_PUSH_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_READER:
+        case XML_WITH_READER:
 #ifdef LIBXML_READER_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_PATTERN:
+        case XML_WITH_PATTERN:
 #ifdef LIBXML_PATTERN_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_WRITER:
+        case XML_WITH_WRITER:
 #ifdef LIBXML_WRITER_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_SAX1:
+        case XML_WITH_SAX1:
 #ifdef LIBXML_SAX1_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_FTP:
+        case XML_WITH_FTP:
 #ifdef LIBXML_FTP_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_HTTP:
+        case XML_WITH_HTTP:
 #ifdef LIBXML_HTTP_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_VALID:
+        case XML_WITH_VALID:
 #ifdef LIBXML_VALID_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_HTML:
+        case XML_WITH_HTML:
 #ifdef LIBXML_HTML_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_LEGACY:
+        case XML_WITH_LEGACY:
 #ifdef LIBXML_LEGACY_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_C14N:
+        case XML_WITH_C14N:
 #ifdef LIBXML_C14N_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_CATALOG:
+        case XML_WITH_CATALOG:
 #ifdef LIBXML_CATALOG_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_XPATH:
+        case XML_WITH_XPATH:
 #ifdef LIBXML_XPATH_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_XPTR:
+        case XML_WITH_XPTR:
 #ifdef LIBXML_XPTR_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_XINCLUDE:
+        case XML_WITH_XINCLUDE:
 #ifdef LIBXML_XINCLUDE_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_ICONV:
+        case XML_WITH_ICONV:
 #ifdef LIBXML_ICONV_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_ISO8859X:
+        case XML_WITH_ISO8859X:
 #ifdef LIBXML_ISO8859X_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_UNICODE:
+        case XML_WITH_UNICODE:
 #ifdef LIBXML_UNICODE_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_REGEXP:
+        case XML_WITH_REGEXP:
 #ifdef LIBXML_REGEXP_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_AUTOMATA:
+        case XML_WITH_AUTOMATA:
 #ifdef LIBXML_AUTOMATA_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_EXPR:
+        case XML_WITH_EXPR:
 #ifdef LIBXML_EXPR_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_SCHEMAS:
+        case XML_WITH_SCHEMAS:
 #ifdef LIBXML_SCHEMAS_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_SCHEMATRON:
+        case XML_WITH_SCHEMATRON:
 #ifdef LIBXML_SCHEMATRON_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_MODULES:
+        case XML_WITH_MODULES:
 #ifdef LIBXML_MODULES_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_DEBUG:
+        case XML_WITH_DEBUG:
 #ifdef LIBXML_DEBUG_ENABLED
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_DEBUG_MEM:
+        case XML_WITH_DEBUG_MEM:
 #ifdef DEBUG_MEMORY_LOCATION
             return(1);
 #else
             return(0);
 #endif
-        case XML_FEATURE_DEBUG_RUN:
+        case XML_WITH_DEBUG_RUN:
 #ifdef LIBXML_DEBUG_RUNTIME
             return(1);
 #else
@@ -9432,8 +9432,8 @@
 	    if (ix + 2 > len) return(ix);
 	    if ((utf[ix+1] & 0xc0 ) != 0x80)
 	        return(-ix);
-	    codepoint = (utf[0] & 0x1f) << 6;
-	    codepoint |= utf[1] & 0x3f;
+	    codepoint = (utf[ix] & 0x1f) << 6;
+	    codepoint |= utf[ix+1] & 0x3f;
 	    if (!xmlIsCharQ(codepoint))
 	        return(-ix);
 	    ix += 2;
@@ -9442,9 +9442,9 @@
 	    if (((utf[ix+1] & 0xc0) != 0x80) ||
 	        ((utf[ix+2] & 0xc0) != 0x80))
 		    return(-ix);
-	    codepoint = (utf[0] & 0xf) << 12;
-	    codepoint |= (utf[1] & 0x3f) << 6;
-	    codepoint |= utf[2] & 0x3f;
+	    codepoint = (utf[ix] & 0xf) << 12;
+	    codepoint |= (utf[ix+1] & 0x3f) << 6;
+	    codepoint |= utf[ix+2] & 0x3f;
 	    if (!xmlIsCharQ(codepoint))
 	        return(-ix);
 	    ix += 3;
@@ -9454,10 +9454,10 @@
 	        ((utf[ix+2] & 0xc0) != 0x80) ||
 		((utf[ix+3] & 0xc0) != 0x80))
 		    return(-ix);
-	    codepoint = (utf[0] & 0x7) << 18;
-	    codepoint |= (utf[1] & 0x3f) << 12;
-	    codepoint |= (utf[2] & 0x3f) << 6;
-	    codepoint |= utf[3] & 0x3f;
+	    codepoint = (utf[ix] & 0x7) << 18;
+	    codepoint |= (utf[ix+1] & 0x3f) << 12;
+	    codepoint |= (utf[ix+2] & 0x3f) << 6;
+	    codepoint |= utf[ix+3] & 0x3f;
 	    if (!xmlIsCharQ(codepoint))
 	        return(-ix);
 	    ix += 4;

Modified: packages/libxml2/trunk/python/Makefile.in
===================================================================
--- packages/libxml2/trunk/python/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/python/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,8 +14,6 @@
 
 @SET_MAKE@
 
-SOURCES = $(libxml2mod_la_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -36,6 +34,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 subdir = python
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
@@ -48,6 +47,12 @@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES = setup.py
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(pythondir)"
 pythonLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(python_LTLIBRARIES)
@@ -57,18 +62,17 @@
 @WITH_PYTHON_TRUE at am_libxml2mod_la_OBJECTS = libxml.lo types.lo \
 @WITH_PYTHON_TRUE@	libxml2-py.lo
 libxml2mod_la_OBJECTS = $(am_libxml2mod_la_OBJECTS)
+ at WITH_PYTHON_TRUE@am_libxml2mod_la_rpath = -rpath $(pythondir)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
- at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libxml.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/libxml2-py.Plo ./$(DEPDIR)/types.Plo
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libxml2mod_la_SOURCES)
 DIST_SOURCES = $(am__libxml2mod_la_SOURCES_DIST)
@@ -264,6 +268,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -374,7 +380,7 @@
 	test -z "$(pythondir)" || $(mkdir_p) "$(DESTDIR)$(pythondir)"
 	@list='$(python_LTLIBRARIES)'; for p in $$list; do \
 	  if test -f $$p; then \
-	    f="`echo $$p | sed -e 's|^.*/||'`"; \
+	    f=$(am__strip_dir) \
 	    echo " $(LIBTOOL) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pythondir)/$$f'"; \
 	    $(LIBTOOL) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pythondir)/$$f"; \
 	  else :; fi; \
@@ -382,8 +388,8 @@
 
 uninstall-pythonLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(python_LTLIBRARIES)'; for p in $$list; do \
-	    p="`echo $$p | sed -e 's|^.*/||'`"; \
+	@set -x; list='$(python_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
 	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pythondir)/$$p'"; \
 	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pythondir)/$$p"; \
 	done
@@ -397,7 +403,7 @@
 	  rm -f "$${dir}/so_locations"; \
 	done
 libxml2mod.la: $(libxml2mod_la_OBJECTS) $(libxml2mod_la_DEPENDENCIES) 
-	$(LINK) -rpath $(pythondir) $(libxml2mod_la_LDFLAGS) $(libxml2mod_la_OBJECTS) $(libxml2mod_la_LIBADD) $(LIBS)
+	$(LINK) $(am_libxml2mod_la_rpath) $(libxml2mod_la_LDFLAGS) $(libxml2mod_la_OBJECTS) $(libxml2mod_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -413,24 +419,21 @@
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 .c.lo:
 @am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
@@ -450,7 +453,13 @@
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -462,7 +471,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -470,7 +479,13 @@
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -491,7 +506,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -591,21 +606,24 @@
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || mkdir "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="../$(top_distdir)" \
-	        distdir="../$(distdir)/$$subdir" \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
 	done
 check-am: all-am
 check: check-recursive
+ at WITH_PYTHON_FALSE@all-local:
 all-am: Makefile $(LTLIBRARIES) all-local
 installdirs: installdirs-recursive
 installdirs-am:
@@ -632,11 +650,12 @@
 	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+ at WITH_PYTHON_FALSE@install-data-local:
 clean: clean-recursive
 
 clean-am: clean-generic clean-libtool clean-pythonLTLIBRARIES \

Modified: packages/libxml2/trunk/python/setup.py
===================================================================
--- packages/libxml2/trunk/python/setup.py	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/python/setup.py	2005-09-13 16:06:20 UTC (rev 478)
@@ -226,7 +226,7 @@
 setup (name = "libxml2-python",
        # On *nix, the version number is created from setup.py.in
        # On windows, it is set by configure.js
-       version = "2.6.21",
+       version = "2.6.22",
        description = descr,
        author = "Daniel Veillard",
        author_email = "veillard at redhat.com",

Modified: packages/libxml2/trunk/python/tests/Makefile.in
===================================================================
--- packages/libxml2/trunk/python/tests/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/python/tests/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,6 +33,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 subdir = python/tests
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -229,6 +230,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -410,7 +413,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"

Modified: packages/libxml2/trunk/result/noent/xhtml1
===================================================================
--- packages/libxml2/trunk/result/noent/xhtml1	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/noent/xhtml1	2005-09-13 16:06:20 UTC (rev 478)
@@ -7,7 +7,7 @@
   </head>
   <!-- 4.8 -->
   <script type="text/javascript"><![CDATA[
-  ... unescaped script content ...
+  ... unescaped script < content ...
   ]]></script>
   <body>
     <p>Moved to <a href="http://example.org/">example.org</a>.</p>

Modified: packages/libxml2/trunk/result/schemas/allsg_0_3.err
===================================================================
--- packages/libxml2/trunk/result/schemas/allsg_0_3.err	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/allsg_0_3.err	2005-09-13 16:06:20 UTC (rev 478)
@@ -1 +1 @@
-./test/schemas/allsg_3.xml:6: element gm-B-1: Schemas validity error : Element '{urn:test:foo}gm-B-1': This element is not expected. Expected is one of ( {urn:test:foo}gh-A, {urn:test:foo}gm-A-2, {urn:test:foo}gm-A-1 ).
+./test/schemas/allsg_3.xml:6: element gm-B-1: Schemas validity error : Element '{urn:test:foo}gm-B-1': This element is not expected. Expected is one of ( {urn:test:foo}gh-A, {urn:test:foo}gm-A-1, {urn:test:foo}gm-A-2 ).

Modified: packages/libxml2/trunk/result/schemas/allsg_0_4.err
===================================================================
--- packages/libxml2/trunk/result/schemas/allsg_0_4.err	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/allsg_0_4.err	2005-09-13 16:06:20 UTC (rev 478)
@@ -1 +1 @@
-./test/schemas/allsg_4.xml:6: element gm-A-1: Schemas validity error : Element '{urn:test:foo}gm-A-1': This element is not expected. Expected is one of ( {urn:test:foo}gh-B, {urn:test:foo}gm-B-2, {urn:test:foo}gm-B-1 ).
+./test/schemas/allsg_4.xml:6: element gm-A-1: Schemas validity error : Element '{urn:test:foo}gm-A-1': This element is not expected. Expected is one of ( {urn:test:foo}gh-B, {urn:test:foo}gm-B-1, {urn:test:foo}gm-B-2 ).

Modified: packages/libxml2/trunk/result/schemas/changelog093_1_0.err
===================================================================
--- packages/libxml2/trunk/result/schemas/changelog093_1_0.err	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/changelog093_1_0.err	2005-09-13 16:06:20 UTC (rev 478)
@@ -1 +1 @@
-./test/schemas/changelog093_0.xml:7: element description: Schemas validity error : Element '{http://www.blackperl.com/XML/ChangeLog}description': Duplicate key-sequence ['PL'].
+./test/schemas/changelog093_0.xml:7: element description: Schemas validity error : Element '{http://www.blackperl.com/XML/ChangeLog}description': Duplicate key-sequence ['PL'] in unique identity-constraint '{http://www.blackperl.com/XML/ChangeLog}changelogDescriptionLangConstraint'.

Modified: packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0
===================================================================
--- packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0	2005-09-13 16:06:20 UTC (rev 478)
@@ -0,0 +1 @@
+./test/schemas/derivation-ok-extension_0.xml validates

Modified: packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0.err
===================================================================
--- packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0.err	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/derivation-ok-extension_0_0.err	2005-09-13 16:06:20 UTC (rev 478)
@@ -1 +1 @@
-./test/schemas/derivation-ok-extension_0.xsd:10: element attribute: Schemas parser error : local complex type, attribute decl. 'barA_1': Duplicate attribute use specified.
+./test/schemas/derivation-ok-extension_0.xsd:10: element attribute: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}attribute': Attribute use prohibitions are pointless when extending a type.

Modified: packages/libxml2/trunk/result/schemas/derivation-ok-restriction-2-1-1_0_0.err
===================================================================
--- packages/libxml2/trunk/result/schemas/derivation-ok-restriction-2-1-1_0_0.err	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/derivation-ok-restriction-2-1-1_0_0.err	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,5 +1,5 @@
+./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type: A matching attribute use for the 'required' attribute use 'barB_3' of the base type is missing.
 ./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:16: element attribute: Schemas parser error : local complex type, attribute decl. 'barB_1': The 'optional' use is inconsistent with a matching 'required' use of the base type.
-./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:6: element complexType: Schemas parser error : local complex type: A matching attribute use for the 'required' attribute use 'barB_3' of the base type is missing.
 ./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:23: element attribute: Schemas parser error : local complex type, attribute decl. 'barC_1': Neither a matching attribute use, nor a matching wildcard in the base type does exist.
 ./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:25: element attribute: Schemas parser error : local complex type, attribute decl. 'barC_2': Neither a matching attribute use, nor a matching wildcard in the base type does exist.
 ./test/schemas/derivation-ok-restriction-2-1-1_0.xsd:30: element attribute: Schemas parser error : local complex type, attribute decl. 'barD_1': Neither a matching attribute use, nor a matching wildcard in the base type does exist.

Modified: packages/libxml2/trunk/result/schemas/import1_0_0.err
===================================================================
--- packages/libxml2/trunk/result/schemas/import1_0_0.err	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/schemas/import1_0_0.err	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,2 +1,4 @@
-./test/schemas/import1_0.xsd:10: element import: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}import': The XML document 'test/schemas/import-bad-1_0.imp' to be imported is not a XML schema document.
 I/O warning : failed to load external entity "test/schemas/import1_0bc.imp"
+./test/schemas/import1_0.xsd:11: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'test/schemas/import1_0bc.imp'. Skipping the import.
+./test/schemas/import1_0.xsd:16: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at 'test/schemas/import1_0b.imp' for the namespace 'http://BAR', since this namespace was already imported with the schema located at 'test/schemas/import1_0.imp'.
+./test/schemas/import1_0.xsd:26: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://BAR}bar.B' does not resolve to a(n) element declaration.

Modified: packages/libxml2/trunk/result/xhtml1
===================================================================
--- packages/libxml2/trunk/result/xhtml1	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/xhtml1	2005-09-13 16:06:20 UTC (rev 478)
@@ -7,7 +7,7 @@
   </head>
   <!-- 4.8 -->
   <script type="text/javascript"><![CDATA[
-  ... unescaped script content ...
+  ... unescaped script < content ...
   ]]></script>
   <body>
     <p>Moved to <a href="http://example.org/">example.org</a>.</p>

Modified: packages/libxml2/trunk/result/xhtml1.rde
===================================================================
--- packages/libxml2/trunk/result/xhtml1.rde	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/xhtml1.rde	2005-09-13 16:06:20 UTC (rev 478)
@@ -19,7 +19,7 @@
   
 1 1 script 0 0
 2 3 #text 0 1 
-  ... unescaped script content ...
+  ... unescaped script < content ...
   
 1 15 script 0 0
 1 14 #text 0 1 

Modified: packages/libxml2/trunk/result/xhtml1.rdr
===================================================================
--- packages/libxml2/trunk/result/xhtml1.rdr	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/xhtml1.rdr	2005-09-13 16:06:20 UTC (rev 478)
@@ -19,7 +19,7 @@
   
 1 1 script 0 0
 2 3 #text 0 1 
-  ... unescaped script content ...
+  ... unescaped script < content ...
   
 1 15 script 0 0
 1 14 #text 0 1 

Modified: packages/libxml2/trunk/result/xhtml1.sax
===================================================================
--- packages/libxml2/trunk/result/xhtml1.sax	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/xhtml1.sax	2005-09-13 16:06:20 UTC (rev 478)
@@ -22,7 +22,11 @@
   , 3)
 SAX.startElement(script, type='text/javascript')
 SAX.characters(
-  ... unescaped script conten, 38)
+  ... unescaped script , 24)
+SAX.getEntity(lt)
+SAX.characters(<, 1)
+SAX.characters( content ...
+  , 15)
 SAX.endElement(script)
 SAX.characters(
   , 3)

Modified: packages/libxml2/trunk/result/xhtml1.sax2
===================================================================
--- packages/libxml2/trunk/result/xhtml1.sax2	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/result/xhtml1.sax2	2005-09-13 16:06:20 UTC (rev 478)
@@ -22,7 +22,11 @@
   , 3)
 SAX.startElementNs(script, NULL, NULL, 0, 1, 0, type='text...', 15)
 SAX.characters(
-  ... unescaped script conten, 38)
+  ... unescaped script , 24)
+SAX.getEntity(lt)
+SAX.characters(<, 1)
+SAX.characters( content ...
+  , 15)
 SAX.endElementNs(script, NULL, NULL)
 SAX.characters(
   , 3)

Modified: packages/libxml2/trunk/test/schemas/import1_0.xsd
===================================================================
--- packages/libxml2/trunk/test/schemas/import1_0.xsd	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/test/schemas/import1_0.xsd	2005-09-13 16:06:20 UTC (rev 478)
@@ -6,8 +6,7 @@
 	xmlns:bar="http://BAR"
 	elementFormDefault="qualified">
 	<xsd:import namespace="http://BAR" />
-	<!-- This document is not a XML schema document. -->
-	<xsd:import namespace="http://BAR" schemaLocation="import-bad-1_0.imp" />
+		
 	<!-- This document does not exist. -->
 	<xsd:import namespace="http://BAR" schemaLocation="import1_0bc.imp" />
 	<!-- This document is ok. -->
@@ -22,6 +21,8 @@
 			<xsd:sequence>
 				<xsd:element name="bar"/>								
 				<xsd:element ref="bar:bar.A"/>
+				<!-- The reference cannot be resolved since
+				     "import1_0b.imp" was skipped -->
 				<xsd:element ref="bar:bar.B"/>				
 			</xsd:sequence>	
 		</xsd:complexType>

Modified: packages/libxml2/trunk/test/xhtml1
===================================================================
--- packages/libxml2/trunk/test/xhtml1	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/test/xhtml1	2005-09-13 16:06:20 UTC (rev 478)
@@ -9,7 +9,7 @@
   </head>
   <!-- 4.8 -->
   <script type="text/javascript">
-  ... unescaped script content ...
+  ... unescaped script &lt; content ...
   </script>
   <body>
     <p>Moved to <a href="http://example.org/">example.org</a>.</p>

Modified: packages/libxml2/trunk/testapi.c
===================================================================
--- packages/libxml2/trunk/testapi.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/testapi.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -1054,10 +1054,10 @@
 
 #define gen_nb_xmlFeature 4
 static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_FEATURE_AUTOMATA);
-    if (no == 2) return(XML_FEATURE_C14N);
-    if (no == 3) return(XML_FEATURE_CATALOG);
-    if (no == 4) return(XML_FEATURE_DEBUG);
+    if (no == 1) return(XML_WITH_AUTOMATA);
+    if (no == 2) return(XML_WITH_C14N);
+    if (no == 3) return(XML_WITH_CATALOG);
+    if (no == 4) return(XML_WITH_DEBUG);
     return(0);
 }
 

Modified: packages/libxml2/trunk/xmllint.c
===================================================================
--- packages/libxml2/trunk/xmllint.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/xmllint.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -146,7 +146,7 @@
 static char * schema = NULL;
 static xmlSchemaPtr wxschemas = NULL;
 #endif
-#ifdef LIBXML_SCHEMAS_ENABLED
+#ifdef LIBXML_SCHEMATRON_ENABLED
 static char * schematron = NULL;
 static xmlSchematronPtr wxschematron = NULL;
 #endif
@@ -2713,36 +2713,36 @@
 static void showVersion(const char *name) {
     fprintf(stderr, "%s: using libxml version %s\n", name, xmlParserVersion);
     fprintf(stderr, "   compiled with: ");
-    if (xmlHasFeature(XML_FEATURE_THREAD)) fprintf(stderr, "Threads ");
-    if (xmlHasFeature(XML_FEATURE_TREE)) fprintf(stderr, "Tree ");
-    if (xmlHasFeature(XML_FEATURE_OUTPUT)) fprintf(stderr, "Output ");
-    if (xmlHasFeature(XML_FEATURE_PUSH)) fprintf(stderr, "Push ");
-    if (xmlHasFeature(XML_FEATURE_READER)) fprintf(stderr, "Reader ");
-    if (xmlHasFeature(XML_FEATURE_PATTERN)) fprintf(stderr, "Patterns ");
-    if (xmlHasFeature(XML_FEATURE_WRITER)) fprintf(stderr, "Writer ");
-    if (xmlHasFeature(XML_FEATURE_SAX1)) fprintf(stderr, "SAXv1 ");
-    if (xmlHasFeature(XML_FEATURE_FTP)) fprintf(stderr, "FTP "); 
-    if (xmlHasFeature(XML_FEATURE_HTTP)) fprintf(stderr, "HTTP "); 
-    if (xmlHasFeature(XML_FEATURE_VALID)) fprintf(stderr, "DTDValid ");
-    if (xmlHasFeature(XML_FEATURE_HTML)) fprintf(stderr, "HTML "); 
-    if (xmlHasFeature(XML_FEATURE_LEGACY)) fprintf(stderr, "Legacy "); 
-    if (xmlHasFeature(XML_FEATURE_C14N)) fprintf(stderr, "C14N "); 
-    if (xmlHasFeature(XML_FEATURE_CATALOG)) fprintf(stderr, "Catalog "); 
-    if (xmlHasFeature(XML_FEATURE_XPATH)) fprintf(stderr, "XPath "); 
-    if (xmlHasFeature(XML_FEATURE_XPTR)) fprintf(stderr, "XPointer "); 
-    if (xmlHasFeature(XML_FEATURE_XINCLUDE)) fprintf(stderr, "XInclude "); 
-    if (xmlHasFeature(XML_FEATURE_ICONV)) fprintf(stderr, "Iconv "); 
-    if (xmlHasFeature(XML_FEATURE_ISO8859X)) fprintf(stderr, "ISO8859X "); 
-    if (xmlHasFeature(XML_FEATURE_UNICODE)) fprintf(stderr, "Unicode "); 
-    if (xmlHasFeature(XML_FEATURE_REGEXP)) fprintf(stderr, "Regexps "); 
-    if (xmlHasFeature(XML_FEATURE_AUTOMATA)) fprintf(stderr, "Automata "); 
-    if (xmlHasFeature(XML_FEATURE_EXPR)) fprintf(stderr, "Expr "); 
-    if (xmlHasFeature(XML_FEATURE_SCHEMAS)) fprintf(stderr, "Schemas "); 
-    if (xmlHasFeature(XML_FEATURE_SCHEMATRON)) fprintf(stderr, "Schematron "); 
-    if (xmlHasFeature(XML_FEATURE_MODULES)) fprintf(stderr, "Modules "); 
-    if (xmlHasFeature(XML_FEATURE_DEBUG)) fprintf(stderr, "Debug "); 
-    if (xmlHasFeature(XML_FEATURE_DEBUG_MEM)) fprintf(stderr, "MemDebug "); 
-    if (xmlHasFeature(XML_FEATURE_DEBUG_RUN)) fprintf(stderr, "RunDebug "); 
+    if (xmlHasFeature(XML_WITH_THREAD)) fprintf(stderr, "Threads ");
+    if (xmlHasFeature(XML_WITH_TREE)) fprintf(stderr, "Tree ");
+    if (xmlHasFeature(XML_WITH_OUTPUT)) fprintf(stderr, "Output ");
+    if (xmlHasFeature(XML_WITH_PUSH)) fprintf(stderr, "Push ");
+    if (xmlHasFeature(XML_WITH_READER)) fprintf(stderr, "Reader ");
+    if (xmlHasFeature(XML_WITH_PATTERN)) fprintf(stderr, "Patterns ");
+    if (xmlHasFeature(XML_WITH_WRITER)) fprintf(stderr, "Writer ");
+    if (xmlHasFeature(XML_WITH_SAX1)) fprintf(stderr, "SAXv1 ");
+    if (xmlHasFeature(XML_WITH_FTP)) fprintf(stderr, "FTP "); 
+    if (xmlHasFeature(XML_WITH_HTTP)) fprintf(stderr, "HTTP "); 
+    if (xmlHasFeature(XML_WITH_VALID)) fprintf(stderr, "DTDValid ");
+    if (xmlHasFeature(XML_WITH_HTML)) fprintf(stderr, "HTML "); 
+    if (xmlHasFeature(XML_WITH_LEGACY)) fprintf(stderr, "Legacy "); 
+    if (xmlHasFeature(XML_WITH_C14N)) fprintf(stderr, "C14N "); 
+    if (xmlHasFeature(XML_WITH_CATALOG)) fprintf(stderr, "Catalog "); 
+    if (xmlHasFeature(XML_WITH_XPATH)) fprintf(stderr, "XPath "); 
+    if (xmlHasFeature(XML_WITH_XPTR)) fprintf(stderr, "XPointer "); 
+    if (xmlHasFeature(XML_WITH_XINCLUDE)) fprintf(stderr, "XInclude "); 
+    if (xmlHasFeature(XML_WITH_ICONV)) fprintf(stderr, "Iconv "); 
+    if (xmlHasFeature(XML_WITH_ISO8859X)) fprintf(stderr, "ISO8859X "); 
+    if (xmlHasFeature(XML_WITH_UNICODE)) fprintf(stderr, "Unicode "); 
+    if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(stderr, "Regexps "); 
+    if (xmlHasFeature(XML_WITH_AUTOMATA)) fprintf(stderr, "Automata "); 
+    if (xmlHasFeature(XML_WITH_EXPR)) fprintf(stderr, "Expr "); 
+    if (xmlHasFeature(XML_WITH_SCHEMAS)) fprintf(stderr, "Schemas "); 
+    if (xmlHasFeature(XML_WITH_SCHEMATRON)) fprintf(stderr, "Schematron "); 
+    if (xmlHasFeature(XML_WITH_MODULES)) fprintf(stderr, "Modules "); 
+    if (xmlHasFeature(XML_WITH_DEBUG)) fprintf(stderr, "Debug "); 
+    if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug "); 
+    if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug "); 
     fprintf(stderr, "\n");
 }
 

Modified: packages/libxml2/trunk/xmlsave.c
===================================================================
--- packages/libxml2/trunk/xmlsave.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/xmlsave.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -343,6 +343,10 @@
 		   ctxt->indent_size);
         ctxt->indent[ctxt->indent_nr * ctxt->indent_size] = 0;
     }
+
+	if (xmlSaveNoEmptyTags) {
+		ctxt->options |= XML_SAVE_NO_EMPTY;
+	}
 }
 
 /**
@@ -380,13 +384,6 @@
     }
     memset(ret, 0, sizeof(xmlSaveCtxt));
 
-    /*
-     * Use the options
-     */
-    ret->options = options;
-    if (options & XML_SAVE_FORMAT)
-        ret->format = 1;
-
     if (encoding != NULL) {
         ret->handler = xmlFindCharEncodingHandler(encoding);
 	if (ret->handler == NULL) {
@@ -399,6 +396,19 @@
     }
     xmlSaveCtxtInit(ret);
 
+    /*
+     * Use the options
+     */
+
+	/* Re-check this option as it may already have been set */
+	if ((ret->options & XML_SAVE_NO_EMPTY) && ! (options & XML_SAVE_NO_EMPTY)) {
+		options |= XML_SAVE_NO_EMPTY;
+	}
+
+    ret->options = options;
+    if (options & XML_SAVE_FORMAT)
+        ret->format = 1;
+
     return(ret);
 }
 
@@ -773,7 +783,7 @@
         xmlAttrListDumpOutput(ctxt, cur->properties);
 
     if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
-	(cur->children == NULL) && (!xmlSaveNoEmptyTags)) {
+	(cur->children == NULL) && ((ctxt->options & XML_SAVE_NO_EMPTY) == 0)) {
         xmlOutputBufferWrite(buf, 2, "/>");
 	ctxt->format = format;
 	return;
@@ -855,10 +865,12 @@
     }
 
 #ifdef LIBXML_HTML_ENABLED
-    dtd = xmlGetIntSubset(cur);
-    if (dtd != NULL) {
-	is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
-	if (is_xhtml < 0) is_xhtml = 0;
+    if ((ctxt->options & XML_SAVE_NO_XHTML) == 0) {
+	dtd = xmlGetIntSubset(cur);
+	if (dtd != NULL) {
+	    is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
+	    if (is_xhtml < 0) is_xhtml = 0;
+	}
     }
 #endif
     if (cur->children != NULL) {
@@ -1086,6 +1098,11 @@
     xmlOutputBufferPtr buf;
 
     if (cur == NULL) return;
+    if ((cur->type == XML_DOCUMENT_NODE) ||
+        (cur->type == XML_HTML_DOCUMENT_NODE)) {
+        xmlDocContentDumpOutput(ctxt, (xmlDocPtr) cur);
+	return;
+    }
     if (cur->type == XML_XINCLUDE_START)
 	return;
     if (cur->type == XML_XINCLUDE_END)
@@ -1240,6 +1257,13 @@
 	} else {
 		if (addmeta == 1) {
 			xmlOutputBufferWrite(buf, 1, ">");
+			if (ctxt->format) {
+				xmlOutputBufferWrite(buf, 1, "\n");
+				if (xmlIndentTreeOutput)
+					xmlOutputBufferWrite(buf, ctxt->indent_size *
+					(ctxt->level + 1 > ctxt->indent_nr ? 
+					ctxt->indent_nr : ctxt->level + 1), ctxt->indent);
+			}
 			xmlOutputBufferWriteString(buf,
 				"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
 			if (ctxt->encoding) {
@@ -1247,12 +1271,16 @@
 			} else {
 				xmlOutputBufferWrite(buf, 5, "UTF-8");
 			}
-			xmlOutputBufferWrite(buf, 3, "\" /");
+			xmlOutputBufferWrite(buf, 4, "\" />");
+			if (ctxt->format)
+				xmlOutputBufferWrite(buf, 1, "\n");
+		} else {
+			xmlOutputBufferWrite(buf, 1, ">");
 		}
 	    /*
 	     * C.3. Element Minimization and Empty Element Content
 	     */
-	    xmlOutputBufferWrite(buf, 3, "></");
+	    xmlOutputBufferWrite(buf, 2, "</");
 	    if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
 		xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
 		xmlOutputBufferWrite(buf, 1, ":");
@@ -1264,6 +1292,13 @@
     }
     xmlOutputBufferWrite(buf, 1, ">");
 	if (addmeta == 1) {
+		if (ctxt->format) {
+			xmlOutputBufferWrite(buf, 1, "\n");
+			if (xmlIndentTreeOutput)
+				xmlOutputBufferWrite(buf, ctxt->indent_size *
+				(ctxt->level + 1 > ctxt->indent_nr ? 
+				ctxt->indent_nr : ctxt->level + 1), ctxt->indent);
+		}
 		xmlOutputBufferWriteString(buf,
 			"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
 		if (ctxt->encoding) {
@@ -1288,25 +1323,26 @@
 	xmlNodePtr child = cur->children;
 
 	while (child != NULL) {
-	    if ((child->type == XML_TEXT_NODE) ||
-		(child->type == XML_CDATA_SECTION_NODE)) {
-		/*
-		 * Apparently CDATA escaping for style just break on IE,
-		 * mozilla and galeon, so ...
-		 */
-		if (xmlStrEqual(cur->name, BAD_CAST "style") &&
-		    (xmlStrchr(child->content, '<') == NULL) &&
-		    (xmlStrchr(child->content, '>') == NULL) &&
-		    (xmlStrchr(child->content, '&') == NULL)) {
+	    if (child->type == XML_TEXT_NODE) {
+		if ((xmlStrchr(child->content, '<') == NULL) &&
+		    (xmlStrchr(child->content, '&') == NULL) &&
+		    (xmlStrstr(child->content, BAD_CAST "]]>") == NULL)) {
+		    /* Nothing to escape, so just output as is... */
+		    /* FIXME: Should we do something about "--" also? */
 		    int level = ctxt->level;
 		    int indent = ctxt->format;
 
 		    ctxt->level = 0;
 		    ctxt->format = 0;
-		    xhtmlNodeDumpOutput(ctxt, child);
+		    xmlOutputBufferWriteString(buf, (const char *) child->content);
+		    /* (We cannot use xhtmlNodeDumpOutput() here because
+		     * we wish to leave '>' unescaped!) */
 		    ctxt->level = level;
 		    ctxt->format = indent;
 		} else {
+		    /* We must use a CDATA section.  Unfortunately,
+		     * this will break CSS and JavaScript when read by
+		     * a browser in HTML4-compliant mode. :-( */
 		    start = end = child->content;
 		    while (*end != '\0') {
 			if (*end == ']' &&
@@ -1870,9 +1906,9 @@
 #ifdef LIBXML_HTML_ENABLED
     dtd = xmlGetIntSubset(doc);
     if (dtd != NULL) {
-        is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
-        if (is_xhtml < 0)
-            is_xhtml = 0;
+	is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
+	if (is_xhtml < 0)
+	    is_xhtml = 0;
     }
 
     if (is_xhtml)

Modified: packages/libxml2/trunk/xmlschemas.c
===================================================================
--- packages/libxml2/trunk/xmlschemas.c	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/xmlschemas.c	2005-09-13 16:06:20 UTC (rev 478)
@@ -66,8 +66,12 @@
 
 /* #define ENABLE_PARTICLE_RESTRICTION 1 */
 
+/* #define ENABLE_SCHEMA_SPACES */
+
 /* #define ENABLE_REDEFINE */
 
+/* #define ENABLE_NAMED_LOCALS */
+
 #define DUMP_CONTENT_MODEL
 
 #ifdef LIBXML_READER_ENABLED
@@ -102,10 +106,6 @@
     "attribute use";
 static const xmlChar *xmlSchemaElemModelGrDef = (const xmlChar *)
     "model group";
-#if 0
-static const xmlChar *xmlSchemaElemModelGrRef = (const xmlChar *)
-    "model group ref.";
-#endif
 
 #define IS_SCHEMA(node, type)						\
    ((node != NULL) && (node->ns != NULL) &&				\
@@ -139,6 +139,10 @@
     ((item->type != XML_SCHEMA_TYPE_BASIC) &&       \
      ((item->flags & XML_SCHEMAS_TYPE_INTERNAL_RESOLVED) == 0))
 
+#define TYPE_IS_NOT_FIXEDUP_1(item)                   \
+    (((item)->type != XML_SCHEMA_TYPE_BASIC) &&       \
+     (((item)->flags & XML_SCHEMAS_TYPE_FIXUP_1) == 0))
+
 #define HAS_COMPLEX_CONTENT(item)			 \
     ((item->contentType == XML_SCHEMA_CONTENT_MIXED) ||  \
      (item->contentType == XML_SCHEMA_CONTENT_EMPTY) ||  \
@@ -172,12 +176,62 @@
 
 #define GET_PARTICLE(item) (xmlSchemaParticlePtr) item->subtypes;
 
-#define SUBST_GROUP_AFF(item) item->refDecl
+#define SUBST_GROUP_AFF(item) (item)->refDecl
 
+#define ACTXT_CAST (xmlSchemaAbstractCtxtPtr)
+
 #if 0
-#define WXS_GET_NEXT(item) xmlSchemaGetNextComponent((xmlSchemaBasicItemPtr) item)
+#define WXS_GET_NEXT(item) \
+    xmlSchemaGetNextComponent((xmlSchemaBasicItemPtr) item)
 #endif
 
+#define CAN_PARSE_SCHEMA(b) (((b)->doc != NULL) && ((b)->parsed == 0))
+
+#define HFAILURE if (res == -1) goto exit_failure;
+
+#define HERROR if (res != 0) goto exit_error;
+
+#define HSTOP(ctx) if ((ctx)->stop) goto exit;
+
+#define WXS_CONSTRUCTOR(ctx) (ctx)->constructor
+
+#define WXS_HAS_BUCKETS(ctx) \
+( (WXS_CONSTRUCTOR((ctx))->buckets != NULL) && \
+(WXS_CONSTRUCTOR((ctx))->buckets->nbItems > 0) )
+
+#define WXS_SUBST_GROUPS(ctx) WXS_CONSTRUCTOR((ctx))->substGroups
+
+#define WXS_SCHEMA_BUCKET(ctx) WXS_CONSTRUCTOR((ctx))->bucket
+
+#define WXS_SCHEMA(ctx) (ctx)->schema
+
+#define ADD_LOCAL_ITEM(ctx, item) \
+    xmlSchemaAddItem(&(WXS_SCHEMA_BUCKET(ctx)->locals), item)
+
+#define ADD_GLOBAL_ITEM(ctx, item) \
+    xmlSchemaAddItem(&(WXS_SCHEMA_BUCKET(ctx)->globals), item)
+
+#define WXS_ADD_PENDING_ITEM(ctx, item) \
+    xmlSchemaAddItem(&((ctx)->constructor->pending), item)
+
+#define WXS_IS_RESTRICTION(t) \
+    ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)
+
+#define WXS_IS_EXTENSION(t) \
+    ((t)->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)
+
+/*
+* @b: The schema bucket
+*/
+#define WXS_IS_INCREDEF(t) (((t) == XML_SCHEMA_SCHEMA_INCLUDE) || \
+    ((t) == XML_SCHEMA_SCHEMA_REDEFINE))
+
+#define WXS_IS_IMPMAIN(t) (((t) == XML_SCHEMA_SCHEMA_MAIN) || \
+    ((t) == XML_SCHEMA_SCHEMA_IMPORT))
+
+#define IMPBUCKET_CAST(b) ((xmlSchemaImportPtr) (b))
+#define INCBUCKET_CAST(b) ((xmlSchemaIncludePtr) (b))
+
 #define SUBSET_RESTRICTION  1<<0
 #define SUBSET_EXTENSION    1<<1
 #define SUBSET_SUBSTITUTION 1<<2
@@ -191,10 +245,6 @@
 typedef struct _xmlSchemaNodeInfo xmlSchemaNodeInfo;
 typedef xmlSchemaNodeInfo *xmlSchemaNodeInfoPtr;
 
-
-typedef struct _xmlSchemaItemList xmlSchemaAssemble;
-typedef xmlSchemaAssemble *xmlSchemaAssemblePtr;
-
 typedef struct _xmlSchemaItemList xmlSchemaItemList;
 typedef xmlSchemaItemList *xmlSchemaItemListPtr;
 struct _xmlSchemaItemList {
@@ -203,63 +253,137 @@
     int sizeItems; /* used for dynamic addition of schemata */
 };
 
-/*
-typedef struct _xmlSchemaItemListChain xmlSchemaItemListChain;
-typedef xmlSchemaItemListChain xmlSchemaItemListChainPtr;
-struct _xmlSchemaItemListChain {
-    xmlSchemaItemListChainPtr next;
-    xmlSchemaItemListPtr list;
-}
-*/
-
-/*
-typedef struct _xmlSchemaItemListChain xmlSchemaItemListChain;
-typedef xmlSchemaItemListChain xmlSchemaItemListChainPtr;
-struct _xmlSchemaItemListChain {
-    xmlSchemaItemListChainPtr next;
-    xmlSchemaItemListPtr list;
-}
-*/
-
 typedef struct _xmlSchemaAbstractCtxt xmlSchemaAbstractCtxt;
 typedef xmlSchemaAbstractCtxt *xmlSchemaAbstractCtxtPtr;
 struct _xmlSchemaAbstractCtxt {
     int type;
 };
 
+typedef struct _xmlSchemaBucket xmlSchemaBucket;
+typedef xmlSchemaBucket *xmlSchemaBucketPtr;
+
+#define XML_SCHEMA_SCHEMA_MAIN 0
+#define XML_SCHEMA_SCHEMA_IMPORT 1
+#define XML_SCHEMA_SCHEMA_INCLUDE 2
+#define XML_SCHEMA_SCHEMA_REDEFINE 3
+
 /**
- * xmlSchemaContainer: 
+ * xmlSchemaSchemaRelation: 
+ *
+ * Used to create a graph of schema relationships.
  */
-typedef struct _xmlSchemaContainer xmlSchemaContainer;
-typedef xmlSchemaContainer *xmlSchemaContainerPtr;
-struct _xmlSchemaContainer {
-    xmlSchemaItemListPtr typeDefs;
-    xmlSchemaItemListPtr attrDecls;
-    xmlSchemaItemListPtr elemDecls;
-    xmlSchemaItemListPtr attrGroupDefs;
-    xmlSchemaItemListPtr modelGroupDefs;
-    xmlSchemaItemListPtr notationDecls;
-    xmlSchemaItemListPtr annotations;
+typedef struct _xmlSchemaSchemaRelation xmlSchemaSchemaRelation;
+typedef xmlSchemaSchemaRelation *xmlSchemaSchemaRelationPtr;
+struct _xmlSchemaSchemaRelation {
+    xmlSchemaSchemaRelationPtr next;
+    int type; /* E.g. XML_SCHEMA_SCHEMA_IMPORT */
+    const xmlChar *importNamespace;
+    xmlSchemaBucketPtr bucket;
+};
+
+struct _xmlSchemaBucket {
+    int type;
+    const xmlChar *schemaLocation;
+    const xmlChar *origTargetNamespace;
+    const xmlChar *targetNamespace;
+    xmlDocPtr doc;
+    xmlSchemaSchemaRelationPtr relations;
+    int located;
+    int parsed;
+    int imported;
+    int preserveDoc;
+    xmlSchemaItemListPtr globals; /* Global components. */ 
+    xmlSchemaItemListPtr locals; /* Local components. */
+};
+
+/**
+ * xmlSchemaImport: 
+ * (extends xmlSchemaBucket)
+ *
+ * Reflects a schema. Holds some information
+ * about the schema and its toplevel components. Duplicate
+ * toplevel components are not checked at this level.
+ */
+typedef struct _xmlSchemaImport xmlSchemaImport;
+typedef xmlSchemaImport *xmlSchemaImportPtr;
+struct _xmlSchemaImport {
+    int type; /* Main OR import OR include. */
+    const xmlChar *schemaLocation; /* The URI of the schema document. */
+    /* For chameleon includes, @origTargetNamespace will be NULL */
+    const xmlChar *origTargetNamespace;
+    /* 
+    * For chameleon includes, @targetNamespace will be the
+    * targetNamespace of the including schema. 
+    */
+    const xmlChar *targetNamespace;
+    xmlDocPtr doc; /* The schema node-tree. */
+    /* @relations will hold any included/imported/redefined schemas. */
+    xmlSchemaSchemaRelationPtr relations;
+    int located;
+    int parsed;
+    int imported;
+    int preserveDoc;
+    xmlSchemaItemListPtr globals;
     xmlSchemaItemListPtr locals;
+    /* The imported schema. */
+    xmlSchemaPtr schema;
 };
 
+/*
+* (extends xmlSchemaBucket)
+*/
+typedef struct _xmlSchemaInclude xmlSchemaInclude;
+typedef xmlSchemaInclude *xmlSchemaIncludePtr;
+struct _xmlSchemaInclude {
+    int type;
+    const xmlChar *schemaLocation;
+    const xmlChar *origTargetNamespace;
+    const xmlChar *targetNamespace;
+    xmlDocPtr doc;
+    xmlSchemaSchemaRelationPtr relations;
+    int located;
+    int parsed;
+    int imported;
+    int preserveDoc;
+    xmlSchemaItemListPtr globals; /* Global components. */ 
+    xmlSchemaItemListPtr locals; /* Local components. */
+
+    /* The owning main or import schema bucket. */
+    xmlSchemaImportPtr ownerImport;
+};
+
+typedef struct _xmlSchemaConstructionCtxt xmlSchemaConstructionCtxt;
+typedef xmlSchemaConstructionCtxt *xmlSchemaConstructionCtxtPtr;
+struct _xmlSchemaConstructionCtxt {
+    xmlSchemaPtr schema; /* The main schema. */
+    xmlDictPtr dict;
+    xmlSchemaItemListPtr buckets; /* List of schema buckets. */
+    /* xmlSchemaItemListPtr relations; */ /* List of schema relations. */
+    xmlSchemaBucketPtr bucket; /* The current schema bucket */
+    /* All Components of all schemas that need to be fixed. */
+    xmlSchemaItemListPtr pending;
+    xmlHashTablePtr substGroups;
+};
+
 #define XML_SCHEMA_CTXT_PARSER 1
 #define XML_SCHEMA_CTXT_VALIDATOR 2
 
 struct _xmlSchemaParserCtxt {
     int type;
-    void *userData;             /* user specific data block */
+    void *userData;             /* user specific data block */    
     xmlSchemaValidityErrorFunc error;   /* the callback in case of errors */
     xmlSchemaValidityWarningFunc warning;       /* the callback in case of warning */
     xmlSchemaValidError err;
     int nberrors;
     xmlStructuredErrorFunc serror;
 
+    xmlSchemaConstructionCtxtPtr constructor;
+    int ownsConstructor; /* TODO: Move this to parser flags. */
+
     /* xmlSchemaPtr topschema;	 The main schema */
     /* xmlHashTablePtr namespaces;	 Hash table of namespaces to schemas */
 
     xmlSchemaPtr schema;        /* The schema in use */
-    const xmlChar *container;   /* the current element, group, ... */
     int counter;
 
     const xmlChar *URL;
@@ -278,19 +402,15 @@
     xmlAutomataStatePtr state;
 
     xmlDictPtr dict;		/* dictionnary for interned string names */
-    int        includes;	/* the inclusion level, 0 for root or imports */
     xmlSchemaTypePtr ctxtType; /* The current context simple/complex type */
-    xmlSchemaTypePtr parentItem; /* The current parent schema item */
-    xmlSchemaAssemblePtr assemble;
+    xmlSchemaTypePtr parentItem; /* The current parent schema item */    
     int options;
     xmlSchemaValidCtxtPtr vctxt;
-    const xmlChar **localImports; /* list of locally imported namespaces */
-    int sizeLocalImports;
-    int nbLocalImports;
-    xmlHashTablePtr substGroups;
     int isS4S;
     int isRedefine;
-    xmlSchemaContainerPtr compContainer;
+    int xsiAssemble;
+    int stop; /* If the parser should stop; i.e. a critical error. */
+    const xmlChar *targetNamespace;
 };
 
 #define XML_SCHEMAS_ATTR_UNKNOWN 1
@@ -322,27 +442,7 @@
     xmlSchemaTypeType type;
 };
 
-#define XML_SCHEMA_SCHEMA_REF_IMPORT 1
-#define XML_SCHEMA_SCHEMA_REF_INCLUDE 2
-#define XML_SCHEMA_SCHEMA_REF_REDEFINE 3
-
-#define XML_SCHEMA_SCHEMA_REF_REL_CHILD 1
-#define XML_SCHEMA_SCHEMA_REF_REL_PARENT 2
 /**
- * xmlSchemaSchemaRef: 
- *
- * Used to create a graph of schema relationships.
- */
-typedef struct _xmlSchemaSchemaRef xmlSchemaSchemaRef;
-typedef xmlSchemaSchemaRef *xmlSchemaSchemaRefPtr;
-struct _xmlSchemaSchemaRef {
-    xmlSchemaSchemaRefPtr next;
-    int type; /* E.g. XML_SCHEMA_SCHEMA_REF_IMPORT */
-    int relation;    
-    xmlSchemaPtr schema;
-};
-
-/**
  * xmlSchemaAnnotItem:
  *
  * The abstract base type for annotated schema components.
@@ -438,6 +538,7 @@
     const xmlChar *targetNamespace;
     xmlNodePtr node;
     int flags;
+    xmlSchemaModelGroupDefPtr redef; /* Redefinitions. */
 };
 
 typedef struct _xmlSchemaIDC xmlSchemaIDC;
@@ -737,31 +838,6 @@
     xmlSchemaItemListPtr nodeQNames;
 };
 
-/*
- * These are the entries in the schemas importSchemas hash table
- */
-typedef struct _xmlSchemaImport xmlSchemaImport;
-typedef xmlSchemaImport *xmlSchemaImportPtr;
-struct _xmlSchemaImport {
-    const xmlChar *schemaLocation;
-    xmlSchemaPtr schema; /* not used any more */
-    xmlDocPtr doc;
-    int isMain;
-};
-
-/*
- * These are the entries associated to includes in a schemas
- */
-typedef struct _xmlSchemaInclude xmlSchemaInclude;
-typedef xmlSchemaInclude *xmlSchemaIncludePtr;
-struct _xmlSchemaInclude {
-    xmlSchemaIncludePtr next;
-    const xmlChar *schemaLocation;
-    xmlDocPtr doc;
-    const xmlChar *origTargetNamespace;
-    const xmlChar *targetNamespace;
-};
-
 /**
  * xmlSchemaSubstGroup:
  *
@@ -783,20 +859,18 @@
 static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt,
                                  xmlSchemaPtr schema,
                                  xmlNodePtr node);
-#ifdef ENABLE_REDEFINE
 static int xmlSchemaParseRedefine(xmlSchemaParserCtxtPtr ctxt,
                                  xmlSchemaPtr schema,
                                  xmlNodePtr node);
-#endif
-static void
-xmlSchemaTypeFixup(xmlSchemaTypePtr typeDecl,
-                   xmlSchemaParserCtxtPtr ctxt, const xmlChar * name);
+static int
+xmlSchemaTypeFixup(xmlSchemaTypePtr type,
+                   xmlSchemaParserCtxtPtr ctxt);
 static const xmlChar *
 xmlSchemaFacetTypeToString(xmlSchemaTypeType type);
 static int
 xmlSchemaParseImport(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
                      xmlNodePtr node);
-static void
+static int
 xmlSchemaCheckFacetValues(xmlSchemaTypePtr typeDecl,
                        xmlSchemaParserCtxtPtr ctxt);
 static void
@@ -821,8 +895,9 @@
 			     int subset);
 static void
 xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl,
-				   xmlSchemaParserCtxtPtr ctxt,
-				   const xmlChar * name ATTRIBUTE_UNUSED);
+				   xmlSchemaParserCtxtPtr ctxt);
+static void
+xmlSchemaComponentListFree(xmlSchemaItemListPtr list);
 
 /************************************************************************
  *									*
@@ -863,11 +938,14 @@
 	case XML_SCHEMA_TYPE_PARTICLE:
 	    return(BAD_CAST "particle");
 	case XML_SCHEMA_TYPE_IDC_UNIQUE:
-	    return(BAD_CAST "IDC (unique)");
+	    return(BAD_CAST "unique identity-constraint");
+	    /* return(BAD_CAST "IDC (unique)"); */
 	case XML_SCHEMA_TYPE_IDC_KEY:
-	    return(BAD_CAST "IDC (key)");
+	    return(BAD_CAST "key identity-constraint");
+	    /* return(BAD_CAST "IDC (key)"); */
 	case XML_SCHEMA_TYPE_IDC_KEYREF:
-	    return(BAD_CAST "IDC (keyref)");
+	    return(BAD_CAST "keyref identity-constraint");
+	    /* return(BAD_CAST "IDC (keyref)"); */
 	case XML_SCHEMA_TYPE_ANY:
 	    return(BAD_CAST "wildcard (any)");
 	case XML_SCHEMA_EXTRA_QNAMEREF:
@@ -1099,6 +1177,19 @@
 	xmlSchemaGetComponentName((xmlSchemaBasicItemPtr) item)));
 }
 
+static const xmlChar*
+xmlSchemaGetIDCDesignation(xmlChar **buf, xmlSchemaIDCPtr idc)
+{
+    xmlChar *str = NULL;
+
+    *buf = xmlStrcat(*buf, xmlSchemaCompTypeToString(idc->type));
+    *buf = xmlStrcat(*buf, BAD_CAST " '");
+    *buf = xmlStrcat(*buf, xmlSchemaGetComponentQName(&str, idc));
+    *buf = xmlStrcat(*buf, BAD_CAST "'");
+    FREE_AND_NULL(str);
+    return(*buf);
+}
+
 /**
  * xmlSchemaWildcardPCToString:
  * @pc: the type of processContents
@@ -1623,6 +1714,16 @@
                      extra);
 }
 
+static void
+xmlSchemaPSimpleInternalErr(xmlNodePtr node,
+			    const char *msg, const xmlChar *str)
+{
+     __xmlSimpleError(XML_FROM_SCHEMASP, XML_SCHEMAP_INTERNAL, node,
+	 msg, (const char *) str);
+}
+
+#define WXS_ERROR_TYPE_ERROR 1
+#define WXS_ERROR_TYPE_WARNING 2
 /**
  * xmlSchemaErr3:
  * @ctxt: the validation context
@@ -1636,23 +1737,27 @@
  * Handle a validation error
  */
 static void
-xmlSchemaErr3Line(xmlSchemaAbstractCtxtPtr ctxt,  
-	      int error, xmlNodePtr node, int line, const char *msg,
-	      const xmlChar *str1, const xmlChar *str2,
-	      const xmlChar *str3)
+xmlSchemaErr3Line(xmlSchemaAbstractCtxtPtr ctxt,
+		  xmlErrorLevel errorLevel,
+		  int error, xmlNodePtr node, int line, const char *msg,
+		  const xmlChar *str1, const xmlChar *str2,
+		  const xmlChar *str3)
 {
     xmlStructuredErrorFunc schannel = NULL;
     xmlGenericErrorFunc channel = NULL;
-    void *data = NULL;
+    void *data = NULL;    
     
     if (ctxt != NULL) {
 	if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) {
 	    xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt;
 	    const char *file = NULL;
-
-	    vctxt->nberrors++;
-	    vctxt->err = error;
-	    channel = vctxt->error;
+	    if (errorLevel != XML_ERR_WARNING) {
+		vctxt->nberrors++;
+		vctxt->err = error;
+		channel = vctxt->error;		
+	    } else {
+		channel = vctxt->warning;
+	    }
 	    schannel = vctxt->serror;
 	    data = vctxt->userData;
 
@@ -1692,27 +1797,30 @@
 	    }	       
 	    __xmlRaiseError(schannel, channel, data, ctxt,
 		node, XML_FROM_SCHEMASV,
-		error, XML_ERR_ERROR, file, line,
+		error, errorLevel, file, line,
 		(const char *) str1, (const char *) str2,
 		(const char *) str3, 0, 0, msg, str1, str2, str3);
 
 	} else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) {
 	    xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt;
-
-	    pctxt->nberrors++;
-	    pctxt->err = error;
-	    channel = pctxt->error;
+	    if (errorLevel != XML_ERR_WARNING) {
+		pctxt->nberrors++;
+		pctxt->err = error;
+		channel = pctxt->error;		
+	    } else {
+		channel = pctxt->warning;
+	    }
 	    schannel = pctxt->serror;
 	    data = pctxt->userData;
 	    __xmlRaiseError(schannel, channel, data, ctxt,
-		node, XML_FROM_SCHEMASP,
-		error, XML_ERR_ERROR, NULL, 0,
+		node, XML_FROM_SCHEMASP, error,
+		errorLevel, NULL, 0,
 		(const char *) str1, (const char *) str2,
 		(const char *) str3, 0, 0, msg, str1, str2, str3);
 	} else {
 	    TODO
 	}
-    }       
+    }
 }
 
 /**
@@ -1732,7 +1840,8 @@
 	      int error, xmlNodePtr node, const char *msg,
 	      const xmlChar *str1, const xmlChar *str2, const xmlChar *str3)
 {
-    xmlSchemaErr3Line(actxt, error, node, 0, msg, str1, str2, str3);
+    xmlSchemaErr3Line(actxt, XML_ERR_ERROR, error, node, 0,
+	msg, str1, str2, str3);
 }
 
 static void
@@ -1800,6 +1909,12 @@
 	    vctxt->inode->nsName, vctxt->inode->localName));
 	FREE_AND_NULL(str);
 	*msg = xmlStrcat(*msg, BAD_CAST "': ");
+    } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) {
+	/* 
+	* Hmm, no node while parsing?
+	* Return an empty string, in case NULL will break something.
+	*/
+	*msg = xmlStrdup(BAD_CAST "");
     } else {
 	TODO
 	return (NULL);
@@ -1854,6 +1969,7 @@
     xmlSchemaInternalErr2(actxt, funcName, message, NULL, NULL);
 }
 
+#if 0
 static void
 xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt,
 		     const char *funcName,
@@ -1861,9 +1977,10 @@
 		     const xmlChar *str1,
 		     const xmlChar *str2)
 {
-    xmlSchemaInternalErr2((xmlSchemaAbstractCtxtPtr) pctxt, funcName, message,
+    xmlSchemaInternalErr2(ACTXT_CAST pctxt, funcName, message,
 	str1, str2);
 }
+#endif
 
 static void
 xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt,
@@ -1885,6 +2002,31 @@
 }
 
 static void
+xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt,
+		   xmlParserErrors error,
+		   xmlNodePtr node,
+		   xmlSchemaTypePtr type ATTRIBUTE_UNUSED,
+		   const char *message,
+		   const xmlChar *str1,
+		   const xmlChar *str2,
+		   const xmlChar *str3)
+{
+    xmlChar *msg = NULL;
+
+    xmlSchemaFormatNodeForError(&msg, actxt, node);
+    msg = xmlStrcat(msg, (const xmlChar *) message);
+    msg = xmlStrcat(msg, BAD_CAST ".\n"); 
+    
+    /* URGENT TODO: Set the error code to something sane. */
+    xmlSchemaErr3Line(actxt, XML_ERR_WARNING, error, node, 0,
+	(const char *) msg, str1, str2, str3);
+
+    FREE_AND_NULL(msg)
+}
+
+
+
+static void
 xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt,
 		   xmlParserErrors error,
 		   xmlSchemaPSVIIDCNodePtr idcNode,
@@ -1898,7 +2040,7 @@
     msg = xmlStrdup(BAD_CAST "Element '%s': ");        
     msg = xmlStrcat(msg, (const xmlChar *) message);
     msg = xmlStrcat(msg, BAD_CAST ".\n");
-    xmlSchemaErr3Line((xmlSchemaAbstractCtxtPtr) vctxt,
+    xmlSchemaErr3Line(ACTXT_CAST vctxt, XML_ERR_ERROR,
 	error, NULL, idcNode->nodeLine, (const char *) msg,
 	xmlSchemaFormatQName(&qname,
 	    vctxt->nodeQNames->items[idcNode->nodeQNameID +1],
@@ -2260,12 +2402,12 @@
 }
 
 #define VERROR(err, type, msg) \
-    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt, err, NULL, type, msg, NULL, NULL);
+    xmlSchemaCustomErr(ACTXT_CAST vctxt, err, NULL, type, msg, NULL, NULL);
 
-#define VERROR_INT(func, msg) xmlSchemaInternalErr((xmlSchemaAbstractCtxtPtr) vctxt, func, msg);
+#define VERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST vctxt, func, msg);
 
-#define PERROR_INT(func, msg) xmlSchemaInternalErr((xmlSchemaAbstractCtxtPtr) pctxt, func, msg);
-#define PERROR_INT2(func, msg) xmlSchemaInternalErr((xmlSchemaAbstractCtxtPtr) ctxt, func, msg);
+#define PERROR_INT(func, msg) xmlSchemaInternalErr(ACTXT_CAST pctxt, func, msg);
+#define PERROR_INT2(func, msg) xmlSchemaInternalErr(ACTXT_CAST ctxt, func, msg);
 
 #define AERROR_INT(func, msg) xmlSchemaInternalErr(actxt, func, msg);
 
@@ -2661,7 +2803,7 @@
 {
     xmlChar *msg = NULL;
     
-    xmlSchemaFormatNodeForError(&msg, (xmlSchemaAbstractCtxtPtr) ctxt, node);
+    xmlSchemaFormatNodeForError(&msg, ACTXT_CAST ctxt, node);
     if (message == NULL) {
 	/*
 	* Use default messages.
@@ -2823,29 +2965,6 @@
 }
 
 /**
- * xmlSchemaNewSchema:
- * @ctxt:  a schema validation context
- *
- * Allocate a new Schema structure.
- *
- * Returns the newly allocated structure or NULL in case or error
- */
-static xmlSchemaAssemblePtr
-xmlSchemaNewAssemble(void)
-{
-    xmlSchemaAssemblePtr ret;
-
-    ret = (xmlSchemaAssemblePtr) xmlMalloc(sizeof(xmlSchemaAssemble));
-    if (ret == NULL) {
-        /* xmlSchemaPErrMemory(ctxt, "allocating assemble info", NULL); */
-        return (NULL);
-    }
-    memset(ret, 0, sizeof(xmlSchemaAssemble));
-    ret->items = NULL;
-    return (ret);
-}
-
-/**
  * xmlSchemaNewFacet:
  *
  * Allocate a new Facet structure.
@@ -2958,152 +3077,159 @@
     xmlFree(list);
 }
 
-static xmlSchemaContainerPtr
-xmlSchemaContainerCreate(void)
-{
-    xmlSchemaContainerPtr ret;
-
-    ret = (xmlSchemaContainerPtr) xmlMalloc(sizeof(xmlSchemaContainer));
-    if (ret == NULL) {
-	xmlSchemaPErrMemory(NULL, "allocating component container",
-	    NULL);
-	return(NULL);
-    }
-    memset(ret, 0, sizeof(xmlSchemaContainer));
-    return(ret);
-}
-
 static void
-xmlSchemaContainerFree(xmlSchemaContainerPtr cont)
+xmlSchemaBucketFree(xmlSchemaBucketPtr bucket)
 {
-    if (cont == NULL)
+    if (bucket == NULL)
 	return;
-    if (cont->typeDefs != NULL)
-	xmlSchemaItemListFree(cont->typeDefs);
-    if (cont->attrDecls != NULL)
-	xmlSchemaItemListFree(cont->attrDecls);
-    if (cont->elemDecls != NULL)
-	xmlSchemaItemListFree(cont->elemDecls);
-    if (cont->attrGroupDefs != NULL)
-	xmlSchemaItemListFree(cont->attrGroupDefs);
-    if (cont->modelGroupDefs != NULL)
-	xmlSchemaItemListFree(cont->modelGroupDefs);
-    if (cont->notationDecls != NULL)
-	xmlSchemaItemListFree(cont->notationDecls);
-    if (cont->annotations != NULL)
-	xmlSchemaItemListFree(cont->annotations);
-    if (cont->locals != NULL)
-	xmlSchemaItemListFree(cont->locals);
-    xmlFree(cont);
+    if (bucket->globals != NULL) {
+	xmlSchemaComponentListFree(bucket->globals);
+	xmlSchemaItemListFree(bucket->globals);
+    }
+    if (bucket->locals != NULL) {
+	xmlSchemaComponentListFree(bucket->locals);
+	xmlSchemaItemListFree(bucket->locals);	
+    }
+    if (bucket->relations != NULL) {
+	xmlSchemaSchemaRelationPtr prev, cur = bucket->relations;
+	do {
+	    prev = cur;	    
+	    cur = cur->next;
+	    xmlFree(prev);
+	} while (cur != NULL);
+    }
+    if ((! bucket->preserveDoc) && (bucket->doc != NULL)) {
+	xmlFreeDoc(bucket->doc);
+    } 
+    if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) {
+	if (IMPBUCKET_CAST(bucket)->schema != NULL)
+	    xmlSchemaFree(IMPBUCKET_CAST(bucket)->schema);
+    }
+    xmlFree(bucket);
 }
 
-/**
- * xmlSchemaAddElementSubstitutionMember:
- * @pctxt:  a schema parser context
- * @head:  the head of the substitution group
- * @member: the new member of the substitution group
- *
- * Allocate a new annotation structure.
- *
- * Returns the newly allocated structure or NULL in case or error
- */
-static int
-xmlSchemaAddElementSubstitutionMember(xmlSchemaParserCtxtPtr pctxt,
-				      xmlSchemaElementPtr head,
-				      xmlSchemaElementPtr member)
+static xmlSchemaBucketPtr
+xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
+			 int type,
+			 const xmlChar *targetNamespace)
 {
-    xmlSchemaSubstGroupPtr substGroup;
+    xmlSchemaBucketPtr ret;
+    xmlSchemaConstructionCtxtPtr constr = pctxt->constructor;
+    int size;
+    xmlSchemaPtr mainSchema;
 
-    if (pctxt == NULL)
-	return (-1);
-
-    if (pctxt->substGroups == NULL) {
-	pctxt->substGroups = xmlHashCreateDict(10, pctxt->dict);
-	if (pctxt->substGroups == NULL)
-	    return (-1);
+    if (constr->schema == NULL) {
+	PERROR_INT("xmlSchemaBucketCreate",
+	    "no main schema on constructor");
+	return(NULL);
     }
-    substGroup = xmlHashLookup2(pctxt->substGroups, head->name,
-	head->targetNamespace);
-    if (substGroup == NULL) {
+    mainSchema = constr->schema;
+    /* Create the schema bucket. */
+    if (WXS_IS_INCREDEF(type))
+	size = sizeof(xmlSchemaInclude);
+    else
+	size = sizeof(xmlSchemaImport);
+    ret = (xmlSchemaBucketPtr) xmlMalloc(size);
+    if (ret == NULL) {
+	xmlSchemaPErrMemory(NULL, "allocating schema bucket", NULL);
+	return(NULL);
+    }
+    memset(ret, 0, size);
+    ret->targetNamespace = targetNamespace;
+    ret->type = type;
+    /* 
+    * The following will assure that only the first bucket is marked as
+    * XML_SCHEMA_SCHEMA_MAIN and it points to the *main* schema.
+    * For each following import buckets an xmlSchema will be created.
+    */
+    if (! WXS_HAS_BUCKETS(pctxt)) {
+	if (WXS_IS_INCREDEF(type)) {
+	    PERROR_INT("xmlSchemaBucketCreate",
+		"first bucket but it's an include or redefine");
+	    xmlSchemaBucketFree(ret);
+	    return(NULL);
+	}
+	/* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */ 
+	ret->type = XML_SCHEMA_SCHEMA_MAIN;
+	/* Point to the *main* schema. */
+	IMPBUCKET_CAST(ret)->schema = mainSchema;
+    } else {
+	if (type == XML_SCHEMA_SCHEMA_MAIN) {	    
+	    PERROR_INT("xmlSchemaBucketCreate",
+		"main bucket but it's not the first one");
+	    xmlSchemaBucketFree(ret);
+	    return(NULL);
+	} else if (type == XML_SCHEMA_SCHEMA_IMPORT) {	    
+	    /*
+	    * Create a schema for imports.
+	    */
+	    IMPBUCKET_CAST(ret)->schema = xmlSchemaNewSchema(pctxt);
+	    if (IMPBUCKET_CAST(ret)->schema == NULL) {
+		xmlSchemaBucketFree(ret);
+		return(NULL);
+	    }
+	}
+    }    
+    if (WXS_IS_IMPMAIN(type)) {
 	int res;
-
-	substGroup = (xmlSchemaSubstGroupPtr) xmlMalloc(sizeof(xmlSchemaSubstGroup));
-	if (substGroup == NULL) {
-	    xmlSchemaPErrMemory(NULL,
-		"xmlSchemaAddElementSubstitution, allocating a substitution "
-		"group container",
-		NULL);
-	    return (-1);
+	/* Imports got into the "schemasImports" slot of the main *schema*. */
+	if (mainSchema->schemasImports == NULL) {
+	    mainSchema->schemasImports = xmlHashCreateDict(5, constr->dict);
+	    if (mainSchema->schemasImports == NULL) {
+		xmlSchemaBucketFree(ret);
+		return(NULL);
+	    }
 	}
-	substGroup->members = xmlSchemaItemListCreate();
-	if (substGroup->members == NULL) {
-	    xmlFree(substGroup);
-	    return (-1);
+	if (targetNamespace == NULL)
+	    res = xmlHashAddEntry(mainSchema->schemasImports,
+		XML_SCHEMAS_NO_NAMESPACE, ret);
+	else
+	    res = xmlHashAddEntry(mainSchema->schemasImports,
+		targetNamespace, ret);
+	if (res != 0) {
+	    PERROR_INT("xmlSchemaBucketCreate",
+		"failed to add the schema bucket to the hash");
+	    xmlSchemaBucketFree(ret);
+	    return(NULL);
 	}
-	substGroup->head = head;
+    } else {
+	/* Set the @ownerImport of an include bucket. */
+	if (WXS_IS_IMPMAIN(constr->bucket->type))
+	    INCBUCKET_CAST(ret)->ownerImport =
+		IMPBUCKET_CAST(constr->bucket);
+	else
+	    INCBUCKET_CAST(ret)->ownerImport =
+		INCBUCKET_CAST(constr->bucket)->ownerImport;
 
-	res = xmlHashAddEntry2(pctxt->substGroups,
-	    head->name, head->targetNamespace, substGroup);
-	if (res != 0) {
-	    xmlFree(substGroup->members);
-	    xmlFree(substGroup);
-	    xmlSchemaPErr(pctxt, member->node,
-		XML_SCHEMAP_INTERNAL,
-		"Internal error: xmlSchemaAddElementSubstitution, "
-		"failed to add a new substitution group container for "
-		"'%s'.\n", head->name, NULL);
-	    return (-1);
+	/* Includes got into the "includes" slot of the *main* schema. */
+	if (mainSchema->includes == NULL) {
+	    mainSchema->includes = xmlSchemaItemListCreate();
+	    if (mainSchema->includes == NULL) {
+		xmlSchemaBucketFree(ret);
+		return(NULL);
+	    }	    
 	}
+	xmlSchemaItemListAdd(mainSchema->includes, ret);
     }
-    if (substGroup->members->items == NULL) {
-	substGroup->members->items = (void **) xmlMalloc(
-	    5 * sizeof(xmlSchemaElementPtr));
-	if (substGroup->members->items == NULL) {
-	    xmlSchemaPErrMemory(NULL,
-		"allocating list of substitution group members", NULL);
-	    return (-1);
-	}
-	substGroup->members->sizeItems = 5;
-    } else if (substGroup->members->sizeItems <=
-	    substGroup->members->nbItems) {
-	substGroup->members->sizeItems *= 2;
-	substGroup->members->items = (void **) xmlRealloc(
-	    substGroup->members->items,
-	    substGroup->members->sizeItems * sizeof(xmlSchemaElementPtr));
-	if (substGroup->members->items == NULL) {
-	    xmlSchemaPErrMemory(NULL,
-		"re-allocating list of substitution group members", NULL);
-	    substGroup->members->sizeItems = 0;
-	    return (-1);
-	}
-    }
-    ((xmlSchemaElementPtr *) substGroup->members->items)
-	[substGroup->members->nbItems++] = (void *) member;
-    return (0);
+    /* 
+    * Add to list of all buckets; this is used for lookup
+    * during schema construction time only.
+    */
+    if (xmlSchemaItemListAdd(constr->buckets, ret) == -1)
+	return(NULL);
+    return(ret);
 }
 
-/**
- * xmlSchemaGetElementSubstitutionGroup:
- * @pctxt:  a schema parser context
- * @head:  the head of the substitution group
- * @member: the new member of the substitution group
- *
- * Allocate a new annotation structure.
- *
- * Returns the newly allocated structure or NULL in case or error
- */
-static xmlSchemaSubstGroupPtr
-xmlSchemaGetElementSubstitutionGroup(xmlSchemaParserCtxtPtr pctxt,
-				     xmlSchemaElementPtr head)
+static int
+xmlSchemaAddItem(xmlSchemaItemListPtr *list, void *item)
 {
-    if (pctxt == NULL)
-	return (NULL);
-
-    if (pctxt->substGroups == NULL)
-	return (NULL);
-
-    return ((xmlSchemaSubstGroupPtr) xmlHashLookup2(pctxt->substGroups,
-	head->name, head->targetNamespace));
+    if (*list == NULL) {
+	*list = xmlSchemaItemListCreate();
+	if (*list == NULL)
+	    return(-1);
+    }
+    xmlSchemaItemListAdd(*list, item);
+    return(0);
 }
 
 /**
@@ -3131,57 +3257,6 @@
 }
 
 /**
- * xmlSchemaFreeImport:
- * @import:  a schema import structure
- *
- * Deallocate an import structure
- */
-static void
-xmlSchemaFreeImport(xmlSchemaImportPtr import)
-{
-    if (import == NULL)
-        return;
-
-    xmlSchemaFree(import->schema);
-    xmlFreeDoc(import->doc);
-    xmlFree(import);
-}
-
-/**
- * xmlSchemaFreeInclude:
- * @include:  a schema include structure
- *
- * Deallocate an include structure
- */
-static void
-xmlSchemaFreeInclude(xmlSchemaIncludePtr include)
-{
-    if (include == NULL)
-        return;
-
-    xmlFreeDoc(include->doc);
-    xmlFree(include);
-}
-
-/**
- * xmlSchemaFreeIncludeList:
- * @includes:  a schema include list
- *
- * Deallocate an include structure
- */
-static void
-xmlSchemaFreeIncludeList(xmlSchemaIncludePtr includes)
-{
-    xmlSchemaIncludePtr next;
-
-    while (includes != NULL) {
-        next = includes->next;
-	xmlSchemaFreeInclude(includes);
-	includes = next;
-    }
-}
-
-/**
  * xmlSchemaFreeNotation:
  * @schema:  a schema notation structure
  *
@@ -3298,37 +3373,6 @@
 }
 
 /**
- * xmlSchemaFreeQNameRef:
- * @item: a QName reference structure
- *
- * Deallocatea a QName reference structure.
- */
-static void
-xmlSchemaFreeSubstGroup(xmlSchemaSubstGroupPtr item)
-{
-    if (item == NULL)
-	return;
-    if (item->members != NULL)
-	xmlSchemaItemListFree(item->members);
-    xmlFree(item);
-}
-
-static int
-xmlSchemaAddVolatile(xmlSchemaPtr schema,
-		     xmlSchemaBasicItemPtr item)
-{
-    if (schema->volatiles == NULL) {
-	schema->volatiles = (void *) xmlSchemaItemListCreate();
-	if (schema->volatiles == NULL) {
-	    xmlSchemaPErrMemory(NULL,
-		"allocating list of volatiles", NULL);
-	    return (-1);
-	}
-    }
-    return(xmlSchemaItemListAdd((xmlSchemaItemListPtr) schema->volatiles, item));
-}
-
-/**
  * xmlSchemaFreeTypeLinkList:
  * @alink: a type link
  *
@@ -3512,93 +3556,96 @@
 }
 
 /**
- * xmlSchemaFreeParticle:
+ * xmlSchemaFreeTypeList:
  * @type:  a schema type structure
  *
  * Deallocate a Schema Type structure.
  */
 static void
-xmlSchemaFreeParticle(xmlSchemaParticlePtr item)
+xmlSchemaFreeTypeList(xmlSchemaTypePtr type)
 {
-    if (item->annot != NULL)
-	xmlSchemaFreeAnnot(item->annot);
-    xmlFree(item);
-}
+    xmlSchemaTypePtr next;
 
-/**
- * xmlSchemaFreeMiscComponents:
- * @item:  a schema component
- *
- * Deallocates misc. schema component structures.
- */
-static void
-xmlSchemaFreeMiscComponents(xmlSchemaTreeItemPtr item)
-{
-    if (item == NULL)
-        return;
-    switch (item->type) {
-	case XML_SCHEMA_TYPE_PARTICLE:
-	    xmlSchemaFreeParticle((xmlSchemaParticlePtr) item);
-	    return;
-	case XML_SCHEMA_TYPE_SEQUENCE:
-	case XML_SCHEMA_TYPE_CHOICE:
-	case XML_SCHEMA_TYPE_ALL:
-	    xmlSchemaFreeModelGroup((xmlSchemaModelGroupPtr) item);
-	    return;
-	case XML_SCHEMA_TYPE_ANY:
-	case XML_SCHEMA_TYPE_ANY_ATTRIBUTE:
-	    xmlSchemaFreeWildcard((xmlSchemaWildcardPtr) item);
-	    break;
-	default:
-	    /* TODO: This should never be hit. */
-	    TODO
-	    return;
+    while (type != NULL) {
+        next = type->redef;
+	xmlSchemaFreeType(type);
+	type = next;
     }
 }
 
 static void
-xmlSchemaFreeVolatiles(xmlSchemaPtr schema)
+xmlSchemaComponentListFree(xmlSchemaItemListPtr list)
 {
-    if (schema->volatiles == NULL)
+    if ((list == NULL) || (list->nbItems == 0))
 	return;
     {
-	xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->volatiles;
 	xmlSchemaTreeItemPtr item;
+	xmlSchemaTreeItemPtr *items = (xmlSchemaTreeItemPtr *) list->items;
 	int i;
 
 	for (i = 0; i < list->nbItems; i++) {
-	    if (list->items[i] != NULL) {
-		item = (xmlSchemaTreeItemPtr) list->items[i];
-		switch (item->type) {
-		    case XML_SCHEMA_EXTRA_QNAMEREF:
-			xmlSchemaFreeQNameRef((xmlSchemaQNameRefPtr) item);
-			break;
-		    default:
-			xmlSchemaFreeMiscComponents(item);
-		}
+	    item = items[i];
+	    if (item == NULL)
+		continue;	    
+	    switch (item->type) {
+		case XML_SCHEMA_TYPE_SIMPLE:
+		case XML_SCHEMA_TYPE_COMPLEX:
+		    xmlSchemaFreeTypeList((xmlSchemaTypePtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_ATTRIBUTE:
+		    xmlSchemaFreeAttribute((xmlSchemaAttributePtr) item);
+		    break;		
+		case XML_SCHEMA_TYPE_ELEMENT:
+		    xmlSchemaFreeElement((xmlSchemaElementPtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_PARTICLE:
+		    if (item->annot != NULL)
+			xmlSchemaFreeAnnot(item->annot);
+		    xmlFree(item);
+		    break;
+		case XML_SCHEMA_TYPE_SEQUENCE:
+		case XML_SCHEMA_TYPE_CHOICE:
+		case XML_SCHEMA_TYPE_ALL:
+		    xmlSchemaFreeModelGroup((xmlSchemaModelGroupPtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
+		    xmlSchemaFreeAttributeGroup(
+			(xmlSchemaAttributeGroupPtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_GROUP:
+		    xmlSchemaFreeModelGroupDef(
+			(xmlSchemaModelGroupDefPtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_ANY:
+		case XML_SCHEMA_TYPE_ANY_ATTRIBUTE:
+		    xmlSchemaFreeWildcard((xmlSchemaWildcardPtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_IDC_KEY:
+		case XML_SCHEMA_TYPE_IDC_UNIQUE:
+		case XML_SCHEMA_TYPE_IDC_KEYREF:
+		    xmlSchemaFreeIDC((xmlSchemaIDCPtr) item);
+		    break;
+		case XML_SCHEMA_TYPE_NOTATION:
+		    xmlSchemaFreeNotation((xmlSchemaNotationPtr) item);
+		    break;
+		case XML_SCHEMA_EXTRA_QNAMEREF:
+		    xmlSchemaFreeQNameRef((xmlSchemaQNameRefPtr) item);
+		    break;
+		default: {
+		    /* TODO: This should never be hit. */
+		    xmlSchemaPSimpleInternalErr(NULL,
+			"Internal error: xmlSchemaComponentListFree, "
+			"unexpected component type '%s'\n",
+			(const xmlChar *)
+			    xmlSchemaCompTypeToString(item->type));
+			 }
+		    break;
 	    }
 	}
-	xmlSchemaItemListFree(list);
+	list->nbItems = 0;
     }
 }
-/**
- * xmlSchemaFreeTypeList:
- * @type:  a schema type structure
- *
- * Deallocate a Schema Type structure.
- */
-static void
-xmlSchemaFreeTypeList(xmlSchemaTypePtr type)
-{
-    xmlSchemaTypePtr next;
 
-    while (type != NULL) {
-        next = type->redef;
-	xmlSchemaFreeType(type);
-	type = next;
-    }
-}
-
 /**
  * xmlSchemaFree:
  * @schema:  a schema structure
@@ -3610,40 +3657,44 @@
 {
     if (schema == NULL)
         return;
-
+    /* @volatiles is not used anymore :-/ */
     if (schema->volatiles != NULL)
-	xmlSchemaFreeVolatiles(schema);
+	TODO
+    /*
+    * Note that those slots are not responsible for freeing
+    * schema components anymore; this will now be done by
+    * the schema buckets.
+    */
     if (schema->notaDecl != NULL)
-        xmlHashFree(schema->notaDecl,
-                    (xmlHashDeallocator) xmlSchemaFreeNotation);
+        xmlHashFree(schema->notaDecl, NULL);
     if (schema->attrDecl != NULL)
-        xmlHashFree(schema->attrDecl,
-                    (xmlHashDeallocator) xmlSchemaFreeAttribute);
+        xmlHashFree(schema->attrDecl, NULL);
     if (schema->attrgrpDecl != NULL)
-        xmlHashFree(schema->attrgrpDecl,
-                    (xmlHashDeallocator) xmlSchemaFreeAttributeGroup);
+        xmlHashFree(schema->attrgrpDecl, NULL);
     if (schema->elemDecl != NULL)
-        xmlHashFree(schema->elemDecl,
-                    (xmlHashDeallocator) xmlSchemaFreeElement);
+        xmlHashFree(schema->elemDecl, NULL);
     if (schema->typeDecl != NULL)
-        xmlHashFree(schema->typeDecl,
-                    (xmlHashDeallocator) xmlSchemaFreeTypeList);
+        xmlHashFree(schema->typeDecl, NULL);
     if (schema->groupDecl != NULL)
-        xmlHashFree(schema->groupDecl,
-                    (xmlHashDeallocator) xmlSchemaFreeModelGroupDef);
+        xmlHashFree(schema->groupDecl, NULL);
     if (schema->idcDef != NULL)
-        xmlHashFree(schema->idcDef,
-                    (xmlHashDeallocator) xmlSchemaFreeIDC);
+        xmlHashFree(schema->idcDef, NULL);
+
     if (schema->schemasImports != NULL)
 	xmlHashFree(schema->schemasImports,
-		    (xmlHashDeallocator) xmlSchemaFreeImport);
+		    (xmlHashDeallocator) xmlSchemaBucketFree);
     if (schema->includes != NULL) {
-        xmlSchemaFreeIncludeList((xmlSchemaIncludePtr) schema->includes);
+	xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->includes;
+	int i;
+	for (i = 0; i < list->nbItems; i++) {
+	    xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]);	
+	}
+	xmlSchemaItemListFree(list);
     }
     if (schema->annot != NULL)
         xmlSchemaFreeAnnot(schema->annot);
-    if (schema->doc != NULL && !schema->preserve)
-        xmlFreeDoc(schema->doc);
+    /* Never free the doc here, since this will be done by the buckets. */
+
     xmlDictFree(schema->dict);
     xmlFree(schema);
 }
@@ -4070,7 +4121,7 @@
     xmlAttrPtr prop;
 
     if ((node == NULL) || (name == NULL))
-	return(NULL);
+	return(NULL);    
     prop = node->properties;
     while (prop != NULL) {
 	if ((prop->ns != NULL) &&
@@ -4113,7 +4164,7 @@
     xmlChar *val;
     const xmlChar *ret;
 
-    val = xmlGetProp(node, BAD_CAST name);
+    val = xmlGetNoNsProp(node, BAD_CAST name);
     if (val == NULL)
         return(NULL);
     ret = xmlDictLookup(ctxt->dict, val, -1);
@@ -4127,6 +4178,23 @@
  * 									*
  ************************************************************************/
 
+#define WXS_FIND_GLOBAL_ITEM(slot)			\
+    if (xmlStrEqual(nsName, schema->targetNamespace)) { \
+	ret = xmlHashLookup(schema->slot, name); \
+	if (ret != NULL) goto exit; \
+    } \
+    if (xmlHashSize(schema->schemasImports) > 1) { \
+	xmlSchemaImportPtr import; \
+	if (nsName == NULL) \
+	    import = xmlHashLookup(schema->schemasImports, \
+		XML_SCHEMAS_NO_NAMESPACE); \
+	else \
+	    import = xmlHashLookup(schema->schemasImports, nsName); \
+	if (import == NULL) \
+	    goto exit; \
+	ret = xmlHashLookup(import->schema->slot, name); \
+    }
+
 /**
  * xmlSchemaGetElem:
  * @schema:  the schema context
@@ -4141,40 +4209,21 @@
 xmlSchemaGetElem(xmlSchemaPtr schema, const xmlChar * name,
                  const xmlChar * nsName)
 {
-    xmlSchemaElementPtr ret;
-
+    xmlSchemaElementPtr ret = NULL;
+    
     if ((name == NULL) || (schema == NULL))
-        return (NULL);
-
-        ret = xmlHashLookup2(schema->elemDecl, name, nsName);
-        if ((ret != NULL) &&
-	    (ret->flags & XML_SCHEMAS_ELEM_GLOBAL)) {
-            return (ret);
-    } else
-	ret = NULL;
-
-    /*
-    * Removed since imported components will be hold by the main schema only.
-    *
-    if (namespace == NULL)
-	import = xmlHashLookup(schema->schemasImports, XML_SCHEMAS_NO_NAMESPACE);
-    else
-    import = xmlHashLookup(schema->schemasImports, namespace);
-    if (import != NULL) {
-	ret = xmlSchemaGetElem(import->schema, name, namespace, level + 1);
-	if ((ret != NULL) && (ret->flags & XML_SCHEMAS_ELEM_GLOBAL)) {
-	    return (ret);
-	} else
-	    ret = NULL;
-    }
-    */
+        return(NULL);
+    if (schema != NULL) {
+	WXS_FIND_GLOBAL_ITEM(elemDecl)
+    }   
+exit:
 #ifdef DEBUG
     if (ret == NULL) {
-        if (namespace == NULL)
+        if (nsName == NULL)
             fprintf(stderr, "Unable to lookup element decl. %s", name);
         else
             fprintf(stderr, "Unable to lookup element decl. %s:%s", name,
-                    namespace);
+                    nsName);
     }
 #endif
     return (ret);
@@ -4182,9 +4231,9 @@
 
 /**
  * xmlSchemaGetType:
- * @schema:  the schemas context
- * @name:  the type name
- * @ns:  the type namespace
+ * @schema:  the main schema
+ * @name:  the type's name
+ * nsName:  the type's namespace
  *
  * Lookup a type in the schemas or the predefined types
  *
@@ -4194,40 +4243,30 @@
 xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name,
                  const xmlChar * nsName)
 {
-    xmlSchemaTypePtr ret;
+    xmlSchemaTypePtr ret = NULL;
 
     if (name == NULL)
-        return (NULL);
+        return (NULL);    
+    /* First try the built-in types. */
+    if ((nsName != NULL) && xmlStrEqual(nsName, xmlSchemaNs)) {	
+	ret = xmlSchemaGetPredefinedType(name, nsName);
+	if (ret != NULL)
+	    goto exit;
+	/*
+	* Note that we try the parsed schemas as well here
+	* since one might have parsed the S4S, which contain more
+	* than the built-in types.
+	* TODO: Can we optimize this?
+	*/
+    }
     if (schema != NULL) {
-        ret = xmlHashLookup2(schema->typeDecl, name, nsName);
-        if ((ret != NULL) && (ret->flags & XML_SCHEMAS_TYPE_GLOBAL)) {	    
-	    if (ret->redef != NULL) {
-		/*
-		* Return the last redefinition.
-		*/
-		return(ret->redef);
-	    }
-            return (ret);
-	}
+	WXS_FIND_GLOBAL_ITEM(typeDecl)
+    } 
+exit:
+    if ((ret != NULL) && (ret->redef != NULL)) {
+	/* Return the last redefinition. */
+	ret = ret->redef;
     }
-    ret = xmlSchemaGetPredefinedType(name, nsName);
-    if (ret != NULL)
-	return (ret);
-    /*
-    * Removed, since the imported components will be grafted on the
-    * main schema only.
-    if (namespace == NULL)
-	import = xmlHashLookup(schema->schemasImports, XML_SCHEMAS_NO_NAMESPACE);
-    else
-    import = xmlHashLookup(schema->schemasImports, namespace);
-    if (import != NULL) {
-	ret = xmlSchemaGetType(import->schema, name, namespace);
-	if ((ret != NULL) && (ret->flags & XML_SCHEMAS_TYPE_GLOBAL)) {
-	    return (ret);
-	} else
-	    ret = NULL;
-    }
-    */
 #ifdef DEBUG
     if (ret == NULL) {
         if (nsName == NULL)
@@ -4237,7 +4276,7 @@
                     nsName);
     }
 #endif
-    return (NULL);
+    return (ret);
 }
 
 /**
@@ -4252,41 +4291,23 @@
  */
 static xmlSchemaAttributePtr
 xmlSchemaGetAttributeDecl(xmlSchemaPtr schema, const xmlChar * name,
-                 const xmlChar * namespace)
+                 const xmlChar * nsName)
 {
-    xmlSchemaAttributePtr ret;
+    xmlSchemaAttributePtr ret = NULL;
 
     if ((name == NULL) || (schema == NULL))
         return (NULL);
-
-
-    ret = xmlHashLookup2(schema->attrDecl, name, namespace);
-    if ((ret != NULL) && (ret->flags & XML_SCHEMAS_ATTR_GLOBAL))
-	return (ret);
-    else
-	ret = NULL;
-    /*
-    * Removed, since imported components will be hold by the main schema only.
-    *
-    if (namespace == NULL)
-	import = xmlHashLookup(schema->schemasImports, XML_SCHEMAS_NO_NAMESPACE);
-    else
-	import = xmlHashLookup(schema->schemasImports, namespace);
-    if (import != NULL) {
-	ret = xmlSchemaGetAttributeDecl(import->schema, name, namespace);
-	if ((ret != NULL) && (ret->flags & XML_SCHEMAS_ATTR_GLOBAL)) {
-	    return (ret);
-	} else
-	    ret = NULL;
+    if (schema != NULL) {
+	WXS_FIND_GLOBAL_ITEM(attrDecl)
     }
-    */
+exit:
 #ifdef DEBUG
     if (ret == NULL) {
-        if (namespace == NULL)
+        if (nsName == NULL)
             fprintf(stderr, "Unable to lookup attribute %s", name);
         else
             fprintf(stderr, "Unable to lookup attribute %s:%s", name,
-                    namespace);
+                    nsName);
     }
 #endif
     return (ret);
@@ -4304,41 +4325,29 @@
  */
 static xmlSchemaAttributeGroupPtr
 xmlSchemaGetAttributeGroup(xmlSchemaPtr schema, const xmlChar * name,
-                 const xmlChar * namespace)
+                 const xmlChar * nsName)
 {
-    xmlSchemaAttributeGroupPtr ret;
+    xmlSchemaAttributeGroupPtr ret = NULL;
 
     if ((name == NULL) || (schema == NULL))
         return (NULL);
-
-
-    ret = xmlHashLookup2(schema->attrgrpDecl, name, namespace);
-    if ((ret != NULL) && (ret->flags & XML_SCHEMAS_ATTRGROUP_GLOBAL))
-	return (ret);
-    else
-	ret = NULL;
-    /*
-    * Removed since imported components will be hold by the main schema only.
-    *
-    if (namespace == NULL)
-	import = xmlHashLookup(schema->schemasImports, XML_SCHEMAS_NO_NAMESPACE);
-    else
-	import = xmlHashLookup(schema->schemasImports, namespace);
-    if (import != NULL) {
-	ret = xmlSchemaGetAttributeGroup(import->schema, name, namespace);
-	if ((ret != NULL) && (ret->flags & XML_SCHEMAS_ATTRGROUP_GLOBAL))
-	    return (ret);
-	else
-	    ret = NULL;
+    if (schema != NULL) {
+	WXS_FIND_GLOBAL_ITEM(attrgrpDecl)
     }
+exit:
+    /* TODO:
+    if ((ret != NULL) && (ret->redef != NULL)) {
+	* Return the last redefinition. *
+	ret = ret->redef;
+    }
     */
 #ifdef DEBUG
     if (ret == NULL) {
-        if (namespace == NULL)
+        if (nsName == NULL)
             fprintf(stderr, "Unable to lookup attribute group %s", name);
         else
             fprintf(stderr, "Unable to lookup attribute group %s:%s", name,
-                    namespace);
+                    nsName);
     }
 #endif
     return (ret);
@@ -4354,43 +4363,66 @@
  *
  * Returns the group definition or NULL if not found.
  */
-static xmlSchemaTypePtr
+static xmlSchemaModelGroupDefPtr
 xmlSchemaGetGroup(xmlSchemaPtr schema, const xmlChar * name,
-                 const xmlChar * namespace)
+                 const xmlChar * nsName)
 {
-    xmlSchemaTypePtr ret;
+    xmlSchemaModelGroupDefPtr ret = NULL;
 
     if ((name == NULL) || (schema == NULL))
         return (NULL);
-
-    ret = xmlHashLookup2(schema->groupDecl, name, namespace);
-    /*
-    * Removed since imported components will be hold by the main schema only.
-    *
-    if (namespace == NULL)
-	import = xmlHashLookup(schema->schemasImports, XML_SCHEMAS_NO_NAMESPACE);
-    else
-	import = xmlHashLookup(schema->schemasImports, namespace);
-    if (import != NULL) {
-	ret = xmlSchemaGetGroup(import->schema, name, namespace);
-	if ((ret != NULL) && (ret->flags & XML_SCHEMAS_TYPE_GLOBAL))
-	    return (ret);
-	else
-	    ret = NULL;
+    if (schema != NULL) {
+	WXS_FIND_GLOBAL_ITEM(groupDecl)
     }
-    */
+exit:
+    if ((ret != NULL) && (ret->redef != NULL)) {
+	/* Return the last redefinition. */
+	ret = ret->redef;
+    }
 #ifdef DEBUG
     if (ret == NULL) {
-        if (namespace == NULL)
+        if (nsName == NULL)
             fprintf(stderr, "Unable to lookup group %s", name);
         else
             fprintf(stderr, "Unable to lookup group %s:%s", name,
-                    namespace);
+                    nsName);
     }
 #endif
     return (ret);
 }
 
+static xmlSchemaNotationPtr
+xmlSchemaGetNotation(xmlSchemaPtr schema,
+		     const xmlChar *name,
+		     const xmlChar *nsName)
+{
+    xmlSchemaNotationPtr ret = NULL;
+
+    if ((name == NULL) || (schema == NULL))
+        return (NULL);
+    if (schema != NULL) {
+	WXS_FIND_GLOBAL_ITEM(notaDecl)
+    }
+exit:
+    return (ret);
+}
+
+static xmlSchemaIDCPtr
+xmlSchemaGetIDC(xmlSchemaPtr schema,
+		const xmlChar *name,
+		const xmlChar *nsName)
+{
+    xmlSchemaIDCPtr ret = NULL;
+
+    if ((name == NULL) || (schema == NULL))
+        return (NULL);
+    if (schema != NULL) {
+	WXS_FIND_GLOBAL_ITEM(idcDef)
+    }
+exit:
+    return (ret);
+}
+
 /**
  * xmlSchemaGetNamedComponent:
  * @schema:  the schema
@@ -4401,7 +4433,7 @@
  *
  * Returns the group definition or NULL if not found.
  */
-static xmlSchemaTreeItemPtr
+static xmlSchemaBasicItemPtr
 xmlSchemaGetNamedComponent(xmlSchemaPtr schema,
 			   xmlSchemaTypeType itemType,
 			   const xmlChar *name,
@@ -4409,12 +4441,13 @@
 {
     switch (itemType) {
 	case XML_SCHEMA_TYPE_GROUP:
-	    return ((xmlSchemaTreeItemPtr) xmlSchemaGetGroup(schema,
+	    return ((xmlSchemaBasicItemPtr) xmlSchemaGetGroup(schema,
 		name, targetNs));
 	case XML_SCHEMA_TYPE_ELEMENT:
-	    return ((xmlSchemaTreeItemPtr) xmlSchemaGetElem(schema,
+	    return ((xmlSchemaBasicItemPtr) xmlSchemaGetElem(schema,
 		name, targetNs));
 	default:
+	    TODO
 	    return (NULL);
     }
 }
@@ -4458,54 +4491,17 @@
     return (1);
 }
 
-/**
- * xmlSchemaAddAssembledItem:
- * @ctxt:  a schema parser context
- * @schema:  the schema being built
- * @item:  the item
- *
- * Add a item to the schema's list of current items.
- * This is used if the schema was already constructed and
- * new schemata need to be added to it.
- * *WARNING* this interface is highly subject to change.
- *
- * Returns 0 if suceeds and -1 if an internal error occurs.
- */
-static int
-xmlSchemaAddAssembledItem(xmlSchemaParserCtxtPtr ctxt,
-			   xmlSchemaTypePtr item)
-{
-    static int growSize = 100;
-    xmlSchemaAssemblePtr ass;
+#define WXS_GET_GLOBAL_HASH(c, s, slot) \
+{ \
+    if (WXS_IS_IMPMAIN((c)->type)) \
+	table = &(IMPBUCKET_CAST((c))->schema->slot); \
+    else \
+	table = &(INCBUCKET_CAST((c))->ownerImport->schema->slot); \
+} \
 
-    ass = ctxt->assemble;
-    if (ass->sizeItems < 0) {
-	/* If disabled. */
-	return (0);
-    }
-    if (ass->sizeItems <= 0) {
-	ass->items = (void **) xmlMalloc(growSize * sizeof(xmlSchemaTypePtr));
-	if (ass->items == NULL) {
-	    xmlSchemaPErrMemory(ctxt,
-		"allocating new item buffer", NULL);
-	    return (-1);
-	}
-	ass->sizeItems = growSize;
-    } else if (ass->sizeItems <= ass->nbItems) {
-	ass->sizeItems *= 2;
-	ass->items = (void **) xmlRealloc(ass->items,
-	    ass->sizeItems * sizeof(xmlSchemaTypePtr));
-	if (ass->items == NULL) {
-	    xmlSchemaPErrMemory(ctxt,
-		"growing item buffer", NULL);
-	    ass->sizeItems = 0;
-	    return (-1);
-	}
-    }
-    /* ass->items[ass->nbItems++] = (void *) item; */
-    ((xmlSchemaTypePtr *) ass->items)[ass->nbItems++] = (void *) item;
-    return (0);
-}
+#define WXS_INIT_GLOBAL_HASH(ctx, tbl) \
+if (*(tbl) == NULL) *(tbl) = xmlHashCreateDict(10, (ctx)->dict); \
+if (*(tbl) == NULL) { if (ret != NULL) xmlFree(ret); return (NULL); }
 
 /**
  * xmlSchemaAddNotation:
@@ -4523,41 +4519,37 @@
                      const xmlChar *name)
 {
     xmlSchemaNotationPtr ret = NULL;
+    xmlHashTablePtr *table = NULL;
     int val;
 
     if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
         return (NULL);
 
-    if (schema->notaDecl == NULL)
-        schema->notaDecl = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->notaDecl == NULL)
-        return (NULL);
+    WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, notaDecl)
 
+    WXS_INIT_GLOBAL_HASH(ctxt, table)
     ret = (xmlSchemaNotationPtr) xmlMalloc(sizeof(xmlSchemaNotation));
     if (ret == NULL) {
         xmlSchemaPErrMemory(ctxt, "add annotation", NULL);
         return (NULL);
     }
     memset(ret, 0, sizeof(xmlSchemaNotation));
+    ret->type = XML_SCHEMA_TYPE_NOTATION;
     ret->name = xmlDictLookup(ctxt->dict, name, -1);
-    val = xmlHashAddEntry2(schema->notaDecl, name, schema->targetNamespace,
-                           ret);
+
+    val = xmlHashAddEntry(*table, ret->name, ret);
     if (val != 0) {
-	/*
-	* TODO: This should never happen, since a unique name will be computed.
-	* If it fails, then an other internal error must have occured.
-	*/
 	xmlSchemaPErr(ctxt, (xmlNodePtr) ctxt->doc,
-		      XML_SCHEMAP_REDEFINED_NOTATION,
-                      "Annotation declaration '%s' is already declared.\n",
-                      name, NULL);
+	    XML_SCHEMAP_REDEFINED_NOTATION,
+	    "A notation declaration with the name '%s' does already exist.\n",
+	    name, NULL);
         xmlFree(ret);
         return (NULL);
     }
+    ADD_GLOBAL_ITEM(ctxt, ret);
     return (ret);
 }
 
-
 /**
  * xmlSchemaAddAttribute:
  * @ctxt:  a schema parser context
@@ -4572,26 +4564,16 @@
  */
 static xmlSchemaAttributePtr
 xmlSchemaAddAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
-                      const xmlChar * name, const xmlChar * namespace,
+                      const xmlChar * name, const xmlChar * nsName,
 		      xmlNodePtr node, int topLevel)
 {
     xmlSchemaAttributePtr ret = NULL;
     int val;
+    xmlHashTablePtr *table;
 
-    if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
+    if ((ctxt == NULL) || (schema == NULL))
         return (NULL);
 
-#ifdef DEBUG
-    fprintf(stderr, "Adding attribute %s\n", name);
-    if (namespace != NULL)
-	fprintf(stderr, "  target namespace %s\n", namespace);
-#endif
-
-    if (schema->attrDecl == NULL)
-        schema->attrDecl = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->attrDecl == NULL)
-        return (NULL);
-
     ret = (xmlSchemaAttributePtr) xmlMalloc(sizeof(xmlSchemaAttribute));
     if (ret == NULL) {
         xmlSchemaPErrMemory(ctxt, "allocating attribute", NULL);
@@ -4599,11 +4581,13 @@
     }
     memset(ret, 0, sizeof(xmlSchemaAttribute));
     ret->name = xmlDictLookup(ctxt->dict, name, -1);
-    ret->targetNamespace = namespace;
-    val = xmlHashAddEntry3(schema->attrDecl, name,
-                           namespace, ctxt->container, ret);
-    if (val != 0) {
-	if (topLevel) {
+    ret->targetNamespace = nsName;
+
+    if (topLevel) {
+	WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, attrDecl)
+	WXS_INIT_GLOBAL_HASH(ctxt, table)
+	val = xmlHashAddEntry(*table, name, ret);
+	if (val != 0) {
 	    xmlSchemaPCustomErr(ctxt,
 		XML_SCHEMAP_REDEFINED_ATTR,
 		NULL, NULL, node,
@@ -4611,36 +4595,11 @@
 		"already exist", name);
 	    xmlFree(ret);
 	    return (NULL);
-	} else {
-	    char buf[30];
-	    /*
-	    * Using the ctxt->container for xmlHashAddEntry3 is ambigious
-	    * in the scenario:
-	    * 1. multiple top-level complex types have different target
-	    *    namespaces but have the SAME NAME; this can happen if
-	    *	 schemata are  imported
-	    * 2. those complex types contain attributes with an equal name
-	    * 3. those attributes are in no namespace
-	    * We will compute a new context string.
-	    */
-	    snprintf(buf, 29, "#aCont%d", ctxt->counter++ + 1);
-	    val = xmlHashAddEntry3(schema->attrDecl, name,
-		namespace, xmlDictLookup(ctxt->dict, BAD_CAST buf, -1), ret);
-
-	    if (val != 0) {
-		xmlSchemaPCustomErr(ctxt,
-		    XML_SCHEMAP_INTERNAL,
-		    NULL, NULL, node,
-		    "Internal error: xmlSchemaAddAttribute, "
-		    "a dublicate attribute declaration with the name '%s' "
-		    "could not be added to the hash.", name);
-		xmlFree(ret);
-		return (NULL);
-	    }
 	}
-    }
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) ret);
+	ADD_GLOBAL_ITEM(ctxt, ret);
+    } else
+	ADD_LOCAL_ITEM(ctxt, ret);
+    WXS_ADD_PENDING_ITEM(ctxt, ret);
     return (ret);
 }
 
@@ -4656,41 +4615,51 @@
  */
 static xmlSchemaAttributeGroupPtr
 xmlSchemaAddAttributeGroup(xmlSchemaParserCtxtPtr ctxt,
-                           xmlSchemaPtr schema, const xmlChar * name,
-			   xmlNodePtr node)
+                           xmlSchemaPtr schema,
+			   const xmlChar * name,
+			   xmlNodePtr node,
+			   int topLevel)
 {
     xmlSchemaAttributeGroupPtr ret = NULL;
+    xmlHashTablePtr *table = NULL;
     int val;
 
-    if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
+    if ((ctxt == NULL) || (schema == NULL))
         return (NULL);
 
-    if (schema->attrgrpDecl == NULL)
-        schema->attrgrpDecl = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->attrgrpDecl == NULL)
-        return (NULL);
-
-    ret =
-        (xmlSchemaAttributeGroupPtr)
+    ret = (xmlSchemaAttributeGroupPtr)
         xmlMalloc(sizeof(xmlSchemaAttributeGroup));
     if (ret == NULL) {
-        xmlSchemaPErrMemory(ctxt, "allocating attribute group", NULL);
-        return (NULL);
+	xmlSchemaPErrMemory(ctxt, "allocating attribute group", NULL);
+	return (NULL);
     }
     memset(ret, 0, sizeof(xmlSchemaAttributeGroup));
-    ret->name = xmlDictLookup(ctxt->dict, name, -1);
-    val = xmlHashAddEntry3(schema->attrgrpDecl, name,
-                           schema->targetNamespace, ctxt->container, ret);
-    if (val != 0) {
-	xmlSchemaPCustomErr(ctxt,
-	    XML_SCHEMAP_REDEFINED_ATTRGROUP,
-	    NULL, NULL, node,
-	    "A global attribute group definition with the name '%s' does already exist", name);
-        xmlFree(ret);
-        return (NULL);
-    }
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) ret);
+    ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP;
+    ret->node = node;    
+
+    if (topLevel) {
+	ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL;
+	ret->name = xmlDictLookup(ctxt->dict, name, -1);
+	ret->targetNamespace = ctxt->targetNamespace;
+
+	WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, attrgrpDecl)
+	WXS_INIT_GLOBAL_HASH(ctxt, table)
+		
+	val = xmlHashAddEntry(*table, name, ret);
+	if (val != 0) {
+	    xmlSchemaPCustomErr(ctxt,
+		XML_SCHEMAP_REDEFINED_ATTRGROUP,
+		NULL, NULL, node,
+		"A global attribute group definition with the name '%s' "
+		"does already exist", name);
+	    xmlFree(ret);
+	    return (NULL);
+	}
+	ADD_GLOBAL_ITEM(ctxt, ret);
+    } else
+	ADD_LOCAL_ITEM(ctxt, ret);	
+	
+    WXS_ADD_PENDING_ITEM(ctxt, ret);
     return (ret);
 }
 
@@ -4708,26 +4677,16 @@
  */
 static xmlSchemaElementPtr
 xmlSchemaAddElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
-                    const xmlChar * name, const xmlChar * namespace,
+                    const xmlChar * name, const xmlChar * nsName,
 		    xmlNodePtr node, int topLevel)
 {
     xmlSchemaElementPtr ret = NULL;
+    xmlHashTablePtr *table = NULL;
     int val;
 
     if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
         return (NULL);
 
-#ifdef DEBUG
-    fprintf(stderr, "Adding element %s\n", name);
-    if (namespace != NULL)
-	fprintf(stderr, "  target namespace %s\n", namespace);
-#endif
-
-    if (schema->elemDecl == NULL)
-        schema->elemDecl = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->elemDecl == NULL)
-        return (NULL);
-
     ret = (xmlSchemaElementPtr) xmlMalloc(sizeof(xmlSchemaElement));
     if (ret == NULL) {
         xmlSchemaPErrMemory(ctxt, "allocating element", NULL);
@@ -4735,38 +4694,25 @@
     }
     memset(ret, 0, sizeof(xmlSchemaElement));
     ret->name = xmlDictLookup(ctxt->dict, name, -1);
-    val = xmlHashAddEntry3(schema->elemDecl, name,
-                           namespace, ctxt->container, ret);
-    if (val != 0) {
-	if (topLevel) {
+    ret->targetNamespace = nsName;
+
+    if (topLevel) {
+	WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, elemDecl)
+	WXS_INIT_GLOBAL_HASH(ctxt, table) 
+	val = xmlHashAddEntry(*table, name, ret);
+	if (val != 0) {
 	    xmlSchemaPCustomErr(ctxt,
 		XML_SCHEMAP_REDEFINED_ELEMENT,
 		NULL, NULL, node,
 		"A global element declaration with the name '%s' does "
 		"already exist", name);
-            xmlFree(ret);
-            return (NULL);
-	} else {
-	    char buf[30];
-
-	    snprintf(buf, 29, "#eCont%d", ctxt->counter++ + 1);
-	    val = xmlHashAddEntry3(schema->elemDecl, name,
-		namespace, (xmlChar *) buf, ret);
-	    if (val != 0) {
-		xmlSchemaPCustomErr(ctxt,
-		    XML_SCHEMAP_INTERNAL,
-		    NULL, NULL, node,
-		    "Internal error: xmlSchemaAddElement, "
-		    "a dublicate element declaration with the name '%s' "
-		    "could not be added to the hash.", name);
-		xmlFree(ret);
-		return (NULL);
-	    }
+	    xmlFree(ret);
+	    return (NULL);
 	}
-
-    }
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) ret);
+	ADD_GLOBAL_ITEM(ctxt, ret);
+    } else
+	ADD_LOCAL_ITEM(ctxt, ret);
+    WXS_ADD_PENDING_ITEM(ctxt, ret);
     return (ret);
 }
 
@@ -4788,74 +4734,70 @@
 		 xmlNodePtr node, int topLevel)
 {
     xmlSchemaTypePtr ret = NULL;
+    xmlHashTablePtr *table = NULL;
     int val;
 
-    if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
+    if ((ctxt == NULL) || (schema == NULL))
         return (NULL);
 
-    if (schema->typeDecl == NULL)
-        schema->typeDecl = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->typeDecl == NULL)
-        return (NULL);
-
     ret = (xmlSchemaTypePtr) xmlMalloc(sizeof(xmlSchemaType));
     if (ret == NULL) {
         xmlSchemaPErrMemory(ctxt, "allocating type", NULL);
         return (NULL);
     }
     memset(ret, 0, sizeof(xmlSchemaType));
-    ret->name = xmlDictLookup(ctxt->dict, name, -1);
-    ret->redef = NULL;
-    val = xmlHashAddEntry2(schema->typeDecl, name, nsName, ret);
-    if (val != 0) {
-	if (! ctxt->isRedefine) {
-	    xmlChar *str = NULL;
-	    if (topLevel) {
+    if (name != NULL)
+	ret->name = xmlDictLookup(ctxt->dict, name, -1);
+    ret->targetNamespace = nsName;
+    ret->node = node;
+    /* TODO: Get rid of occurences here. */
+    ret->minOccurs = 1;
+    ret->maxOccurs = 1;
+
+    if (topLevel) {
+	WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, typeDecl)
+	WXS_INIT_GLOBAL_HASH(ctxt, table)          
+	val = xmlHashAddEntry(*table, name, ret);
+	if (val != 0) {
+	    if (! ctxt->isRedefine) {
+		xmlChar *str = NULL;
+
 		xmlSchemaPCustomErr(ctxt,
 		    XML_SCHEMAP_REDEFINED_TYPE,
 		    NULL, NULL, node,
 		    "A global type definition with the name '%s' does "
 		    "already exist",
 		    xmlSchemaFormatQName(&str, nsName, name));
+		FREE_AND_NULL(str);
+		xmlFree(ret);		
+		return (NULL);
 	    } else {
-		xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_INTERNAL,
-		    NULL, NULL, node, "Internal error: xmlSchemaAddType, "
-		    "local type '%s' has a duplicate",
-		    xmlSchemaFormatQName(&str, nsName, name));
+		xmlSchemaTypePtr prev;
+		
+		/* REDEFINE: Add a redefinition. */
+		TODO
+		prev = xmlHashLookup(*table, name);
+		if (prev == NULL) {
+		    PERROR_INT2("xmlSchemaAddType", "hash list did not "
+			"return a redefined type component, but should");
+		    xmlFree(ret);
+		    return (NULL);
+		}
+		ret->redef = prev->redef;
+		prev->redef = ret;
+		/* TODO: Add to locals; dunno if this will make trouble. */
+		ADD_LOCAL_ITEM(ctxt, ret);
 	    }
-	    xmlFree(ret);
-	    FREE_AND_NULL(str);
-	    return (NULL);
-	} else {
-	    xmlSchemaTypePtr prev;
-
-	    /*
-	    * REDEFINE: Add a redefinition.
-	    */
-	    TODO
-	    prev = xmlHashLookup2(schema->typeDecl, name, nsName);
-	    if (prev == NULL) {
-		PERROR_INT2("xmlSchemaAddType", "hash list didn't return "
-		    "a type component, but should");
-		xmlFree(ret);
-		return (NULL);
-	    }
-	    ret->redef = prev->redef;
-	    prev->redef = ret;
-	}
-    }
-    ret->node = node;
-    ret->minOccurs = 1;
-    ret->maxOccurs = 1;
-    ret->attributeUses = NULL;
-    ret->attributeWildcard = NULL;
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt,ret);
+	} else
+	    ADD_GLOBAL_ITEM(ctxt, ret);
+    } else
+	ADD_LOCAL_ITEM(ctxt, ret);
+    WXS_ADD_PENDING_ITEM(ctxt, ret);    
     return (ret);
 }
 
 static xmlSchemaQNameRefPtr
-xmlSchemaNewQNameRef(xmlSchemaPtr schema,
+xmlSchemaNewQNameRef(xmlSchemaParserCtxtPtr pctxt,
 		     xmlSchemaTypeType refType,
 		     const xmlChar *refName,
 		     const xmlChar *refNs)
@@ -4865,8 +4807,8 @@
     ret = (xmlSchemaQNameRefPtr)
 	xmlMalloc(sizeof(xmlSchemaQNameRef));
     if (ret == NULL) {
-	xmlSchemaPErrMemory(NULL, "allocating QName reference item",
-	    NULL);
+	xmlSchemaPErrMemory(pctxt,
+	    "allocating QName reference item", NULL);
 	return (NULL);
     }
     ret->type = XML_SCHEMA_EXTRA_QNAMEREF;
@@ -4877,7 +4819,7 @@
     /*
     * Store the reference item in the schema.
     */
-    xmlSchemaAddVolatile(schema, (xmlSchemaBasicItemPtr) ret);
+    ADD_LOCAL_ITEM(pctxt, ret);
     return (ret);
 }
 
@@ -4886,7 +4828,6 @@
  * @ctxt:  a schema parser context
  * @schema:  the schema being built
  * @type: the "compositor" type of the model group
- * @container:  the internal component name
  * @node: the node in the schema doc
  *
  * Adds a schema model group
@@ -4895,19 +4836,16 @@
  * Returns the new struture or NULL in case of error
  */
 static xmlSchemaModelGroupPtr
-xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
-		 xmlSchemaTypeType type, const xmlChar **container,
-		 xmlNodePtr node)
+xmlSchemaAddModelGroup(xmlSchemaParserCtxtPtr ctxt,
+		       xmlSchemaPtr schema,
+		       xmlSchemaTypeType type,
+		       xmlNodePtr node)
 {
     xmlSchemaModelGroupPtr ret = NULL;
-    xmlChar buf[30];
 
     if ((ctxt == NULL) || (schema == NULL))
         return (NULL);
 
-#ifdef DEBUG
-    fprintf(stderr, "Adding model group component\n");
-#endif
     ret = (xmlSchemaModelGroupPtr)
 	xmlMalloc(sizeof(xmlSchemaModelGroup));
     if (ret == NULL) {
@@ -4915,31 +4853,10 @@
 	    NULL);
 	return (NULL);
     }
+    memset(ret, 0, sizeof(xmlSchemaModelGroup));
     ret->type = type;
-    ret->annot = NULL;
     ret->node = node;
-    ret->children = NULL;
-    ret->next = NULL;
-    if (type == XML_SCHEMA_TYPE_SEQUENCE) {
-	if (container != NULL)
-	    snprintf((char *) buf, 29, "#seq%d", ctxt->counter++ + 1);
-    } else if (type == XML_SCHEMA_TYPE_CHOICE) {
-	if (container != NULL)
-	    snprintf((char *) buf, 29, "#cho%d", ctxt->counter++ + 1);
-    } else {
-	if (container != NULL)
-	    snprintf((char *) buf, 29, "#all%d", ctxt->counter++ + 1);
-    }
-    if (container != NULL)
-	*container = xmlDictLookup(ctxt->dict, BAD_CAST buf, -1);
-    /*
-    * Add to volatile items.
-    * TODO: this should be changed someday.
-    */
-    if (xmlSchemaAddVolatile(schema, (xmlSchemaBasicItemPtr) ret) != 0) {
-	xmlFree(ret);
-	return (NULL);
-    }
+    ADD_LOCAL_ITEM(ctxt, ret);
     return (ret);
 }
 
@@ -4983,15 +4900,18 @@
     ret->next = NULL;
     ret->children = NULL;
 
-    if (xmlSchemaAddVolatile(schema, (xmlSchemaBasicItemPtr) ret) != 0) {
-	xmlFree(ret);
-	return (NULL);
-    }
+    ADD_LOCAL_ITEM(ctxt, ret);
+    /* 
+    * Note that addition to pending components will be done locally
+    * to the specific parsing function, since the most particles
+    * need not to be fixed up (i.e. the reference to be resolved).
+    * REMOVED: WXS_ADD_PENDING_ITEM(ctxt, ret);
+    */
     return (ret);
 }
 
 /**
- * xmlSchemaAddGroup:
+ * xmlSchemaAddModelGroupDefinition:
  * @ctxt:  a schema validation context
  * @schema:  the schema being built
  * @name:  the group name
@@ -5001,22 +4921,24 @@
  * Returns the new struture or NULL in case of error
  */
 static xmlSchemaModelGroupDefPtr
-xmlSchemaAddGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
-                  const xmlChar *name, const xmlChar *namespaceName,
-		  xmlNodePtr node)
+xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt,
+				 xmlSchemaPtr schema,
+				 const xmlChar *name,
+				 const xmlChar *nsName,
+				 xmlNodePtr node)
 {
     xmlSchemaModelGroupDefPtr ret = NULL;
+    xmlHashTablePtr *table = NULL;
     int val;
 
     if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
         return (NULL);
 
-    if (schema->groupDecl == NULL)
-        schema->groupDecl = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->groupDecl == NULL)
-        return (NULL);
+    WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, groupDecl)
+    WXS_INIT_GLOBAL_HASH(ctxt, table)
 
-    ret = (xmlSchemaModelGroupDefPtr) xmlMalloc(sizeof(xmlSchemaModelGroupDef));
+    ret = (xmlSchemaModelGroupDefPtr)
+	xmlMalloc(sizeof(xmlSchemaModelGroupDef));
     if (ret == NULL) {
         xmlSchemaPErrMemory(ctxt, "adding group", NULL);
         return (NULL);
@@ -5025,19 +4947,20 @@
     ret->name = xmlDictLookup(ctxt->dict, name, -1);
     ret->type = XML_SCHEMA_TYPE_GROUP;
     ret->node = node;
-    ret->targetNamespace = namespaceName;
-    val = xmlHashAddEntry2(schema->groupDecl, ret->name, namespaceName, ret);
+    ret->targetNamespace = nsName;
+
+    val = xmlHashAddEntry(*table, ret->name, ret);
     if (val != 0) {
 	xmlSchemaPCustomErr(ctxt,
 	    XML_SCHEMAP_REDEFINED_GROUP,
 	    NULL, NULL, node,
-	    "A global model group definition with the name '%s' does already "
-	    "exist", name);
+	    "A global model group definition with the name '%s' does "
+	    "already exist", name);
         xmlFree(ret);
         return (NULL);
     }
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) ret);
+    ADD_GLOBAL_ITEM(ctxt, ret);
+    WXS_ADD_PENDING_ITEM(ctxt, ret);
     return (ret);
 }
 
@@ -5065,6 +4988,56 @@
     return (ret);
 }
 
+static xmlSchemaIDCPtr
+xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
+                  const xmlChar *name, const xmlChar *nsName,
+		  int category, xmlNodePtr node)
+{
+    xmlSchemaIDCPtr ret = NULL;
+    xmlHashTablePtr *table = NULL;
+    int val;
+
+    if ((ctxt == NULL) || (schema == NULL) || (name == NULL))
+        return (NULL);
+
+    WXS_GET_GLOBAL_HASH(WXS_SCHEMA_BUCKET(ctxt), schema, idcDef)
+    WXS_INIT_GLOBAL_HASH(ctxt, table)
+
+    ret = (xmlSchemaIDCPtr) xmlMalloc(sizeof(xmlSchemaIDC));
+    if (ret == NULL) {
+        xmlSchemaPErrMemory(ctxt,
+	    "allocating an identity-constraint definition", NULL);
+        return (NULL);
+    }
+    memset(ret, 0, sizeof(xmlSchemaIDC));
+    /* The target namespace of the parent element declaration. */
+    ret->targetNamespace = nsName;
+    ret->name = name;
+    ret->type = category;
+    ret->node = node;        
+    
+    val = xmlHashAddEntry(*table, ret->name, ret);
+    if (val != 0) {
+	xmlSchemaPCustomErrExt(ctxt,
+	    /* TODO: Error code! */
+	    XML_SCHEMAP_REDEFINED_TYPE,
+	    NULL, NULL, node,
+	    "An identity-constraint definition with the name '%s' "
+	    "and targetNamespace '%s' does already exist",
+	    ret->name, ret->targetNamespace, NULL);
+
+        xmlFree(ret);
+        return (NULL);
+    }
+    ADD_GLOBAL_ITEM(ctxt, ret);
+    /*
+    * Only keyrefs need to be fixup up.
+    */
+    if (category == XML_SCHEMA_TYPE_IDC_KEYREF)
+	WXS_ADD_PENDING_ITEM(ctxt, ret);
+    return (ret);
+}
+
 /**
  * xmlSchemaAddWildcard:
  * @ctxt:  a schema validation context
@@ -5084,10 +5057,6 @@
     if ((ctxt == NULL) || (schema == NULL))
         return (NULL);
 
-#ifdef DEBUG
-    fprintf(stderr, "Adding wildcard component\n");
-#endif
-
     ret = (xmlSchemaWildcardPtr) xmlMalloc(sizeof(xmlSchemaWildcard));
     if (ret == NULL) {
         xmlSchemaPErrMemory(ctxt, "adding wildcard", NULL);
@@ -5095,84 +5064,109 @@
     }
     memset(ret, 0, sizeof(xmlSchemaWildcard));
     ret->type = type;
+    ret->node = node;
     ret->minOccurs = 1;
-    ret->maxOccurs = 1;
+    ret->maxOccurs = 1; 
+    
+    ADD_LOCAL_ITEM(ctxt, ret);
+    return (ret);
+}
 
-    if (xmlSchemaAddVolatile(schema, (xmlSchemaBasicItemPtr) ret) != 0) {
-	xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_INTERNAL, NULL, NULL, node,
-	    "Failed to add a wildcard component to the list", NULL);
-	xmlFree(ret);
-	return (NULL);
+static void
+xmlSchemaSubstGroupFree(xmlSchemaSubstGroupPtr group)
+{
+    if (group == NULL)
+	return;
+    if (group->members != NULL)
+	xmlSchemaItemListFree(group->members);
+    xmlFree(group);
+}
+
+static xmlSchemaSubstGroupPtr
+xmlSchemaSubstGroupAdd(xmlSchemaParserCtxtPtr pctxt,
+		       xmlSchemaElementPtr head)
+{
+    xmlSchemaSubstGroupPtr ret;
+
+    /* Init subst group hash. */
+    if (WXS_SUBST_GROUPS(pctxt) == NULL) {
+	WXS_SUBST_GROUPS(pctxt) = xmlHashCreateDict(10, pctxt->dict);
+	if (WXS_SUBST_GROUPS(pctxt) == NULL)
+	    return(NULL);
     }
-    return (ret);
+    /* Create a new substitution group. */
+    ret = (xmlSchemaSubstGroupPtr) xmlMalloc(sizeof(xmlSchemaSubstGroup));
+    if (ret == NULL) {
+	xmlSchemaPErrMemory(NULL,
+	    "allocating a substitution group container", NULL);
+	return(NULL);
+    }
+    memset(ret, 0, sizeof(xmlSchemaSubstGroup));
+    ret->head = head;
+    /* Create list of members. */
+    ret->members = xmlSchemaItemListCreate();
+    if (ret->members == NULL) {
+	xmlSchemaSubstGroupFree(ret);
+	return(NULL);
+    }
+    /* Add subst group to hash. */
+    if (xmlHashAddEntry2(WXS_SUBST_GROUPS(pctxt),
+	head->name, head->targetNamespace, ret) != 0) {
+	PERROR_INT("xmlSchemaSubstGroupAdd",
+	    "failed to add a new substitution container");
+	xmlSchemaSubstGroupFree(ret);
+	return(NULL);
+    }
+    return(ret);
 }
 
-/************************************************************************
- * 									*
- *		Utilities for parsing					*
- * 									*
- ************************************************************************/
+static xmlSchemaSubstGroupPtr
+xmlSchemaSubstGroupGet(xmlSchemaParserCtxtPtr pctxt,
+		       xmlSchemaElementPtr head)
+{   
+    if (WXS_SUBST_GROUPS(pctxt) == NULL)
+	return(NULL);
+    return(xmlHashLookup2(WXS_SUBST_GROUPS(pctxt),
+	head->name, head->targetNamespace));
 
-#if 0
+}
+
 /**
- * xmlGetQNameProp:
- * @ctxt:  a schema validation context
- * @node:  a subtree containing XML Schema informations
- * @name:  the attribute name
- * @namespace:  the result namespace if any
+ * xmlSchemaAddElementSubstitutionMember:
+ * @pctxt:  a schema parser context
+ * @head:  the head of the substitution group
+ * @member: the new member of the substitution group
  *
- * Extract a QName Attribute value
+ * Allocate a new annotation structure.
  *
- * Returns the NCName or NULL if not found, and also update @namespace
- *    with the namespace URI
+ * Returns the newly allocated structure or NULL in case or error
  */
-static const xmlChar *
-xmlGetQNameProp(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
-                const char *name, const xmlChar ** namespace)
+static int
+xmlSchemaAddElementSubstitutionMember(xmlSchemaParserCtxtPtr pctxt,
+				      xmlSchemaElementPtr head,
+				      xmlSchemaElementPtr member)
 {
-    const xmlChar *val;
-    xmlNsPtr ns;
-    const xmlChar *ret, *prefix;
-    int len;
-    xmlAttrPtr attr;
+    xmlSchemaSubstGroupPtr substGroup = NULL;
 
-    *namespace = NULL;
-    attr = xmlSchemaGetPropNode(node, name);
-    if (attr == NULL)
-	return (NULL);
-    val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
+    if ((pctxt == NULL) || (head == NULL) || (member == NULL))
+	return (-1);
 
-    if (val == NULL)
-        return (NULL);
+    substGroup = xmlSchemaSubstGroupGet(pctxt, head);
+    if (substGroup == NULL)
+	substGroup = xmlSchemaSubstGroupAdd(pctxt, head);
+    if (substGroup == NULL)
+	return(-1);
+    if (xmlSchemaItemListAdd(substGroup->members, member) == -1)
+	return(-1);
+    return(0);
+}
 
-    if (!strchr((char *) val, ':')) {
-	ns = xmlSearchNs(node->doc, node, 0);
-	if (ns) {
-	    *namespace = xmlDictLookup(ctxt->dict, ns->href, -1);
-	    return (val);
-	}
-    }
-    ret = xmlSplitQName3(val, &len);
-    if (ret == NULL) {
-        return (val);
-    }
-    ret = xmlDictLookup(ctxt->dict, ret, -1);
-    prefix = xmlDictLookup(ctxt->dict, val, len);
+/************************************************************************
+ * 									*
+ *		Utilities for parsing					*
+ * 									*
+ ************************************************************************/
 
-    ns = xmlSearchNs(node->doc, node, prefix);
-    if (ns == NULL) {
-        xmlSchemaPSimpleTypeErr(ctxt, XML_SCHEMAP_PREFIX_UNDEFINED,
-	    NULL, NULL, (xmlNodePtr) attr,
-	    xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), NULL, val,
-	    "The QName value '%s' has no corresponding namespace "
-	    "declaration in scope", val, NULL);
-    } else {
-        *namespace = xmlDictLookup(ctxt->dict, ns->href, -1);
-    }
-    return (ret);
-}
-#endif
-
 /**
  * xmlSchemaPValAttrNodeQNameValue:
  * @ctxt:  a schema parser context
@@ -5223,11 +5217,13 @@
 	if (ns)
 	    *uri = xmlDictLookup(ctxt->dict, ns->href, -1);
 	else if (schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) {
+	    /* TODO: move XML_SCHEMAS_INCLUDING_CONVERT_NS to the
+	    * parser context. */
 	    /*
 	    * This one takes care of included schemas with no
 	    * target namespace.
 	    */
-	    *uri = schema->targetNamespace;
+	    *uri = ctxt->targetNamespace;
 	}
 	*local = xmlDictLookup(ctxt->dict, value, -1);
 	return (0);
@@ -5817,21 +5813,33 @@
 
 static int
 xmlSchemaCheckReference(xmlSchemaParserCtxtPtr pctxt,
-		  xmlSchemaPtr schema,
+		  xmlSchemaPtr schema ATTRIBUTE_UNUSED,
 		  xmlNodePtr node,
 		  xmlSchemaBasicItemPtr item,
 		  const xmlChar *namespaceName)
 {
-    if (xmlStrEqual(schema->targetNamespace, namespaceName))
+    /* TODO: Pointer comparison instead? */
+    if (xmlStrEqual(pctxt->targetNamespace, namespaceName))
 	return (1);
     if (xmlStrEqual(xmlSchemaNs, namespaceName))
 	return (1);
-    if (pctxt->localImports != NULL) {
-	int i;
-	for (i = 0; i < pctxt->nbLocalImports; i++)
-	    if (xmlStrEqual(namespaceName, pctxt->localImports[i]))
+    /*
+    * Check if the referenced namespace was <import>ed.
+    */
+    if (WXS_SCHEMA_BUCKET(pctxt)->relations != NULL) {
+	xmlSchemaSchemaRelationPtr rel;
+
+	rel = WXS_SCHEMA_BUCKET(pctxt)->relations;
+	do {
+	    if (WXS_IS_IMPMAIN(rel->type) &&
+		xmlStrEqual(namespaceName, rel->importNamespace))
 		return (1);
+	    rel = rel->next;
+	} while (rel != NULL);
     }
+    /*
+    * No matching <import>ed namespace found.
+    */
     if (namespaceName == NULL)
 	xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_RESOLVE,
 	    NULL, (xmlSchemaTypePtr) item, node,
@@ -6119,7 +6127,7 @@
  */
 static int
 xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt,
-			 xmlSchemaPtr schema,
+			 xmlSchemaPtr schema ATTRIBUTE_UNUSED,
 			 xmlSchemaWildcardPtr wildc,
 			 xmlNodePtr node)
 {
@@ -6158,7 +6166,7 @@
 	if (wildc->negNsSet == NULL) {
 	    return (-1);
 	}
-	wildc->negNsSet->value = schema->targetNamespace;
+	wildc->negNsSet->value = ctxt->targetNamespace;
     } else {
 	const xmlChar *end, *cur;
 
@@ -6184,7 +6192,7 @@
 		ret = XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER;
 	    } else {
 		if (xmlStrEqual(nsItem, BAD_CAST "##targetNamespace")) {
-		    dictnsItem = schema->targetNamespace;
+		    dictnsItem = ctxt->targetNamespace;
 		} else if (xmlStrEqual(nsItem, BAD_CAST "##local")) {
 		    dictnsItem = NULL;
 		} else {
@@ -6400,7 +6408,7 @@
     if (ret == NULL) {
         return (NULL);
     }
-    ret->targetNamespace = schema->targetNamespace;
+    ret->targetNamespace = ctxt->targetNamespace;
 
     xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) ret,
 	node, BAD_CAST "id");
@@ -6552,7 +6560,9 @@
 	isRef = 1;
 
     if (isRef) {
+#ifdef ENABLE_NAMED_LOCALS
 	char buf[50];
+#endif
 	const xmlChar *refNs = NULL, *ref = NULL;
 
 	/*
@@ -6563,9 +6573,14 @@
 	    &ref) != 0) {
 	    return (NULL);
 	}
+#ifdef ENABLE_NAMED_LOCALS
         snprintf(buf, 49, "#aRef%d", ctxt->counter++ + 1);
         name = (const xmlChar *) buf;
 	ret = xmlSchemaAddAttribute(ctxt, schema, name, NULL, node, 0);
+#else
+	ret = xmlSchemaAddAttribute(ctxt, schema, NULL, NULL, node, 0);
+#endif
+	
 	if (ret == NULL) {
 	    if (repName != NULL)
 		xmlFree(repName);
@@ -6650,13 +6665,13 @@
 	* Evaluate the target namespace
 	*/
 	if (topLevel) {
-	    ns = schema->targetNamespace;
+	    ns = ctxt->targetNamespace;
 	} else {
 	    attr = xmlSchemaGetPropNode(node, "form");
 	    if (attr != NULL) {
 		attrValue = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
 		if (xmlStrEqual(attrValue, BAD_CAST "qualified")) {
-		    ns = schema->targetNamespace;
+		    ns = ctxt->targetNamespace;
 		} else if (!xmlStrEqual(attrValue, BAD_CAST "unqualified")) {
 		    xmlSchemaPSimpleTypeErr(ctxt,
 			XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
@@ -6665,7 +6680,8 @@
 			attrValue, NULL, NULL, NULL);
 		}
 	    } else if (schema->flags & XML_SCHEMAS_QUALIF_ATTR)
-		ns = schema->targetNamespace;
+		/* TODO: move XML_SCHEMAS_QUALIF_ATTR to the parser. */
+		ns = ctxt->targetNamespace;
 	}
         ret = xmlSchemaAddAttribute(ctxt, schema, name, ns, node, topLevel);
 	if (ret == NULL) {
@@ -6847,7 +6863,6 @@
     const xmlChar *name;
     xmlSchemaAttributeGroupPtr ret;
     xmlNodePtr child = NULL;
-    const xmlChar *oldcontainer;
     xmlAttrPtr attr, nameAttr;
 
     if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
@@ -6877,15 +6892,13 @@
 	    xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) {
 	    return (NULL);
 	}
-	ret = xmlSchemaAddAttributeGroup(ctxt, schema, name, node);
+	ret = xmlSchemaAddAttributeGroup(ctxt, schema, name, node, 1);
 	if (ret == NULL)
-	    return (NULL);
-	ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP;
-	ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL;
-	ret->node = node;
-	ret->targetNamespace = schema->targetNamespace;
+	    return (NULL);	
     } else {
+#ifdef ENABLE_NAMED_LOCALS
 	char buf[50];
+#endif
 	const xmlChar *refNs = NULL, *ref = NULL;
 
 	/*
@@ -6898,7 +6911,7 @@
 	}
 	xmlSchemaPValAttrNodeQName(ctxt, schema,
 	    NULL, NULL, attr, &refNs,&ref);
-
+#ifdef ENABLE_NAMED_LOCALS
         snprintf(buf, 49, "#agRef%d", ctxt->counter++ + 1);
 	name = (const xmlChar *) buf;
 	if (name == NULL) {
@@ -6906,13 +6919,14 @@
 		"attribute group definition reference", node);
             return (NULL);
         }
-	ret = xmlSchemaAddAttributeGroup(ctxt, schema, name, node);
+	ret = xmlSchemaAddAttributeGroup(ctxt, schema, name, node, 0);
+#else
+	ret = xmlSchemaAddAttributeGroup(ctxt, schema, NULL, node, 0);
+#endif
 	if (ret == NULL)
 	    return (NULL);
-	ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP;
 	ret->ref = ref;
 	ret->refNs = refNs;
-	ret->node = node;
 	xmlSchemaCheckReference(ctxt, schema, node,
 	    (xmlSchemaBasicItemPtr) ret, refNs);
     }
@@ -6922,7 +6936,8 @@
     attr = node->properties;
     while (attr != NULL) {
 	if (attr->ns == NULL) {
-	    if ((((topLevel == 0) && (!xmlStrEqual(attr->name, BAD_CAST "ref"))) ||
+	    if ((((topLevel == 0) &&
+		(!xmlStrEqual(attr->name, BAD_CAST "ref"))) ||
 		 (topLevel && (!xmlStrEqual(attr->name, BAD_CAST "name")))) &&
 		(!xmlStrEqual(attr->name, BAD_CAST "id")))
 	    {
@@ -6937,21 +6952,23 @@
 	}
 	attr = attr->next;
     }
-    /* TODO: Validate "id" ? */
+    /* Attribute ID */
+    xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) ret,
+	node, BAD_CAST "id");
     /*
     * And now for the children...
     */
-    oldcontainer = ctxt->container;
-    ctxt->container = name;
     child = node->children;
     if (IS_SCHEMA(child, "annotation")) {
         ret->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
         child = child->next;
     }
     if (topLevel) {
-	child = xmlSchemaParseAttrDecls(ctxt, schema, child, (xmlSchemaTypePtr) ret);
+	child = xmlSchemaParseAttrDecls(ctxt, schema, child,
+	    (xmlSchemaTypePtr) ret);
 	if (IS_SCHEMA(child, "anyAttribute")) {
-	    ret->attributeWildcard = xmlSchemaParseAnyAttribute(ctxt, schema, child);
+	    ret->attributeWildcard = xmlSchemaParseAnyAttribute(ctxt,
+		schema, child);
 	    child = child->next;
 	}
     }
@@ -6961,7 +6978,6 @@
 	    NULL, NULL, node, child, NULL,
 	    "(annotation?)");
     }
-    ctxt->container = oldcontainer;
     return (ret);
 }
 
@@ -7419,7 +7435,6 @@
     xmlAttrPtr attr;
     const xmlChar *name = NULL;
     xmlSchemaIDCSelectPtr field = NULL, lastField = NULL;
-    int resAdd;
 
     /*
     * Check for illegal attributes.
@@ -7457,44 +7472,12 @@
 	xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) {
 	return (NULL);
     }
-    /*
-    * Create the component.
-    */
-    if (schema->idcDef == NULL)
-        schema->idcDef = xmlHashCreateDict(10, ctxt->dict);
-    if (schema->idcDef == NULL)
-        return (NULL);
+    /* Create the component. */
+    item = xmlSchemaAddIDC(ctxt, schema, name, targetNamespace,
+	idcCategory, node);
+    if (item == NULL)
+	return(NULL);
 
-    item = (xmlSchemaIDCPtr) xmlMalloc(sizeof(xmlSchemaIDC));
-    if (item == NULL) {
-        xmlSchemaPErrMemory(ctxt,
-	    "allocating an identity-constraint definition", NULL);
-        return (NULL);
-    }
-    /*
-    * Add the IDC to the list of IDCs on the schema component.
-    */
-    resAdd = xmlHashAddEntry2(schema->idcDef, name, targetNamespace, item);
-    if (resAdd != 0) {
-	xmlSchemaPCustomErrExt(ctxt,
-	    XML_SCHEMAP_REDEFINED_TYPE,
-	    NULL, NULL, node,
-	    "An identity-constraint definition with the name '%s' "
-	    "and targetNamespace '%s' does already exist",
-	    name, targetNamespace, NULL);
-	xmlFree(item);
-	return (NULL);
-    }
-    memset(item, 0, sizeof(xmlSchemaIDC));
-    item->name = name;
-    item->type = idcCategory;
-    item->node = node;
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) item);
-    /*
-    * The target namespace of the parent element declaration.
-    */
-    item->targetNamespace = targetNamespace;
     xmlSchemaPValAttrID(ctxt, NULL, (xmlSchemaTypePtr) item,
 	node, BAD_CAST "id");
     if (idcCategory == XML_SCHEMA_TYPE_IDC_KEYREF) {
@@ -7511,7 +7494,7 @@
 	    /*
 	    * Create a reference item.
 	    */
-	    item->ref = xmlSchemaNewQNameRef(schema, XML_SCHEMA_TYPE_IDC_KEY,
+	    item->ref = xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_IDC_KEY,
 		NULL, NULL);
 	    if (item->ref == NULL)
 		return (NULL);
@@ -7710,18 +7693,17 @@
 	/*
 	* Create the reference item.
 	*/
-	refer = xmlSchemaNewQNameRef(schema, XML_SCHEMA_TYPE_ELEMENT,
+	refer = xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_ELEMENT,
 	    ref, refNs);
 	if (refer == NULL)
 	    goto return_null;
 	particle->children = (xmlSchemaTreeItemPtr) refer;
 	particle->annot = annot;
 	/*
-	* Add to assembled items; the reference need to be resolved.
+	* Add the particle to pending components, since the reference
+	* need to be resolved.
 	*/
-	if (ctxt->assemble != NULL)
-	    xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) particle);
-
+	WXS_ADD_PENDING_ITEM(ctxt, particle);
 	return ((xmlSchemaBasicItemPtr) particle);
     }
     /*
@@ -7729,7 +7711,7 @@
     */
 declaration_part:
     {
-	const xmlChar *ns = NULL, *fixed, *name, *oldcontainer, *attrValue;
+	const xmlChar *ns = NULL, *fixed, *name, *attrValue;
 	xmlSchemaIDCPtr curIDC = NULL, lastIDC = NULL;
 
 	if (xmlSchemaPValAttrNode(ctxt, NULL, NULL, nameAttr,
@@ -7739,13 +7721,13 @@
 	* Evaluate the target namespace.
 	*/
 	if (topLevel) {
-	    ns = schema->targetNamespace;
+	    ns = ctxt->targetNamespace;
 	} else {
 	    attr = xmlSchemaGetPropNode(node, "form");
 	    if (attr != NULL) {
 		attrValue = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
 		if (xmlStrEqual(attrValue, BAD_CAST "qualified")) {
-		    ns = schema->targetNamespace;
+		    ns = ctxt->targetNamespace;
 		} else if (!xmlStrEqual(attrValue, BAD_CAST "unqualified")) {
 		    xmlSchemaPSimpleTypeErr(ctxt,
 			XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
@@ -7754,7 +7736,7 @@
 			attrValue, NULL, NULL, NULL);
 		}
 	    } else if (schema->flags & XML_SCHEMAS_QUALIF_ELEM)
-		ns = schema->targetNamespace;
+		ns = ctxt->targetNamespace;
 	}
 	decl = xmlSchemaAddElement(ctxt, schema, name, ns, node, topLevel);
 	if (decl == NULL) {
@@ -7903,8 +7885,6 @@
 	/*
 	* And now for the children...
 	*/
-	oldcontainer = ctxt->container;
-	ctxt->container = decl->name;
 	if (IS_SCHEMA(child, "complexType")) {
 	    /*
 	    * 3.3.3 : 3
@@ -7962,7 +7942,6 @@
 		NULL, "(annotation?, ((simpleType | complexType)?, "
 		"(unique | key | keyref)*))");
 	}
-	ctxt->container = oldcontainer;
 	decl->annot = annot;
     }
     /*
@@ -8088,7 +8067,7 @@
 		/*
 		* Create a reference item.
 		*/
-		ref = xmlSchemaNewQNameRef(schema, XML_SCHEMA_TYPE_SIMPLE,
+		ref = xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_SIMPLE,
 		    localName, nsName);
 		if (ref == NULL) {
 		    FREE_AND_NULL(tmp)
@@ -8332,19 +8311,29 @@
 	    }
 	}
     }
-
+    /*
+    * TargetNamespace:
+    * SPEC "The ·actual value· of the targetNamespace [attribute]
+    * of the <schema> ancestor element information item if present,
+    * otherwise ·absent·.
+    */
     if (topLevel == 0) {
+#ifdef ENABLE_NAMED_LOCALS
         char buf[40];
-
+#endif
 	/*
 	* Parse as local simple type definition.
 	*/
+#ifdef ENABLE_NAMED_LOCALS
         snprintf(buf, 39, "#ST%d", ctxt->counter++ + 1);
-	type = xmlSchemaAddType(ctxt, schema, (const xmlChar *)buf, NULL,
-	    node, 0);
+	type = xmlSchemaAddType(ctxt, schema, (const xmlChar *)buf,
+	    ctxt->targetNamespace, node, 0);
+#else
+	type = xmlSchemaAddType(ctxt, schema, NULL,
+	    ctxt->targetNamespace, node, 0);
+#endif
 	if (type == NULL)
 	    return (NULL);
-	type->node = node;
 	type->type = XML_SCHEMA_TYPE_SIMPLE;
 	type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
 	/*
@@ -8372,10 +8361,9 @@
 	* Note that attrValue is the value of the attribute "name" here.
 	*/
 	type = xmlSchemaAddType(ctxt, schema, attrValue,
-	    schema->targetNamespace, node, 1);
+	    ctxt->targetNamespace, node, 1);
 	if (type == NULL)
 	    return (NULL);
-	type->node = node;
 	type->type = XML_SCHEMA_TYPE_SIMPLE;
 	type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
 	type->flags |= XML_SCHEMAS_TYPE_GLOBAL;
@@ -8425,7 +8413,7 @@
 	    }
 	}
     }
-    type->targetNamespace = schema->targetNamespace;
+    type->targetNamespace = ctxt->targetNamespace;
     xmlSchemaPValAttrID(ctxt, NULL, type, node, BAD_CAST "id");
     /*
     * And now for the children...
@@ -8543,12 +8531,14 @@
     item = xmlSchemaAddParticle(ctxt, schema, node, min, max);
     if (item == NULL)
 	return (NULL);
+    /* Add to pending components; the reference needs to be resolved. */
+    WXS_ADD_PENDING_ITEM(ctxt, item);
     /*
     * Create a reference item as the term; it will be substituted for
     * the model group after the reference has been resolved.
     */
     item->children = (xmlSchemaTreeItemPtr)
-	xmlSchemaNewQNameRef(schema, XML_SCHEMA_TYPE_GROUP, ref, refNs);
+	xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs);
     xmlSchemaCheckReference(ctxt, schema, node, (xmlSchemaBasicItemPtr) item, refNs);
     xmlSchemaPCheckParticleCorrect_2(ctxt, item, node, min, max);
     /*
@@ -8574,8 +8564,7 @@
     */
     if ((min == 0) && (max == 0))
 	return (NULL);
-    if (ctxt->assemble != NULL)
-	xmlSchemaAddAssembledItem(ctxt, (xmlSchemaTypePtr) item);
+
     return ((xmlSchemaTreeItemPtr) item);
 }
 
@@ -8616,7 +8605,8 @@
 	xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) {
 	return (NULL);
     }
-    item = xmlSchemaAddGroup(ctxt, schema, name, schema->targetNamespace, node);
+    item = xmlSchemaAddModelGroupDefinition(ctxt, schema, name,
+	ctxt->targetNamespace, node);
     if (item == NULL)
 	return (NULL);
     /*
@@ -8772,55 +8762,82 @@
 	schema->flags ^= XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION;
 }
 
-static void
-xmlSchemaParseSchemaDefaults(xmlSchemaParserCtxtPtr ctxt,
+static int
+xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt,
 			     xmlSchemaPtr schema,
 			     xmlNodePtr node)
 {
     xmlAttrPtr attr;
     const xmlChar *val;
+    int res = 0, oldErrs = ctxt->nberrors;
 
-    xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id");
-    if (schema->version == NULL)
-	xmlSchemaPValAttr(ctxt, NULL, NULL, node, "version",
-	    xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), &(schema->version));
-    else
-	xmlSchemaPValAttr(ctxt, NULL, NULL, node, "version",
-	    xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), NULL);
+    /*
+    * Those flags should be moved to the parser context flags,
+    * since they are not visible at the component level. I.e.
+    * they are used if processing schema *documents* only.
+    */
+    res = xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id");
+    HFAILURE;
 
+    /*
+    * Since the version is of type xs:token, we won't bother to
+    * check it.
+    */
+    /* REMOVED:
+    attr = xmlSchemaGetPropNode(node, "version");
+    if (attr != NULL) {
+	res = xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr,
+	    xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), &val);    
+	HFAILURE;
+    }
+    */
+    attr = xmlSchemaGetPropNode(node, "targetNamespace");
+    if (attr != NULL) {
+	res = xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr,
+	    xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), NULL);
+	HFAILURE;
+	if (res != 0) {
+	    ctxt->stop = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE;
+	    goto exit;
+	}
+    }
     attr = xmlSchemaGetPropNode(node, "elementFormDefault");
     if (attr != NULL) {
 	val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
-	if (xmlSchemaPValAttrFormDefault(val, &schema->flags,
-	    XML_SCHEMAS_QUALIF_ELEM) != 0) {
+	res = xmlSchemaPValAttrFormDefault(val, &schema->flags,
+	    XML_SCHEMAS_QUALIF_ELEM);
+	HFAILURE;
+	if (res != 0) {
 	    xmlSchemaPSimpleTypeErr(ctxt,
 		XML_SCHEMAP_ELEMFORMDEFAULT_VALUE,
 		NULL, (xmlNodePtr) attr, NULL,
 		"(qualified | unqualified)", val, NULL, NULL, NULL);
 	}
     }
-
     attr = xmlSchemaGetPropNode(node, "attributeFormDefault");
     if (attr != NULL) {
 	val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
-	if (xmlSchemaPValAttrFormDefault(val, &schema->flags,
-	    XML_SCHEMAS_QUALIF_ATTR) != 0) {
+	res = xmlSchemaPValAttrFormDefault(val, &schema->flags,
+	    XML_SCHEMAS_QUALIF_ATTR);
+	HFAILURE;
+	if (res != 0) {
 	    xmlSchemaPSimpleTypeErr(ctxt,
 		XML_SCHEMAP_ATTRFORMDEFAULT_VALUE,
 		NULL, (xmlNodePtr) attr, NULL,
 		"(qualified | unqualified)", val, NULL, NULL, NULL);
 	}
     }
-
     attr = xmlSchemaGetPropNode(node, "finalDefault");
     if (attr != NULL) {
 	val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
-	if (xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1,
+	res = xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1,
 	    XML_SCHEMAS_FINAL_DEFAULT_EXTENSION,
 	    XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION,
 	    -1,
 	    XML_SCHEMAS_FINAL_DEFAULT_LIST,
-	    XML_SCHEMAS_FINAL_DEFAULT_UNION) != 0) {
+	    XML_SCHEMAS_FINAL_DEFAULT_UNION);
+	HFAILURE;
+	if (res != 0) {
 	    xmlSchemaPSimpleTypeErr(ctxt,
 		XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
 		NULL, (xmlNodePtr) attr, NULL,
@@ -8828,21 +8845,29 @@
 		val, NULL, NULL, NULL);
 	}
     }
-
     attr = xmlSchemaGetPropNode(node, "blockDefault");
     if (attr != NULL) {
-	val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
-	if (xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1,
+	val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);	
+	res = xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1,
 	    XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION,
 	    XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION,
-	    XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION, -1, -1) != 0) {
-	     xmlSchemaPSimpleTypeErr(ctxt,
+	    XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION, -1, -1);
+	HFAILURE;
+	if (res != 0) {
+	    xmlSchemaPSimpleTypeErr(ctxt,
 		XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
 		NULL, (xmlNodePtr) attr, NULL,
 		"(#all | List of (extension | restriction | substitution))",
 		val, NULL, NULL, NULL);
 	}
     }
+
+exit:
+    if (oldErrs != ctxt->nberrors)
+	res = ctxt->err;
+    return(res);
+exit_failure:
+    return(-1);
 }
 
 /**
@@ -8854,16 +8879,18 @@
  * Returns the internal XML Schema structure built from the resource or
  *         NULL in case of error
  */
-static void
+static int
 xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt,
                              xmlSchemaPtr schema, xmlNodePtr nodes)
 {
     xmlNodePtr child;
     xmlSchemaAnnotPtr annot;
+    int res = 0, oldErrs, tmpOldErrs;
 
     if ((ctxt == NULL) || (schema == NULL) || (nodes == NULL))
-        return;
+        return(-1);
 
+    oldErrs = ctxt->nberrors;
     child = nodes;
     while ((IS_SCHEMA(child, "include")) ||
 	   (IS_SCHEMA(child, "import")) ||
@@ -8876,20 +8903,33 @@
 	    else
 		xmlSchemaFreeAnnot(annot);
 	} else if (IS_SCHEMA(child, "import")) {
-	    xmlSchemaParseImport(ctxt, schema, child);
+	    tmpOldErrs = ctxt->nberrors;
+	    res = xmlSchemaParseImport(ctxt, schema, child);
+	    HFAILURE;
+	    HSTOP(ctxt);
+	    if (tmpOldErrs != ctxt->nberrors)
+		goto exit;	    
 	} else if (IS_SCHEMA(child, "include")) {
-	    ctxt->includes++;
-	    xmlSchemaParseInclude(ctxt, schema, child);
-	    ctxt->includes--;
+	    tmpOldErrs = ctxt->nberrors;
+	    res = xmlSchemaParseInclude(ctxt, schema, child);
+	    HFAILURE;
+	    HSTOP(ctxt);
+	    if (tmpOldErrs != ctxt->nberrors)
+		goto exit;	    
 	} else if (IS_SCHEMA(child, "redefine")) {
-#ifdef ENABLE_REDEFINE
-	    xmlSchemaParseRedefine(ctxt, schema, child);
-#else
-	    TODO
-#endif
+	    tmpOldErrs = ctxt->nberrors;
+	    res = xmlSchemaParseRedefine(ctxt, schema, child);
+	    HFAILURE;
+	    HSTOP(ctxt);
+	    if (tmpOldErrs != ctxt->nberrors)
+		goto exit;
 	}
 	child = child->next;
     }
+    /*
+    * URGENT TODO: Change the functions to return int results.
+    * We need especially to catch internal errors.
+    */
     while (child != NULL) {
 	if (IS_SCHEMA(child, "complexType")) {
 	    xmlSchemaParseComplexType(ctxt, schema, child, 1);
@@ -8913,10 +8953,12 @@
 	    xmlSchemaParseNotation(ctxt, schema, child);
 	    child = child->next;
 	} else {
-	    xmlSchemaPErr2(ctxt, NULL, child,
-			   XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD,
-			   "Unexpected element \"%s\" as child of <schema>.\n",
-			   child->name, NULL);
+	    xmlSchemaPContentErr(ctxt,
+		XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED,
+		NULL, NULL, child->parent, child,
+		NULL, "((include | import | redefine | annotation)*, "
+		"(((simpleType | complexType | group | attributeGroup) "
+		"| element | attribute | notation), annotation*)*)");
 	    child = child->next;
 	}
 	while (IS_SCHEMA(child, "annotation")) {
@@ -8928,63 +8970,93 @@
 	    child = child->next;
 	}
     }
+exit:
     ctxt->parentItem = NULL;
     ctxt->ctxtType = NULL;
+    if (oldErrs != ctxt->nberrors)
+	res = ctxt->err;
+    return(res);
+exit_failure:
+    return(-1);
 }
 
-static xmlSchemaImportPtr
-xmlSchemaAddImport(xmlSchemaParserCtxtPtr ctxt,
-		   xmlHashTablePtr *imports,
-		   const xmlChar *nsName)
+static xmlSchemaSchemaRelationPtr
+xmlSchemaSchemaRelationCreate(void)
 {
-    xmlSchemaImportPtr ret;
+    xmlSchemaSchemaRelationPtr ret;
 
-    if (*imports == NULL) {
-	*imports = xmlHashCreateDict(10, ctxt->dict);
-	if (*imports == NULL) {
-	    xmlSchemaPCustomErr(ctxt,
-		XML_SCHEMAP_FAILED_BUILD_IMPORT,
-		NULL, NULL, (xmlNodePtr) ctxt->doc,
-		"Internal error: failed to build the import table",
-		NULL);
-	    return (NULL);
-	}
-    }
-    ret = (xmlSchemaImport*) xmlMalloc(sizeof(xmlSchemaImport));
+    ret = (xmlSchemaSchemaRelationPtr)
+	xmlMalloc(sizeof(xmlSchemaSchemaRelation));
     if (ret == NULL) {
-	xmlSchemaPErrMemory(NULL, "allocating import struct", NULL);
-	return (NULL);
+	xmlSchemaPErrMemory(NULL, "allocating schema relation", NULL);
+	return(NULL);
     }
-    memset(ret, 0, sizeof(xmlSchemaImport));
-    if (nsName == NULL)
-	nsName = XML_SCHEMAS_NO_NAMESPACE;
-    xmlHashAddEntry(*imports, nsName, ret);
+    memset(ret, 0, sizeof(xmlSchemaSchemaRelation));
+    return(ret);
+}
 
-    return (ret);
+#if 0
+static void
+xmlSchemaSchemaRelationFree(xmlSchemaSchemaRelationPtr rel)
+{
+    xmlFree(rel);
 }
+#endif
 
-#ifdef ENABLE_REDEFINE
-static xmlSchemaSchemaRefPtr
-xmlSchemaSchemaRefCreate(void)
+static void
+xmlSchemaConstructionCtxtFree(xmlSchemaConstructionCtxtPtr con)
 {
-    xmlSchemaSchemaRefPtr ret;
+    /*
+    * After the construction context has been freed, there will be
+    * no schema graph available any more. Only the schema buckets
+    * will stay alive, which are put into the "schemasImports" and
+    * "includes" slots of the xmlSchema.
+    */
+    if (con->buckets != NULL)
+	xmlSchemaItemListFree(con->buckets);
+    if (con->pending != NULL)
+	xmlSchemaItemListFree(con->pending);
+    if (con->substGroups != NULL)
+	xmlHashFree(con->substGroups,
+	    (xmlHashDeallocator) xmlSchemaSubstGroupFree);
+    if (con->dict != NULL)
+	xmlDictFree(con->dict);
+    xmlFree(con);
+}
 
-    ret = (xmlSchemaSchemaRefPtr) xmlMalloc(sizeof(xmlSchemaSchemaRef));
+static xmlSchemaConstructionCtxtPtr 
+xmlSchemaConstructionCtxtCreate(xmlDictPtr dict)
+{
+    xmlSchemaConstructionCtxtPtr ret;
+
+    ret = (xmlSchemaConstructionCtxtPtr)
+	xmlMalloc(sizeof(xmlSchemaConstructionCtxt));
     if (ret == NULL) {
-	xmlSchemaPErrMemory(NULL, "allocating schema reference", NULL);
-	return(NULL);
+        xmlSchemaPErrMemory(NULL,
+	    "allocating schema construction context", NULL);
+        return (NULL);
     }
-    memset(ret, 0, sizeof(xmlSchemaSchemaRef));
+    memset(ret, 0, sizeof(xmlSchemaConstructionCtxt));
+
+    ret->buckets = xmlSchemaItemListCreate();
+    if (ret->buckets == NULL) {
+	xmlSchemaPErrMemory(NULL,
+	    "allocating list of schema buckets", NULL);
+	xmlFree(ret);
+        return (NULL);
+    }
+    ret->pending = xmlSchemaItemListCreate();
+    if (ret->pending == NULL) {
+	xmlSchemaPErrMemory(NULL,
+	    "allocating list of pending global components", NULL);
+	xmlSchemaConstructionCtxtFree(ret);
+        return (NULL);
+    }
+    ret->dict = dict;
+    xmlDictReference(dict);
     return(ret);
 }
 
-static void
-xmlSchemaSchemaRefFree(xmlSchemaSchemaRefPtr ref)
-{
-    xmlFree(ref);
-}
-#endif
-
 static xmlSchemaParserCtxtPtr
 xmlSchemaParserCtxtCreate(void)
 {
@@ -8998,11 +9070,6 @@
     }
     memset(ret, 0, sizeof(xmlSchemaParserCtxt));
     ret->type = XML_SCHEMA_CTXT_PARSER;
-    ret->compContainer = xmlSchemaContainerCreate();
-    if (ret->compContainer == NULL) {
-	xmlSchemaFreeParserCtxt(ret);
-	return(NULL);
-    }
     return(ret);
 }
 
@@ -9028,7 +9095,6 @@
     xmlDictReference(dict);    
     if (URL != NULL)
 	ret->URL = xmlDictLookup(dict, (const xmlChar *) URL, -1);
-    ret->includes = 0;
     return (ret);
 }
 
@@ -9037,7 +9103,8 @@
 {
     if (vctxt->pctxt == NULL) {
         if (vctxt->schema != NULL)
-	    vctxt->pctxt = xmlSchemaNewParserCtxtUseDict("*", vctxt->schema->dict);
+	    vctxt->pctxt =
+		xmlSchemaNewParserCtxtUseDict("*", vctxt->schema->dict);
 	else
 	    vctxt->pctxt = xmlSchemaNewParserCtxt("*");
 	if (vctxt->pctxt == NULL) {
@@ -9046,293 +9113,677 @@
 	    return (-1);
 	}
 	/* TODO: Pass user data. */
-	xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error, vctxt->warning, NULL);	
+	xmlSchemaSetParserErrors(vctxt->pctxt, vctxt->error,
+	    vctxt->warning, vctxt->userData);
     }
     return (0);
 }
 
+/**
+ * xmlSchemaGetSchemaBucket:
+ * @pctxt: the schema parser context
+ * @schemaLocation: the URI of the schema document
+ *
+ * Returns a schema bucket if it was already parsed.
+ *
+ * Returns a schema bucket if it was already parsed from
+ *         @schemaLocation, NULL otherwise.
+ */
+static xmlSchemaBucketPtr
+xmlSchemaGetSchemaBucket(xmlSchemaParserCtxtPtr pctxt,
+			    const xmlChar *schemaLocation)
+{
+    xmlSchemaBucketPtr cur;
+    xmlSchemaItemListPtr list;
+
+    list = pctxt->constructor->buckets;
+    if (list->nbItems == 0)
+	return(NULL);
+    else {
+	int i;
+	for (i = 0; i < list->nbItems; i++) {
+	    cur = (xmlSchemaBucketPtr) list->items[i];
+	    /* Pointer comparison! */
+	    if (cur->schemaLocation == schemaLocation)
+		return(cur);
+	}
+    }
+    return(NULL);
+}
+
+static xmlSchemaBucketPtr
+xmlSchemaGetChameleonSchemaBucket(xmlSchemaParserCtxtPtr pctxt,
+				     const xmlChar *schemaLocation,
+				     const xmlChar *targetNamespace)
+{
+    xmlSchemaBucketPtr cur;
+    xmlSchemaItemListPtr list;
+
+    list = pctxt->constructor->buckets;
+    if (list->nbItems == 0)
+	return(NULL);
+    else {
+	int i;
+	for (i = 0; i < list->nbItems; i++) {
+	    cur = (xmlSchemaBucketPtr) list->items[i];
+	    /* Pointer comparison! */
+	    if ((cur->origTargetNamespace == NULL) &&
+		(cur->schemaLocation == schemaLocation) &&
+		(cur->targetNamespace == targetNamespace))
+		return(cur);
+	}
+    }
+    return(NULL);
+}
+
+
+#define IS_BAD_SCHEMA_DOC(b) \
+    (((b)->doc == NULL) && ((b)->schemaLocation != NULL))
+
+static xmlSchemaBucketPtr
+xmlSchemaGetSchemaBucketByTNS(xmlSchemaParserCtxtPtr pctxt,
+				 const xmlChar *targetNamespace,
+				 int imported)
+{
+    xmlSchemaBucketPtr cur;
+    xmlSchemaItemListPtr list;
+
+    list = pctxt->constructor->buckets;
+    if (list->nbItems == 0)
+	return(NULL);
+    else {
+	int i;
+	for (i = 0; i < list->nbItems; i++) {
+	    cur = (xmlSchemaBucketPtr) list->items[i];
+	    if ((! IS_BAD_SCHEMA_DOC(cur)) &&
+		(cur->origTargetNamespace == targetNamespace) &&
+		((imported && cur->imported) ||
+		 ((!imported) && (!cur->imported))))
+		return(cur);
+	}
+    }
+    return(NULL);
+}
+
 static int
-xmlSchemaAcquireSchemaDoc(xmlSchemaAbstractCtxtPtr actxt,
-			  xmlSchemaPtr schema,
-			  xmlNodePtr node,
-			  const xmlChar *nsName,
-			  const xmlChar *location,
-			  xmlDocPtr *doc,
-			  const xmlChar **targetNamespace,
-			  int absolute)
+xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt,
+		     xmlSchemaPtr schema,
+		     xmlSchemaBucketPtr bucket)
 {
-    xmlSchemaParserCtxtPtr pctxt;
-    xmlParserCtxtPtr parserCtxt;
-    xmlSchemaImportPtr import;
-    const xmlChar *ns;
-    xmlNodePtr root;
-
-    /*
-    * NOTE: This will be used for <import>, <xsi:schemaLocation> and
-    * <xsi:noNamespaceSchemaLocation>.
+    int oldFlags;
+    xmlDocPtr oldDoc;
+    xmlNodePtr node;
+    int ret, oldErrs;
+    xmlSchemaBucketPtr oldbucket = pctxt->constructor->bucket;
+    
+    /* 
+    * Save old values; reset the *main* schema.
+    * URGENT TODO: This is not good; move the per-document information
+    * to the parser.
     */
-    *doc = NULL;
-    /*
-    * Given that the schemaLocation [attribute] is only a hint, it is open
-    * to applications to ignore all but the first <import> for a given
-    * namespace, regardless of the ·actual value· of schemaLocation, but
-    * such a strategy risks missing useful information when new
-    * schemaLocations are offered.
-    *
-    * XSV (ver 2.5-2) does use the first <import> which resolves to a valid schema.
-    * Xerces-J (ver 2.5.1) ignores all but the first given <import> - regardless if
-    * valid or not.
-    * We will follow XSV here.
+    oldFlags = schema->flags;
+    oldDoc = schema->doc;
+    if (schema->flags != 0)
+	xmlSchemaClearSchemaDefaults(schema);
+    schema->doc = bucket->doc;
+    /* !! REMOVED: schema->targetNamespace = bucket->targetNamespace; */
+    pctxt->schema = schema;
+    /* 
+    * Keep the current target namespace on the parser *not* on the
+    * main schema.
     */
-    if (location == NULL) {
+    pctxt->targetNamespace = bucket->targetNamespace;
+    WXS_CONSTRUCTOR(pctxt)->bucket = bucket;
+
+    if ((bucket->targetNamespace != NULL) &&
+	xmlStrEqual(bucket->targetNamespace, xmlSchemaNs)) {
 	/*
-	* Schema Document Location Strategy:
-	*
-	* 3 Based on the namespace name, identify an existing schema document,
-	* either as a resource which is an XML document or a <schema> element
-	* information item, in some local schema repository;
-	*
-	* 5 Attempt to resolve the namespace name to locate such a resource.
-	*
-	* NOTE: Those stategies are not supported, so we will skip.
+	* We are parsing the schema for schemas!
 	*/
-	return (0);
+	pctxt->isS4S = 1;
+    }    
+    /* Mark it as parsed, even if parsing fails. */
+    bucket->parsed++;
+    /* Compile the schema doc. */
+    node = xmlDocGetRootElement(bucket->doc);
+    ret = xmlSchemaParseSchemaElement(pctxt, schema, node);
+    if (ret != 0)
+	goto exit;
+    /* An empty schema; just get out. */
+    if (node->children == NULL)
+	goto exit;
+    oldErrs = pctxt->nberrors;
+    ret = xmlSchemaParseSchemaTopLevel(pctxt, schema, node->children);
+    if (ret != 0)
+	goto exit;
+    /*
+    * TODO: Not nice, but I'm not 100% sure we will get always an error
+    * as a result of the obove functions; so better rely on pctxt->err
+    * as well.
+    */
+    if ((ret == 0) && (oldErrs != pctxt->nberrors)) {
+	ret = pctxt->err;
+	goto exit;
     }
-    if (nsName == NULL)
-	ns = XML_SCHEMAS_NO_NAMESPACE;
-    else
-	ns = nsName;
+    
+exit:
+    WXS_CONSTRUCTOR(pctxt)->bucket = oldbucket;
+    /* Restore schema values. */
+    schema->doc = oldDoc;
+    schema->flags = oldFlags;
+    return(ret);
+}
 
-    import = xmlHashLookup(schema->schemasImports, ns);
-    if (import != NULL) {
-	/*
-	* There was a valid resource for the specified namespace already
-	* defined, so skip.
-	* TODO: This might be changed someday to allow import of
-	* components from multiple documents for a single target namespace.
-	*/
-	return (0);
+static int
+xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt,
+		     xmlSchemaPtr schema,
+		     xmlSchemaBucketPtr bucket)
+{
+    xmlSchemaParserCtxtPtr newpctxt;
+    int res = 0;
+
+    if (bucket == NULL)
+	return(0);
+    if (bucket->parsed) {
+	PERROR_INT("xmlSchemaParseNewDoc",
+	    "reparsing a schema doc");
+	return(-1);
     }
-    if (actxt->type == XML_SCHEMA_CTXT_PARSER)
-	pctxt = (xmlSchemaParserCtxtPtr) actxt;
-    else {
-	xmlSchemaCreatePCtxtOnVCtxt((xmlSchemaValidCtxtPtr) actxt);
-	pctxt = ((xmlSchemaValidCtxtPtr) actxt)->pctxt;
+    if (bucket->doc == NULL) {
+	PERROR_INT("xmlSchemaParseNewDoc",
+	    "parsing a schema doc, but there's no doc");
+	return(-1);
     }
+    if (pctxt->constructor == NULL) {
+	PERROR_INT("xmlSchemaParseNewDoc",
+	    "no constructor");
+	return(-1);
+    }    
+    /* Create and init the temporary parser context. */
+    newpctxt = xmlSchemaNewParserCtxtUseDict(
+	(const char *) bucket->schemaLocation, pctxt->dict);
+    if (newpctxt == NULL)
+	return(-1);
+    newpctxt->constructor = pctxt->constructor;
     /*
-    * Schema Document Location Strategy:
-    *
-    * 2 Based on the location URI, identify an existing schema document,
-    * either as a resource which is an XML document or a <schema> element
-    * information item, in some local schema repository;
-    *
-    * 4 Attempt to resolve the location URI, to locate a resource on the
-    * web which is or contains or references a <schema> element;
-    * TODO: Hmm, I don't know if the reference stuff in 4. will work.
-    *
+    * TODO: Can we avoid that the parser knows about the main schema? 
+    * It would be better if he knows about the current schema bucket
+    * only.
     */
-    if ((absolute == 0) && (node != NULL)) {
-	xmlChar *base, *URI;
+    newpctxt->schema = schema;
+    xmlSchemaSetParserErrors(newpctxt, pctxt->error, pctxt->warning,
+	pctxt->userData);
+    newpctxt->counter = pctxt->counter;
+    
 
-	base = xmlNodeGetBase(node->doc, node);
-	if (base == NULL) {
-	    URI = xmlBuildURI(location, node->doc->URL);
-	} else {
-	    URI = xmlBuildURI(location, base);
-	    xmlFree(base);
-	}
-	if (URI != NULL) {
-	    location = xmlDictLookup(pctxt->dict, URI, -1);
-	    xmlFree(URI);
-	}
+    res = xmlSchemaParseNewDocWithContext(newpctxt, schema, bucket);
+    
+    /* Channel back errors and cleanup the temporary parser context. */
+    if (res != 0)
+	pctxt->err = res;
+    pctxt->nberrors += newpctxt->nberrors;
+    pctxt->counter = newpctxt->counter;
+    newpctxt->constructor = NULL;    
+    /* Free the parser context. */
+    xmlSchemaFreeParserCtxt(newpctxt);
+    return(res);
+}
+
+static void
+xmlSchemaSchemaRelationAddChild(xmlSchemaBucketPtr bucket,
+				xmlSchemaSchemaRelationPtr rel)
+{
+    xmlSchemaSchemaRelationPtr cur = bucket->relations;
+
+    if (cur == NULL) {
+	bucket->relations = rel;
+	return;
     }
-    parserCtxt = xmlNewParserCtxt();
-    if (parserCtxt == NULL) {
-	xmlSchemaPErrMemory(NULL, "xmlSchemaParseImport: "
-	    "allocating a parser context", NULL);
-	return(-1);
-    }
-    if ((pctxt->dict != NULL) && (parserCtxt->dict != NULL)) {
-	xmlDictFree(parserCtxt->dict);
-	parserCtxt->dict = pctxt->dict;
-	xmlDictReference(parserCtxt->dict);
-    }
-    *doc = xmlCtxtReadFile(parserCtxt, (const char *) location,
-	    NULL, SCHEMAS_PARSE_OPTIONS);
+    while (cur->next != NULL)
+	cur = cur->next;
+    cur->next = rel;
+}
+
+
+static const xmlChar *
+xmlSchemaBuildAbsoluteURI(xmlDictPtr dict, const xmlChar* location,
+			  xmlNodePtr ctxtNode)
+{    
     /*
-    * 2.1 The referent is (a fragment of) a resource which is an
-    * XML document (see clause 1.1), which in turn corresponds to
-    * a <schema> element information item in a well-formed information
-    * set, which in turn corresponds to a valid schema.
-    * TODO: What to do with the "fragment" stuff?
-    *
-    * 2.2 The referent is a <schema> element information item in
-    * a well-formed information set, which in turn corresponds
-    * to a valid schema.
-    * NOTE: 2.2 won't apply, since only XML documents will be processed
-    * here.
+    * Build an absolue location URI.
     */
-    if (*doc == NULL) {
-	xmlErrorPtr lerr;
-	/*
-	* It is *not* an error for the application schema reference
-	* strategy to fail.
-	*
-	* If the doc is NULL and the parser error is an IO error we
-	* will assume that the resource could not be located or accessed.
-	*
-	* TODO: Try to find specific error codes to react only on
-	* localisation failures.
-	*
-	* TODO, FIXME: Check the spec: is a namespace added to the imported
-	* namespaces, even if the schemaLocation did not provide
-	* a resource? I guess so, since omitting the "schemaLocation"
-	* attribute, imports a namespace as well.
-	*/
-	lerr = xmlGetLastError();
-	if ((lerr != NULL) && (lerr->domain == XML_FROM_IO)) {
-	    xmlFreeParserCtxt(parserCtxt);
-	    return(0);
+    if (location != NULL) {	
+	if (ctxtNode == NULL)
+	    return(location);
+	else {
+	    xmlChar *base, *URI;
+	    const xmlChar *ret = NULL;
+
+	    base = xmlNodeGetBase(ctxtNode->doc, ctxtNode);
+	    if (base == NULL) {
+		URI = xmlBuildURI(location, ctxtNode->doc->URL);
+	    } else {
+		URI = xmlBuildURI(location, base);
+		xmlFree(base);
+	    }
+	    if (URI != NULL) {
+		ret = xmlDictLookup(dict, URI, -1);
+		xmlFree(URI);
+		return(ret);
+	    }
 	}
-	xmlSchemaCustomErr(actxt,
-	    XML_SCHEMAP_SRC_IMPORT_2_1,
-	    node, NULL,
-	    "Failed to parse the resource '%s' for import",
-	    location, NULL);
-	xmlFreeParserCtxt(parserCtxt);
-	return(XML_SCHEMAP_SRC_IMPORT_2_1);
     }
-    xmlFreeParserCtxt(parserCtxt);
+    return(NULL);
+}
+    
 
-    root = xmlDocGetRootElement(*doc);
-    if (root == NULL) {
-	xmlSchemaCustomErr(actxt,
-	    XML_SCHEMAP_SRC_IMPORT_2_1,
-	    node, NULL,
-	    "The XML document '%s' to be imported has no document "
-	    "element", location, NULL);
-	xmlFreeDoc(*doc);
-	*doc = NULL;
-	return (XML_SCHEMAP_SRC_IMPORT_2_1);
-    }
 
-    xmlSchemaCleanupDoc(pctxt, root);
+/**
+ * xmlSchemaAddSchemaDoc:
+ * @pctxt:  a schema validation context
+ * @schema:  the schema being built
+ * @node:  a subtree containing XML Schema informations
+ *
+ * Parse an included (and to-be-redefined) XML schema document.
+ *
+ * Returns 0 on success, a positive error code on errors and
+ *         -1 in case of an internal or API error.
+ */
 
-    if (!IS_SCHEMA(root, "schema")) {
-	xmlSchemaCustomErr(actxt,
-	    XML_SCHEMAP_SRC_IMPORT_2_1,
-	    node, NULL,
-	    "The XML document '%s' to be imported is not a XML schema document",
-	    location, NULL);
-	xmlFreeDoc(*doc);
-	*doc = NULL;
-	return (XML_SCHEMAP_SRC_IMPORT_2_1);
+static int
+xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt,
+		int type, /* import or include or redefine */
+		const xmlChar *schemaLocation,
+		xmlDocPtr schemaDoc,
+		const char *schemaBuffer,
+		int schemaBufferLen,
+		xmlNodePtr invokingNode,
+		const xmlChar *sourceTargetNamespace,		
+		const xmlChar *importNamespace,	
+		xmlSchemaBucketPtr *bucket)
+{
+    const xmlChar *targetNamespace = NULL;
+    xmlSchemaSchemaRelationPtr relation = NULL;
+    xmlDocPtr doc = NULL;
+    int res = 0, err = 0, located = 0, preserveDoc = 0;
+    xmlSchemaBucketPtr bkt = NULL;
+
+    if (bucket != NULL)
+	*bucket = NULL;
+    
+    switch (type) {
+	case XML_SCHEMA_SCHEMA_IMPORT:
+	case XML_SCHEMA_SCHEMA_MAIN:
+	    err = XML_SCHEMAP_SRC_IMPORT;
+	    break;
+	case XML_SCHEMA_SCHEMA_INCLUDE:
+	    err = XML_SCHEMAP_SRC_INCLUDE;
+	    break;
+	case XML_SCHEMA_SCHEMA_REDEFINE:
+	    err = XML_SCHEMAP_SRC_REDEFINE;
+	    break;
+    }    
+       
+
+    /* Special handling for the main schema:
+    * skip the location and relation logic and just parse the doc.
+    * We need just a bucket to be returned in this case.
+    */    
+    if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt)))
+	goto doc_load;	
+
+    /* Note that we expect the location to be an absulute URI. */ 
+    if (schemaLocation != NULL) {
+	bkt = xmlSchemaGetSchemaBucket(pctxt, schemaLocation);
+	if ((bkt != NULL) &&
+	    (pctxt->constructor->bucket == bkt)) {
+	    /* Report self-imports/inclusions/redefinitions. */
+	    
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
+		invokingNode, NULL,
+		"The schema must not import/include/redefine itself",
+		NULL, NULL);
+	    goto exit;
+	}
     }
-    *targetNamespace = xmlSchemaGetProp(pctxt, root, "targetNamespace");
     /*
-    * Schema Representation Constraint: Import Constraints and Semantics
+    * Create a relation for the graph of schemas.
     */
-    if (nsName == NULL) {
-	if (*targetNamespace != NULL) {
-	    xmlSchemaCustomErr(actxt,
-		XML_SCHEMAP_SRC_IMPORT_3_2,
-		node, NULL,
-		"The XML schema to be imported is not expected "
-		"to have a target namespace; this differs from "
-		"its target namespace of '%s'", *targetNamespace, NULL);
-	    xmlFreeDoc(*doc);
-	    *doc = NULL;
-	    return (XML_SCHEMAP_SRC_IMPORT_3_2);
+    relation = xmlSchemaSchemaRelationCreate();
+    if (relation == NULL)
+	return(-1);    
+    xmlSchemaSchemaRelationAddChild(pctxt->constructor->bucket,
+	relation);
+    relation->type = type;
+
+    /*
+    * Save the namespace import information.
+    */
+    if (WXS_IS_IMPMAIN(type)) {
+	relation->importNamespace = importNamespace;	
+	if (schemaLocation == NULL) {
+	    /*
+	    * No location; this is just an import of the namespace.
+	    * Note that we don't assign a bucket to the relation
+	    * in this case.
+	    */
+	    goto exit;
 	}
+	targetNamespace = importNamespace;
+    }
+
+    /* Did we already fetch the doc? */
+    if (bkt != NULL) {		
+	/* TODO: The following nasty cases will produce an error. */
+	if ((WXS_IS_IMPMAIN(type)) && (! bkt->imported)) {
+	    /* We included/redefined and then try to import a schema. */
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
+		invokingNode, NULL,
+		"The schema document '%s' cannot be imported, since "
+		"it was already included or redefined",
+		schemaLocation, NULL);
+	    goto exit;
+	} else if ((! WXS_IS_IMPMAIN(type)) && (bkt->imported)) {
+	    /* We imported and then try to include/redefine a schema. */
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
+		invokingNode, NULL,
+		"The schema document '%s' cannot be included or "
+		"redefined, since it was already imported",
+		schemaLocation, NULL);
+	    goto exit;
+	}	
+    }
+    	
+    if (WXS_IS_IMPMAIN(type)) {
+	/*
+	* Given that the schemaLocation [attribute] is only a hint, it is open
+	* to applications to ignore all but the first <import> for a given
+	* namespace, regardless of the ·actual value· of schemaLocation, but
+	* such a strategy risks missing useful information when new
+	* schemaLocations are offered.
+	*
+	* We will use the first <import> that comes with a location.
+	* Further <import>s *with* a location, will result in an error.
+	* TODO: Better would be to just report a warning here, but
+	* we'll try it this way until someone complains.
+	*
+	* Schema Document Location Strategy:
+	* 3 Based on the namespace name, identify an existing schema document,
+	* either as a resource which is an XML document or a <schema> element
+	* information item, in some local schema repository;
+	* 5 Attempt to resolve the namespace name to locate such a resource.
+	*
+	* NOTE: (3) and (5) are not supported.
+	*/	
+	if (bkt != NULL) {
+	    relation->bucket = bkt;
+	    goto exit;
+	}
+	bkt = xmlSchemaGetSchemaBucketByTNS(pctxt,
+	    importNamespace, 1);
+
+	if (bkt != NULL) {	    
+	    relation->bucket = bkt;
+	    if (bkt->schemaLocation == NULL) {
+		/* First given location of the schema; load the doc. */
+		bkt->schemaLocation = schemaLocation;
+	    } else {
+		if (!xmlStrEqual(schemaLocation,
+		    bkt->schemaLocation)) {
+		    /*
+		    * Additional location given; just skip it.
+		    * URGENT TODO: We should report a warning here.
+		    * res = XML_SCHEMAP_SRC_IMPORT;
+		    */
+		    xmlSchemaCustomWarning(ACTXT_CAST pctxt,
+			XML_SCHEMAP_WARN_SKIP_SCHEMA,
+			invokingNode, NULL,
+			"Skipping import of schema located at '%s' for the "
+			"namespace '%s', since this namespace was already "
+			"imported with the schema located at '%s'",
+			schemaLocation, importNamespace, bkt->schemaLocation);
+		}
+		goto exit;
+	    }
+	}	
+	/* 
+	* No bucket + first location: load the doc and create a
+	* bucket.
+	*/
     } else {
-	if (*targetNamespace == NULL) {
-	    xmlSchemaCustomErr(actxt,
-		XML_SCHEMAP_SRC_IMPORT_3_1,
-		node, NULL,
-		"The XML schema to be imported is expected to have a target "
-		"namespace of '%s'", nsName, NULL);
-	    xmlFreeDoc(*doc);
-	    *doc = NULL;
-	    return (XML_SCHEMAP_SRC_IMPORT_3_1);
-	} else if (!xmlStrEqual(*targetNamespace, nsName)) {
-	    xmlSchemaCustomErr(actxt,
-		XML_SCHEMAP_SRC_IMPORT_3_1,
-		node, NULL,
-		"The XML schema to be imported is expected to have a "
-		"target namespace of '%s'; this differs from "
-		"its target namespace of '%s'",
-		nsName, *targetNamespace);
-	    xmlFreeDoc(*doc);
-	    *doc = NULL;
-	    return (XML_SCHEMAP_SRC_IMPORT_3_1);
+	/* <include> and <redefine> */
+	if (bkt != NULL) {
+	    	    
+	    if ((bkt->origTargetNamespace == NULL) &&
+		(bkt->targetNamespace != sourceTargetNamespace)) {
+		xmlSchemaBucketPtr chamel;
+		
+		/*
+		* Chameleon include/redefine: skip loading only if it was
+		* aleady build for the targetNamespace of the including
+		* schema.
+		*/
+		/*
+		* URGENT TODO: If the schema is a chameleon-include then copy
+		* the components into the including schema and modify the
+		* targetNamespace of those components, do nothing otherwise.
+		* NOTE: This is currently worked-around by compiling the
+		* chameleon for every destinct including targetNamespace; thus
+		* not performant at the moment.
+		* TODO: Check when the namespace in wildcards for chameleons
+		* needs to be converted: before we built wildcard intersections
+		* or after.
+		*   Answer: after!
+		*/
+		chamel = xmlSchemaGetChameleonSchemaBucket(pctxt,
+		    schemaLocation, sourceTargetNamespace);
+		if (chamel != NULL) {
+		    /* A fitting chameleon was already parsed; NOP. */
+		    relation->bucket = chamel;
+		    goto exit;
+		}
+		/* 
+		* We need to parse the chameleon again for a different
+		* targetNamespace.
+		* CHAMELEON TODO: Optimize this by only parsing the
+		* chameleon once, and then copying the components to
+		* the new targetNamespace.
+		*/
+		bkt = NULL;
+	    } else {
+		relation->bucket = bkt;
+		goto exit;
+	    }	    
 	}
     }
-    import = xmlSchemaAddImport(pctxt, &(schema->schemasImports), nsName);
-    if (import == NULL) {
-	AERROR_INT("xmlSchemaAcquireSchemaDoc",
-	    "failed to build import table");
-	xmlFreeDoc(*doc);
-	*doc = NULL;
-	return (-1);
+    if ((bkt != NULL) && (bkt->doc != NULL)) {
+	PERROR_INT("xmlSchemaAddSchemaDoc",
+	    "trying to load a schema doc, but a doc is already "
+	    "assigned to the schema bucket");
+	goto exit_failure;
     }
-    import->schemaLocation = location;
-    import->doc = *doc;
-    return (0);
-}
 
-static void
-xmlSchemaParseForImpInc(xmlSchemaParserCtxtPtr pctxt,
-			xmlSchemaPtr schema,
-			const xmlChar *targetNamespace,
-			xmlNodePtr node)
-{
-    const xmlChar *oldURL, **oldLocImps, *oldTNS;
-    int oldFlags, oldNumLocImps, oldSizeLocImps, oldIsS4S;
-
+doc_load:
     /*
-    * Save and reset the context & schema.
+    * Load the document.
     */
-    oldURL = pctxt->URL;
-    /* TODO: Is using the doc->URL here correct? */
-    pctxt->URL = node->doc->URL;
+    if (schemaDoc != NULL) {
+	doc = schemaDoc;
+	/* Don' free this one, since it was provided by the caller. */
+	preserveDoc = 1;
+	/* TODO: Does the context or the doc hold the location? */
+	if (schemaDoc->URL != NULL)
+	    schemaLocation = xmlDictLookup(pctxt->dict,
+		schemaDoc->URL, -1);
 
-    oldLocImps = pctxt->localImports;
-    pctxt->localImports = NULL;
-    oldNumLocImps = pctxt->nbLocalImports;
-    pctxt->nbLocalImports = 0;
-    oldSizeLocImps = pctxt->sizeLocalImports;
-    pctxt->sizeLocalImports = 0;
+    } else if ((schemaLocation != NULL) || (schemaBuffer != NULL)) {
+	xmlParserCtxtPtr parserCtxt;
 
-    oldFlags = schema->flags;
-    oldIsS4S = pctxt->isS4S;
-
-    xmlSchemaClearSchemaDefaults(schema);
-    oldTNS = schema->targetNamespace;
-    schema->targetNamespace = targetNamespace;
-    if ((targetNamespace != NULL) &&
-	xmlStrEqual(targetNamespace, xmlSchemaNs)) {
+	parserCtxt = xmlNewParserCtxt();
+	if (parserCtxt == NULL) {
+	    xmlSchemaPErrMemory(NULL, "xmlSchemaGetDoc, "
+		"allocating a parser context", NULL);
+	    goto exit_failure;
+	}
+	if ((pctxt->dict != NULL) && (parserCtxt->dict != NULL)) {
+	    /*
+	    * TODO: Do we have to burden the schema parser dict with all
+	    * the content of the schema doc?
+	    */
+	    xmlDictFree(parserCtxt->dict);
+	    parserCtxt->dict = pctxt->dict;
+	    xmlDictReference(parserCtxt->dict);
+	}
+	if (schemaLocation != NULL) {
+	    /* Parse from file. */
+	    doc = xmlCtxtReadFile(parserCtxt, (const char *) schemaLocation,
+		NULL, SCHEMAS_PARSE_OPTIONS);
+	} else if (schemaBuffer != NULL) {
+	    /* Parse from memory buffer. */
+	    doc = xmlCtxtReadMemory(parserCtxt, schemaBuffer, schemaBufferLen,
+		NULL, NULL, SCHEMAS_PARSE_OPTIONS);
+	    schemaLocation = xmlStrdup(BAD_CAST "in_memory_buffer");
+	    if (doc != NULL)
+		doc->URL = schemaLocation;	    
+	}
 	/*
-	* We are parsing the schema for schema!
+	* For <import>:
+	* 2.1 The referent is (a fragment of) a resource which is an
+	* XML document (see clause 1.1), which in turn corresponds to
+	* a <schema> element information item in a well-formed information
+	* set, which in turn corresponds to a valid schema.
+	* TODO: (2.1) fragments of XML documents are not supported.
+	*
+	* 2.2 The referent is a <schema> element information item in
+	* a well-formed information set, which in turn corresponds
+	* to a valid schema.
+	* TODO: (2.2) is not supported.
 	*/
-	pctxt->isS4S = 1;
+	if (doc == NULL) {
+	    xmlErrorPtr lerr;
+	    lerr = xmlGetLastError();
+	    /*
+	    * Check if this a parser error, or if the document could
+	    * just not be located.
+	    * TODO: Try to find specific error codes to react only on
+	    * localisation failures.
+	    */
+	    if ((lerr == NULL) || (lerr->domain != XML_FROM_IO)) {
+		/*
+		* We assume a parser error here.
+		*/
+		located = 1;
+		/* TODO: Error code ?? */
+		res = XML_SCHEMAP_SRC_IMPORT_2_1;
+		xmlSchemaCustomErr(ACTXT_CAST pctxt, res,
+		    invokingNode, NULL,
+		    "Failed to parse the XML resource '%s'",
+		    schemaLocation, NULL);		
+	    }
+	}
+	xmlFreeParserCtxt(parserCtxt);
+	if ((doc == NULL) && located)
+	    goto exit_error;
+    } else {
+	xmlSchemaPErr(pctxt, NULL,
+	    XML_SCHEMAP_NOTHING_TO_PARSE,
+	    "No information for parsing was provided with the "
+	    "given schema parser context.\n",
+	    NULL, NULL);
+	goto exit_failure;
     }
     /*
-    * Parse the schema.
+    * Preprocess the document.
     */
-    xmlSchemaParseSchemaDefaults(pctxt, schema, node);
-    xmlSchemaParseSchemaTopLevel(pctxt, schema, node->children);
+    if (doc != NULL) {
+	xmlNodePtr docElem = NULL;
+
+	located = 1;	
+	docElem = xmlDocGetRootElement(doc);
+	if (docElem == NULL) {
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_NOROOT,
+		invokingNode, NULL, 
+		"The document '%s' has no document element",
+		schemaLocation, NULL);
+	    xmlFreeDoc(doc);
+	    doc = NULL;
+	    goto exit_error;
+	}
+	/*
+	* Remove all the blank text nodes.
+	*/
+	xmlSchemaCleanupDoc(pctxt, docElem);
+	/*
+	* Check the schema's top level element.
+	*/
+	if (!IS_SCHEMA(docElem, "schema")) {
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_NOT_SCHEMA,
+		invokingNode, NULL,
+		"The XML document '%s' is not a schema document",
+		schemaLocation, NULL);
+	    xmlFreeDoc(doc);
+	    doc = NULL;
+	    goto exit_error;
+	}
+	/* 
+	* Note that we don't apply a type check for the
+	* targetNamespace value here.
+	*/
+	targetNamespace = xmlSchemaGetProp(pctxt, docElem,
+	    "targetNamespace");
+    }
+    
+/* after_doc_loading: */
+    if ((bkt == NULL) && located) {
+	/* Only create a bucket if the schema was located. */
+        bkt = xmlSchemaBucketCreate(pctxt, type,
+	    targetNamespace);
+	if (bkt == NULL)
+	    goto exit_failure;
+    }
+    if (bkt != NULL) {
+	bkt->schemaLocation = schemaLocation;
+	bkt->located = located;
+	if (doc != NULL) {
+	    bkt->doc = doc;
+	    bkt->targetNamespace = targetNamespace;
+	    bkt->origTargetNamespace = targetNamespace;
+	    if (preserveDoc)
+		bkt->preserveDoc = 1;
+	}
+	if (WXS_IS_IMPMAIN(type))
+	    bkt->imported++;
+	    /*
+	    * Add it to the graph of schemas.
+	    */
+	if (relation != NULL)
+	    relation->bucket = bkt;
+    }
+  
+exit:
     /*
-    * Restore the context & schema.
+    * Return the bucket explicitely; this is needed for the
+    * main schema.
     */
-    schema->flags = oldFlags;
-    schema->targetNamespace = oldTNS;
-    if (pctxt->localImports != NULL)
-	xmlFree((xmlChar *) pctxt->localImports);
-    pctxt->localImports = oldLocImps;
-    pctxt->nbLocalImports = oldNumLocImps;
-    pctxt->sizeLocalImports = oldSizeLocImps;
-    pctxt->URL = oldURL;
-    pctxt->isS4S = oldIsS4S;
+    if (bucket != NULL)
+	*bucket = bkt;    
+    return (0);
+
+exit_error:
+    if ((doc != NULL) && (! preserveDoc)) {
+	xmlFreeDoc(doc);
+	if (bkt != NULL)
+	    bkt->doc = NULL;
+    }
+    return(pctxt->err);
+
+exit_failure:
+    if ((doc != NULL) && (! preserveDoc)) {
+	xmlFreeDoc(doc);
+	if (bkt != NULL)
+	    bkt->doc = NULL;
+    }    
+    return (-1);
 }
 
 /**
@@ -9354,10 +9805,9 @@
     xmlNodePtr child;
     const xmlChar *namespaceName = NULL;
     const xmlChar *schemaLocation = NULL;
-    const xmlChar *targetNamespace;
     xmlAttrPtr attr;
-    xmlDocPtr doc;
     int ret = 0;
+    xmlSchemaBucketPtr bucket = NULL;
 
     if ((pctxt == NULL) || (schema == NULL) || (node == NULL))
         return (-1);
@@ -9432,13 +9882,13 @@
 	* must not match the ·actual value· of the enclosing <schema>'s
 	* targetNamespace [attribute].
 	*/
-	if (xmlStrEqual(schema->targetNamespace, namespaceName)) {
+	if (xmlStrEqual(pctxt->targetNamespace, namespaceName)) {
 	    xmlSchemaPCustomErr(pctxt,
 		XML_SCHEMAP_SRC_IMPORT_1_1,
 		NULL, NULL, node,
 		"The value of the attribute 'namespace' must not match "
 		"the target namespace '%s' of the importing schema",
-		schema->targetNamespace);
+		pctxt->targetNamespace);
 	    return (pctxt->err);
 	}
     } else {
@@ -9446,7 +9896,7 @@
 	* 1.2 If the namespace [attribute] is not present, then the enclosing
 	* <schema> must have a targetNamespace [attribute].
 	*/
-	if (schema->targetNamespace == NULL) {
+	if (pctxt->targetNamespace == NULL) {
 	    xmlSchemaPCustomErr(pctxt,
 		XML_SCHEMAP_SRC_IMPORT_1_2,
 		NULL, NULL, node,
@@ -9457,266 +9907,46 @@
 	}
     }
     /*
-    * Add the namespace to the list of locally imported namespace.
-    * TODO: This could be removed if the schema-graph is ready. I.e.
-    *       use the graph for this info instead.
-    */
-    if (pctxt->localImports == NULL) {
-	pctxt->localImports = (const xmlChar **) xmlMalloc(10 *
-	    sizeof(const xmlChar*));
-	pctxt->sizeLocalImports = 10;
-	pctxt->nbLocalImports = 0;
-    } else if (pctxt->sizeLocalImports <= pctxt->nbLocalImports) {
-	pctxt->sizeLocalImports *= 2;
-	pctxt->localImports = (const xmlChar **) xmlRealloc(
-	    (xmlChar **) pctxt->localImports,
-	    pctxt->sizeLocalImports * sizeof(const xmlChar*));
-    }
-    pctxt->localImports[pctxt->nbLocalImports++] = namespaceName;
-    /*
     * Locate and aquire the schema document.
     */
-    ret = xmlSchemaAcquireSchemaDoc((xmlSchemaAbstractCtxtPtr) pctxt,
-	schema, node, namespaceName,
-	schemaLocation, &doc, &targetNamespace, 0);
-    if (ret != 0) {
-	if (doc != NULL)
-	    xmlFreeDoc(doc);
-	return (ret);
-    } else if (doc != NULL) {
-       	xmlSchemaParseForImpInc(pctxt, schema, targetNamespace,
-	    xmlDocGetRootElement(doc));
-    }
+    if (schemaLocation != NULL)
+	schemaLocation = xmlSchemaBuildAbsoluteURI(pctxt->dict,
+	    schemaLocation, node);
+    ret = xmlSchemaAddSchemaDoc(pctxt, XML_SCHEMA_SCHEMA_IMPORT,
+	schemaLocation, NULL, NULL, 0, node, pctxt->targetNamespace,
+	namespaceName, &bucket);
 
-    return (0);
-}
+    if (ret != 0)
+	return(ret);
 
-/**
- * xmlSchemaParseIncludedDoc:
- * @pctxt:  a schema validation context
- * @schema:  the schema being built
- * @node:  a subtree containing XML Schema informations
- *
- * Parse an included (and to-be-redefined) XML schema document.
- *
- * Returns 0 on success, a positive error code on errors and
- *         -1 in case of an internal or API error.
- */
-static int
-xmlSchemaParseIncludedDoc(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema,
-			  xmlNodePtr node, const xmlChar *schemaLocation,
-			  int *located)
-{
-    const xmlChar *targetNamespace;
-    xmlDocPtr doc = NULL;
-    xmlNodePtr root = NULL;
-    xmlSchemaIncludePtr include = NULL;
-    int wasConvertingNs = 0;
-    xmlParserCtxtPtr parserCtxt;
-
-    if (located == NULL)
-	return(-1);
-    (*located) = 0;
     /*
-    * Check if this one was already processed to avoid incorrect
-    * duplicate component errors and infinite circular inclusion.
+    * For <import>: "It is *not* an error for the application
+    * schema reference strategy to fail."
+    * So just don't parse if no schema document was found.
+    * Note that we will get no bucket if the schema could not be
+    * located or if there was no schemaLocation.
     */
-    include = schema->includes;
-    while (include != NULL) {
-	if (xmlStrEqual(include->schemaLocation, schemaLocation)) {
-	    (*located) = 1;
-	    targetNamespace = include->origTargetNamespace;
-	    if (targetNamespace == NULL) {
-		/*
-		* Chameleon include: skip only if it was build for
-		* the targetNamespace of the including schema.
-		*/
-		if (xmlStrEqual(schema->targetNamespace,
-		    include->targetNamespace)) {
-		    goto check_targetNamespace;
-		}
-	    } else {		
-		goto check_targetNamespace;
-	    }
-	}
-	include = include->next;
+    if ((bucket == NULL) && (schemaLocation != NULL)) {
+	xmlSchemaCustomWarning(ACTXT_CAST pctxt,
+	    XML_SCHEMAP_WARN_UNLOCATED_SCHEMA,
+	    node, NULL,
+	    "Failed to locate a schema at location '%s'. "
+	    "Skipping the import", schemaLocation, NULL, NULL);
     }
-    /*
-    * First step is to parse the input document into an DOM/Infoset
-    * TODO: Use xmlCtxtReadFile to share the dictionary?
-    */
-    parserCtxt = xmlNewParserCtxt();
-    if (parserCtxt == NULL) {
-	xmlSchemaPErrMemory(NULL, "xmlSchemaParseInclude: "
-	    "allocating a parser context", NULL);
-	goto exit_failure;
+    
+    if ((bucket != NULL) && CAN_PARSE_SCHEMA(bucket)) {	
+	ret = xmlSchemaParseNewDoc(pctxt, schema, bucket);
     }
-
-    if ((pctxt->dict != NULL) && (parserCtxt->dict != NULL)) {
-	xmlDictFree(parserCtxt->dict);
-	parserCtxt->dict = pctxt->dict;
-	xmlDictReference(parserCtxt->dict);
-    }
-
-    doc = xmlCtxtReadFile(parserCtxt, (const char *) schemaLocation,
-	    NULL, SCHEMAS_PARSE_OPTIONS);
-    xmlFreeParserCtxt(parserCtxt);
-    if (doc == NULL) {			
-	goto exit_not_located;
-    }
-    (*located) = 1;
-    /*
-     * Then extract the root of the schema
-     */
-    root = xmlDocGetRootElement(doc);
-    if (root == NULL) {
-	xmlSchemaPCustomErr(pctxt,
-	    XML_SCHEMAP_NOROOT,
-	    NULL, NULL, node,
-	    "The included document '%s' has no document "
-	    "element", schemaLocation);
-	goto exit_error;
-    }
-
-    /*
-     * Remove all the blank text nodes
-     */
-    xmlSchemaCleanupDoc(pctxt, root);
-
-    /*
-     * Check the schemas top level element
-     */
-    if (!IS_SCHEMA(root, "schema")) {
-	xmlSchemaPCustomErr(pctxt,
-	    XML_SCHEMAP_NOT_SCHEMA,
-	    NULL, NULL, node,
-	    "The document '%s' to be included is not a schema document",
-	    schemaLocation);
-	goto exit_error;
-    }
-
-    targetNamespace = xmlSchemaGetProp(pctxt, root, "targetNamespace");
-    /*
-    * 2.1 SII has a targetNamespace [attribute], and its ·actual
-    * value· is identical to the ·actual value· of the targetNamespace
-    * [attribute] of SII’ (which must have such an [attribute]).
-    */
-check_targetNamespace:
-    if (targetNamespace != NULL) {
-	if (schema->targetNamespace == NULL) {
-	    xmlSchemaPCustomErr(pctxt,
-		XML_SCHEMAP_SRC_INCLUDE,
-		NULL, NULL, node,
-		"The target namespace of the included schema "
-		"'%s' has to be absent, since the including schema "
-		"has no target namespace",
-		schemaLocation);
-	    goto exit_error;
-	} else if (!xmlStrEqual(targetNamespace, schema->targetNamespace)) {
-	    xmlSchemaPCustomErrExt(pctxt,
-		XML_SCHEMAP_SRC_INCLUDE,
-		NULL, NULL, node,
-		"The target namespace '%s' of the included schema '%s' "
-		"differs from '%s' of the including schema",
-		targetNamespace, schemaLocation, schema->targetNamespace);
-	    goto exit_error;
-	}
-    } else if (schema->targetNamespace != NULL) {
-	if ((schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) == 0) {
-	    schema->flags |= XML_SCHEMAS_INCLUDING_CONVERT_NS;
-	} else
-	    wasConvertingNs = 1;
-    }
-
-    if (include != NULL)
-	goto exit;
-
-    /*
-    * URGENT TODO: If the schema is a chameleon-include then copy the
-    * components into the including schema and modify the targetNamespace
-    * of those components, do nothing otherwise.
-    * NOTE: This is currently worked-around by compiling the chameleon
-    * for every destinct including targetNamespace; thus not performant at
-    * the moment.
-    * TODO: Check when the namespace in wildcards for chameleons needs
-    * to be converted: before we built wildcard intersections or after.
-    *   Answer: after!
-    */
-    /*
-    * Register the include.
-    */
-    include = (xmlSchemaIncludePtr) xmlMalloc(sizeof(xmlSchemaInclude));
-    if (include == NULL) {
-        xmlSchemaPErrMemory(pctxt, "allocating include entry", NULL);
-	goto exit_failure;
-    }
-    memset(include, 0, sizeof(xmlSchemaInclude));
-    include->next = schema->includes;
-    schema->includes = include;
-    /*
-    * TODO: Use the resolved URI for the this location, since it might
-    * differ if using filenames/URIs simultaneosly.
-    */
-    include->schemaLocation = schemaLocation;
-    include->doc = doc;
-    /*
-    * In case of chameleons, the original target namespace will differ
-    * from the resulting namespace.
-    */
-    include->origTargetNamespace = targetNamespace;
-    include->targetNamespace = schema->targetNamespace;
-#ifdef DEBUG_INCLUDES
-    if (targetNamespace != schema->targetNamespace)
-	xmlGenericError(xmlGenericErrorContext,
-	    "INCLUDING CHAMELEON '%s'\n  orig TNS '%s'\n"
-	    "  into TNS '%s'\n", schemaLocation,
-	    targetNamespace, schema->targetNamespace);
-    else
-	xmlGenericError(xmlGenericErrorContext,
-	    "INCLUDING '%s'\n  orig-TNS '%s'\n", schemaLocation,
-	    targetNamespace);
-#endif
-    /*
-    * Compile the included schema.
-    */
-    xmlSchemaParseForImpInc(pctxt, schema, schema->targetNamespace, root);
-
-exit:
-    /*
-    * Remove the converting flag.
-    */
-    if ((wasConvertingNs == 0) &&
-	(schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS))
-	schema->flags ^= XML_SCHEMAS_INCLUDING_CONVERT_NS;
-    return (0);
-
-exit_error:
-    if (doc != NULL) {
-	if (include != NULL)
-	    include->doc = NULL;
-	xmlFreeDoc(doc);
-    }
-    return (pctxt->err);
-
-exit_not_located:
-    return(0);
-
-exit_failure:
-    if (doc != NULL) {
-	if (include != NULL)
-	    include->doc = NULL;
-	xmlFreeDoc(doc);
-    }
-    return (-1);
+    
+    return (ret);
 }
 
-
 static int
 xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt,
 				     xmlSchemaPtr schema,
 				     xmlNodePtr node,
 				     xmlChar **schemaLocation,
-				     int isRedefine)
+				     int type)
 {
     xmlAttrPtr attr;
 
@@ -9786,7 +10016,7 @@
     * Report self-inclusion and self-redefinition.
     */
     if (xmlStrEqual(*schemaLocation, pctxt->URL)) {
-	if (isRedefine) {
+	if (type == XML_SCHEMA_SCHEMA_REDEFINE) {
 	    xmlSchemaPCustomErr(pctxt,
 		XML_SCHEMAP_SRC_REDEFINE,
 		NULL, NULL, node,
@@ -9813,11 +10043,13 @@
 xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt,
 				xmlSchemaPtr schema,
 				xmlNodePtr node,
-				int isRedefine)
+				int type)
 {
     xmlNodePtr child = NULL;
     const xmlChar *schemaLocation = NULL;
-    int res = 0, located = 0, hasRedefinitions = 0;
+    int res = 0, /* docRes = 0, located = 0, */ hasRedefinitions = 0;
+    int isChameleon = 0, wasChameleon = 0;
+    xmlSchemaBucketPtr bucket = NULL;
 
     if ((pctxt == NULL) || (schema == NULL) || (node == NULL))
         return (-1);
@@ -9827,27 +10059,141 @@
     * be already converted to an absolute URI.
     */
     res = xmlSchemaParseIncludeOrRedefineAttrs(pctxt, schema,
-	node, (xmlChar **) (&schemaLocation), isRedefine);
+	node, (xmlChar **) (&schemaLocation), type);
     if (res != 0)
-	return(res);
-
+	return(res);    	   
     /*
-    * Include the schema.
+    * Load and add the schema document.
     */
-    res = xmlSchemaParseIncludedDoc(pctxt, schema, node,
-	schemaLocation, &located);
+    res = xmlSchemaAddSchemaDoc(pctxt, type, schemaLocation, NULL,
+	NULL, 0, node, pctxt->targetNamespace, NULL, &bucket);
     if (res != 0)
-	return(res);
-        
+	return(res);    
     /*
+    if (bucket == NULL) {	
+	PERROR_INT("xmlSchemaParseIncludeOrRedefine",
+	    "no schema bucket aquired");
+	return(-1);
+    }
+    */
+    if ((bucket == NULL) || (bucket->doc == NULL)) {
+	if (type == XML_SCHEMA_SCHEMA_INCLUDE) {
+	    /*
+	    * WARNING for <include>:
+	    * We will raise an error if the schema cannot be located
+	    * for inclusions, since the that was the feedback from the
+	    * schema people. I.e. the following spec piece will *not* be
+	    * satisfied:
+	    * SPEC src-include: "It is not an error for the ·actual value· of the
+	    * schemaLocation [attribute] to fail to resolve it all, in which
+	    * case no corresponding inclusion is performed.
+	    * So do we need a warning report here?"
+	    */
+	    res = XML_SCHEMAP_SRC_INCLUDE;
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, res,
+		node, NULL,
+		"Failed to load the document '%s' for inclusion",
+		schemaLocation, NULL);
+	} else {
+	    /*
+	    * NOTE: This was changed to raise an error even if no redefinitions
+	    * are specified.
+	    *
+	    * SPEC src-redefine (1)
+	    * "If there are any element information items among the [children]
+	    * other than <annotation> then the ·actual value· of the
+	    * schemaLocation [attribute] must successfully resolve."
+	    * TODO: Ask the WG if a the location has always to resolve
+	    * here as well!
+	    */
+	    res = XML_SCHEMAP_SRC_REDEFINE;
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt, res,
+		node, NULL,
+		"Failed to load the document '%s' for redefinition",
+		schemaLocation, NULL);
+	}
+    } else {
+	/*
+	* Check targetNamespace sanity before parsing the new schema.
+	* TODO: Note that we won't check further content if the
+	* targetNamespace was bad.
+	*/    
+	if (bucket->origTargetNamespace != NULL) {	    
+	    /*
+	    * SPEC src-include (2.1)
+	    * "SII has a targetNamespace [attribute], and its ·actual
+	    * value· is identical to the ·actual value· of the targetNamespace
+	    * [attribute] of SII’ (which must have such an [attribute])."
+	    */
+	    if (pctxt->targetNamespace == NULL) {
+		xmlSchemaCustomErr(ACTXT_CAST pctxt,
+		    XML_SCHEMAP_SRC_INCLUDE,
+		    node, NULL,
+		    "The target namespace of the included/redefined schema "
+		    "'%s' has to be absent, since the including/redefining "
+		    "schema has no target namespace",
+		    schemaLocation, NULL);
+		goto exit_error;
+	    } else if (!xmlStrEqual(bucket->origTargetNamespace,
+		pctxt->targetNamespace)) {
+		/* TODO: Change error function. */
+		xmlSchemaPCustomErrExt(pctxt,
+		    XML_SCHEMAP_SRC_INCLUDE,
+		    NULL, NULL, node,
+		    "The target namespace '%s' of the included/redefined "
+		    "schema '%s' differs from '%s' of the "
+		    "including/redefining schema",
+		    bucket->origTargetNamespace, schemaLocation,
+		    pctxt->targetNamespace);
+		goto exit_error;
+	    }
+	} else if (pctxt->targetNamespace != NULL) {	    
+	    /*
+	    * Chameleons: the original target namespace will
+	    * differ from the resulting namespace.
+	    */
+	    isChameleon = 1;
+	    if (bucket->parsed &&
+		(bucket->targetNamespace != pctxt->targetNamespace)) {
+		/*
+		* This is a sanity check, I dunno yet if this can happen.
+		*/
+		PERROR_INT("xmlSchemaParseIncludeOrRedefine",
+		    "trying to use an already parsed schema for a "
+		    "different targetNamespace");
+		return(-1);
+	    }
+	    bucket->targetNamespace = pctxt->targetNamespace;
+	}
+    }    
+    /*
+    * Parse the schema.
+    */   
+    if (bucket && (!bucket->parsed) && (bucket->doc != NULL)) {
+	if (isChameleon) {
+	    /* TODO: Get rid of this flag on the schema itself. */
+	    if ((schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) == 0) {
+		schema->flags |= XML_SCHEMAS_INCLUDING_CONVERT_NS;
+	    } else
+		wasChameleon = 1;
+	}
+	xmlSchemaParseNewDoc(pctxt, schema, bucket);
+	/* Restore chameleon flag. */
+	if (isChameleon && (!wasChameleon))
+	    schema->flags ^= XML_SCHEMAS_INCLUDING_CONVERT_NS;
+    }
+    /*
     * And now for the children...
     */
-    child = node->children;
-    
-    if (isRedefine) {
+    child = node->children;    
+    if (type == XML_SCHEMA_SCHEMA_REDEFINE) {
+	
 	/*
 	* Parse (simpleType | complexType | group | attributeGroup))*
 	*/
+	/*
+	* How to proceed if the redefined schema was not located?
+	*/
 	pctxt->isRedefine = 1;
 	while (IS_SCHEMA(child, "annotation") ||
 	    IS_SCHEMA(child, "simpleType") ||
@@ -9858,19 +10204,27 @@
 		/*
 		* TODO: discard or not?
 		*/
-	    } else if (IS_SCHEMA(child, "simpleType")) {		
-		xmlSchemaParseSimpleType(pctxt, schema, child, 1);
-	    } else if (IS_SCHEMA(child, "complexType")) {
-		xmlSchemaParseComplexType(pctxt, schema, child, 1);
-		hasRedefinitions = 1;
-	    } else if (IS_SCHEMA(child, "group")) {
-		TODO
-		hasRedefinitions = 1;
-		/* xmlSchemaParseModelGroupDefinition(pctxt, schema, child); */
-	    } else if (IS_SCHEMA(child, "attributeGroup")) {
-		TODO
-		hasRedefinitions = 1;
-		/* xmlSchemaParseAttributeGroup(pctxt, schema, child, 1); */
+	    } else if (bucket && bucket->parsed) {
+		/*
+		* TODO: Not nice: we won't parse the stuff if the redefined
+		* document was not parsed or not located.
+		*/
+		if (IS_SCHEMA(child, "simpleType")) {
+		    xmlSchemaParseSimpleType(pctxt, schema, child, 1);
+		} else if (IS_SCHEMA(child, "complexType")) {
+		    xmlSchemaParseComplexType(pctxt, schema, child, 1);
+		    hasRedefinitions = 1;
+		} else if (IS_SCHEMA(child, "group")) {
+		    TODO
+		    hasRedefinitions = 1;
+		    /* xmlSchemaParseModelGroupDefinition(pctxt,
+			schema, child); */
+		} else if (IS_SCHEMA(child, "attributeGroup")) {
+		    TODO
+		    hasRedefinitions = 1;
+		    /* xmlSchemaParseAttributeGroup(pctxt, schema,
+			child, 1); */
+		}
 	    }
 	    child = child->next;
 	}
@@ -9885,71 +10239,37 @@
     }    
     if (child != NULL) {
 	res = XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED;
-	if (isRedefine) {
-	    xmlSchemaPContentErr(pctxt,
-		res,
+	if (type == XML_SCHEMA_SCHEMA_REDEFINE) {
+	    xmlSchemaPContentErr(pctxt, res,
 		NULL, NULL, node, child, NULL,
 		"(annotation | (simpleType | complexType | group | attributeGroup))*");
 	} else {
-	     xmlSchemaPContentErr(pctxt,
-		res,
+	     xmlSchemaPContentErr(pctxt, res,
 		NULL, NULL, node, child, NULL,
 		"(annotation?)");
 	}	
-    }
-    if (!located) {
-	/*
-	* TODO: This is all *not* yet OK, since we get a !located if the
-	* document was not an XML document as well :-(
-	*/
-	if (!isRedefine) {	
-	    /*
-	    * WARNING for <include>:
-	    * We will raise an error if the schema cannot be located
-	    * for inclusions, since the that was the feedback from the
-	    * schema people. I.e. the following spec piece will *not* be
-	    * satisfied:
-	    * SPEC src-include: "It is not an error for the ·actual value· of the
-	    * schemaLocation [attribute] to fail to resolve it all, in which
-	    * case no corresponding inclusion is performed.
-	    * So do we need a warning report here?"
-	    */
-	    res = XML_SCHEMAP_SRC_INCLUDE;
-	    xmlSchemaPCustomErr(pctxt, res,
-		NULL, NULL, node,
-		"Failed to load the document '%s' for inclusion",
-		schemaLocation);
-	} else if (hasRedefinitions) {
-	    /*
-	    * SPEC src-redefine (1)
-	    * "If there are any element information items among the [children]
-	    * other than <annotation> then the ·actual value· of the
-	    * schemaLocation [attribute] must successfully resolve."
-	    * TODO: Ask the WG if a the location has to resolve here as well!
-	    */
-	    res = XML_SCHEMAP_SRC_REDEFINE;
-	    xmlSchemaPCustomErr(pctxt, res,
-		NULL, NULL, node,
-		"Failed to load the document '%s' for redefinition",
-		schemaLocation);
-	}
-    }
+    }       
     return(res);
+
+exit_error:
+    return(pctxt->err);
 }
 
-#ifdef ENABLE_REDEFINE
 static int
 xmlSchemaParseRedefine(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema,
                        xmlNodePtr node)
 {
     int res;
-
-    res = xmlSchemaParseIncludeOrRedefine(pctxt, schema, node, 1);
+#ifndef ENABLE_REDEFINE
+    TODO
+    return(0);
+#endif
+    res = xmlSchemaParseIncludeOrRedefine(pctxt, schema, node,
+	XML_SCHEMA_SCHEMA_REDEFINE);
     if (res != 0)
 	return(res);
     return(0);
 }
-#endif
 
 static int
 xmlSchemaParseInclude(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema,
@@ -9957,7 +10277,8 @@
 {
     int res;
 
-    res = xmlSchemaParseIncludeOrRedefine(pctxt, schema, node, 0);
+    res = xmlSchemaParseIncludeOrRedefine(pctxt, schema, node,
+	XML_SCHEMA_SCHEMA_INCLUDE);
     if (res != 0)
 	return(res);
     return(0);
@@ -9986,7 +10307,6 @@
     xmlSchemaParticlePtr particle = NULL;
     xmlNodePtr child = NULL;
     xmlAttrPtr attr;
-    const xmlChar *oldcontainer, *container;
     int min = 0, max = 0;
 
     if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
@@ -9994,7 +10314,7 @@
     /*
     * Create a model group with the given compositor.
     */
-    item = xmlSchemaAddModelGroup(ctxt, schema, type, &container, node);
+    item = xmlSchemaAddModelGroup(ctxt, schema, type, node);
     if (item == NULL)
 	return (NULL);
 
@@ -10070,8 +10390,6 @@
         item->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
         child = child->next;
     }
-    oldcontainer = ctxt->container;
-    ctxt->container = container;
     if (type == XML_SCHEMA_TYPE_ALL) {
 	xmlSchemaParticlePtr part, last = NULL;
 
@@ -10144,7 +10462,6 @@
 		"(annotation?, (element | group | choice | sequence | any)*)");
 	}
     }
-    ctxt->container = oldcontainer;
     if (withParticle) {
 	if ((min == 0) && (max == 0))
 	    return (NULL);
@@ -10171,8 +10488,6 @@
 {
     xmlSchemaTypePtr type;
     xmlNodePtr child = NULL;
-    char buf[30];
-    const xmlChar *oldcontainer, *container;
     xmlAttrPtr attr;
 
     if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
@@ -10182,12 +10497,6 @@
     type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
 
     /*
-    * TODO: Is the container needed at all? the anonymous
-    * items inside should generate unique names already.
-    */
-    snprintf(buf, 29, "#restr%d", ctxt->counter++ + 1);
-    container = xmlDictLookup(ctxt->dict, BAD_CAST buf, -1);
-    /*
     * Check for illegal attributes.
     */
     attr = node->properties;
@@ -10272,8 +10581,6 @@
 	    xmlSchemaParseAnnotation(ctxt, schema, child));
         child = child->next;
     }
-    oldcontainer = ctxt->container;
-    ctxt->container = container;
     if (parentType == XML_SCHEMA_TYPE_SIMPLE) {
 	/*
 	* Corresponds to <simpleType><restriction><simpleType>.
@@ -10457,7 +10764,6 @@
 		"pattern)*))");
 	}
     }
-    ctxt->container = oldcontainer;
     return (NULL);
 }
 
@@ -10479,8 +10785,6 @@
 {
     xmlSchemaTypePtr type;
     xmlNodePtr child = NULL;
-    char buf[30];
-    const xmlChar *oldcontainer, *container;
     xmlAttrPtr attr;
 
     if ((ctxt == NULL) || (schema == NULL) || (node == NULL))
@@ -10489,8 +10793,6 @@
     type = ctxt->ctxtType;
     type->flags |= XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION;
 
-    snprintf(buf, 29, "#ext%d", ctxt->counter++ + 1);
-    container = xmlDictLookup(ctxt->dict, BAD_CAST buf, -1);
     /*
     * Check for illegal attributes.
     */
@@ -10535,8 +10837,6 @@
 	    xmlSchemaParseAnnotation(ctxt, schema, child));
         child = child->next;
     }
-    oldcontainer = ctxt->container;
-    ctxt->container = container;
     if (parentType == XML_SCHEMA_TYPE_COMPLEX_CONTENT) {
 	/*
 	* Corresponds to <complexType><complexContent><extension>... and:
@@ -10595,7 +10895,6 @@
 		"anyAttribute?))");
 	}
     }
-    ctxt->container = oldcontainer;
     return (NULL);
 }
 
@@ -10805,10 +11104,12 @@
 {
     xmlSchemaTypePtr type, ctxtType;
     xmlNodePtr child = NULL;
-    const xmlChar *oldcontainer, *name = NULL;
+    const xmlChar *name = NULL;
     xmlAttrPtr attr;
     const xmlChar *attrValue;
+#ifdef ENABLE_NAMED_LOCALS
     char buf[40];
+#endif
     int final = 0, block = 0, hasRestrictionOrExtension = 0;
 
 
@@ -10834,9 +11135,14 @@
 	/*
 	* Parse as local complex type definition.
 	*/
+#ifdef ENABLE_NAMED_LOCALS
         snprintf(buf, 39, "#CT%d", ctxt->counter++ + 1);
-	type = xmlSchemaAddType(ctxt, schema, (const xmlChar *)buf, NULL,
-	    node, 0);
+	type = xmlSchemaAddType(ctxt, schema, (const xmlChar *)buf,
+	    ctxt->targetNamespace, node, 0);
+#else
+	type = xmlSchemaAddType(ctxt, schema, NULL,
+	    ctxt->targetNamespace, node, 0);
+#endif
 	if (type == NULL)
 	    return (NULL);
 	name = type->name;
@@ -10849,7 +11155,7 @@
 	/*
 	* Parse as global complex type definition.
 	*/
-	type = xmlSchemaAddType(ctxt, schema, name, schema->targetNamespace,
+	type = xmlSchemaAddType(ctxt, schema, name, ctxt->targetNamespace,
 	    node, 1);
 	if (type == NULL)
 	    return (NULL);
@@ -10857,7 +11163,7 @@
 	type->type = XML_SCHEMA_TYPE_COMPLEX;
 	type->flags |= XML_SCHEMAS_TYPE_GLOBAL;
     }
-    type->targetNamespace = schema->targetNamespace;
+    type->targetNamespace = ctxt->targetNamespace;
     /*
     * Handle attributes.
     */
@@ -10966,8 +11272,6 @@
     /*
     * And now for the children...
     */
-    oldcontainer = ctxt->container;
-    ctxt->container = name;
     child = node->children;
     if (IS_SCHEMA(child, "annotation")) {
         type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
@@ -11058,134 +11362,10 @@
 	    "<complexType> must have a <restriction> or <extension> "
 	    "grand-child", NULL);
     }
-    ctxt->container = oldcontainer;
     ctxt->ctxtType = ctxtType;
     return (type);
 }
 
-/**
- * xmlSchemaParseSchema:
- * @ctxt:  a schema validation context
- * @node:  a subtree containing XML Schema informations
- *
- * parse a XML schema definition from a node set
- * *WARNING* this interface is highly subject to change
- *
- * Returns the internal XML Schema structure built from the resource or
- *         NULL in case of error
- */
-static xmlSchemaPtr
-xmlSchemaParseSchema(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node)
-{
-    xmlSchemaPtr schema = NULL;
-    const xmlChar *val;
-    int nberrors;
-    xmlAttrPtr attr;
-
-    /*
-    * This one is called by xmlSchemaParse only and is used if
-    * the schema to be parsed was specified via the API; i.e. not
-    * automatically by the validated instance document.
-    */
-    if ((ctxt == NULL) || (node == NULL))
-        return (NULL);
-    nberrors = ctxt->nberrors;
-    ctxt->nberrors = 0;
-    ctxt->isS4S = 0;
-    if (IS_SCHEMA(node, "schema")) {
-	xmlSchemaImportPtr import;
-#ifdef ENABLE_REDEFINE
-	xmlSchemaSchemaRefPtr ref;
-#endif
-
-        schema = xmlSchemaNewSchema(ctxt);
-        if (schema == NULL)
-            return (NULL);
-	attr = xmlSchemaGetPropNode(node, "targetNamespace");
-	if (attr != NULL) {
-	    xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr,
-		xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), &val);
-	    /*
-	    * TODO: Should we proceed with an invalid target namespace?
-	    */
-	    schema->targetNamespace = xmlDictLookup(ctxt->dict, val, -1);
-	    if (xmlStrEqual(schema->targetNamespace, xmlSchemaNs)) {
-		/*
-		* We are parsing the schema for schema!
-		*/
-		ctxt->isS4S = 1;
-	    }
-	} else {
-	    schema->targetNamespace = NULL;
-	}
-	/*
-	* Add the current ns name and location to the import table;
-	* this is needed to have a consistent mechanism, regardless
-	* if all schemata are constructed dynamically fired by the
-	* instance or if the schema to be used was specified via
-	* the API.
-	* TODO
-	*/
-#ifdef ENABLE_REDEFINE
-	ref = xmlSchemaSchemaRefCreate();
-	if (ref == NULL) {	    
-	    xmlSchemaFree(schema);
-	    schema = NULL;
-	    return NULL;
-	}
-	ref->schema = schema;
-#endif
-
-	import = xmlSchemaAddImport(ctxt, &(schema->schemasImports),
-	    schema->targetNamespace);
-	if (import == NULL) {
-	    xmlSchemaPInternalErr(ctxt, "xmlSchemaParseSchema",
-		"failed to add an import entry", NULL, NULL);		
-	    xmlSchemaFree(schema);
-	    schema = NULL;
-	    return (NULL);
-	}
-	import->schemaLocation = ctxt->URL;
-	/*
-	* NOTE: We won't set the doc here, otherwise it will be freed
-	* if the import struct is freed.
-	* import->doc = ctxt->doc;
-	*/
-	xmlSchemaParseSchemaDefaults(ctxt, schema, node);
-        xmlSchemaParseSchemaTopLevel(ctxt, schema, node->children);
-    } else {
-        xmlDocPtr doc;
-
-	doc = node->doc;
-
-        if ((doc != NULL) && (doc->URL != NULL)) {
-	    xmlSchemaPErr(ctxt, (xmlNodePtr) doc,
-		      XML_SCHEMAP_NOT_SCHEMA,
-		      "The file \"%s\" is not a XML schema.\n", doc->URL, NULL);
-	} else {
-	    xmlSchemaPErr(ctxt, (xmlNodePtr) doc,
-		      XML_SCHEMAP_NOT_SCHEMA,
-		      "The file is not a XML schema.\n", NULL, NULL);
-	}
-	return(NULL);
-    }
-    if (ctxt->nberrors != 0) {
-        if (schema != NULL) {
-            xmlSchemaFree(schema);
-            schema = NULL;
-        }
-    }
-    if (schema != NULL)
-	schema->counter = ctxt->counter;
-    ctxt->nberrors = nberrors;
-#ifdef DEBUG
-    if (schema == NULL)
-        xmlGenericError(xmlGenericErrorContext,
-                        "xmlSchemaParse() failed\n");
-#endif
-    return (schema);
-}
-
 /************************************************************************
  * 									*
  * 			Validating using Schemas			*
@@ -11270,7 +11450,6 @@
 	return(NULL);
     ret->dict = xmlDictCreate();
     ret->URL = xmlDictLookup(ret->dict, (const xmlChar *) URL, -1);
-    ret->includes = 0;
     return (ret);
 }
 
@@ -11339,20 +11518,15 @@
     if (ctxt == NULL)
         return;
     if (ctxt->doc != NULL && !ctxt->preserve)
-        xmlFreeDoc(ctxt->doc);
-    if (ctxt->assemble != NULL) {
-	xmlFree((xmlSchemaTypePtr *) ctxt->assemble->items);
-	xmlFree(ctxt->assemble);
-    }
+        xmlFreeDoc(ctxt->doc);    
     if (ctxt->vctxt != NULL) {
 	xmlSchemaFreeValidCtxt(ctxt->vctxt);
     }
-    if (ctxt->localImports != NULL)
-	xmlFree((xmlChar *) ctxt->localImports);
-    if (ctxt->substGroups != NULL)
-	xmlHashFree(ctxt->substGroups,
-	    (xmlHashDeallocator) xmlSchemaFreeSubstGroup);
-    xmlSchemaContainerFree(ctxt->compContainer);    
+    if (ctxt->ownsConstructor && (ctxt->constructor != NULL)) {
+	xmlSchemaConstructionCtxtFree(ctxt->constructor);
+	ctxt->constructor = NULL;
+	ctxt->ownsConstructor = 0;
+    }
     xmlDictFree(ctxt->dict);
     xmlFree(ctxt);
 }
@@ -11379,7 +11553,7 @@
     start = pctxt->state;
     if (end == NULL)
 	end = xmlAutomataNewState(pctxt->am);
-    substGroup = xmlSchemaGetElementSubstitutionGroup(pctxt, elemDecl);
+    substGroup = xmlSchemaSubstGroupGet(pctxt, elemDecl);
     if (substGroup == NULL) {
 	xmlSchemaPErr(pctxt, GET_NODE(particle),
 	    XML_SCHEMAP_INTERNAL,
@@ -11390,7 +11564,10 @@
     }
     if (counter >= 0) {
 	/*
-	* NOTE that we put the declaration in, even if it's abstract,
+	* NOTE that we put the declaration in, even if it's abstract.
+	* However, an error will be raised during *validation* if an element
+	* information item shall be validated against an abstract element
+	* declaration.
 	*/
 	tmp = xmlAutomataNewCountedTrans(pctxt->am, start, NULL, counter);
         xmlAutomataNewTransition2(pctxt->am, tmp, end,
@@ -11515,8 +11692,7 @@
  */
 static void
 xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
-			    xmlSchemaParticlePtr particle,
-                            const xmlChar * name)
+			    xmlSchemaParticlePtr particle)
 {
     if (particle == NULL) {
 	PERROR_INT("xmlSchemaBuildAContentModel", "particle is NULL");	    
@@ -11629,7 +11805,7 @@
                     sub = particle->children->children;
                     while (sub != NULL) {
                         xmlSchemaBuildAContentModel(pctxt,
-			    (xmlSchemaParticlePtr) sub, name);
+			    (xmlSchemaParticlePtr) sub);
                         sub = sub->next;
                     }
                 } else {
@@ -11650,7 +11826,7 @@
                             sub = particle->children->children;
                             while (sub != NULL) {
                                 xmlSchemaBuildAContentModel(pctxt,
-				    (xmlSchemaParticlePtr) sub, name);
+				    (xmlSchemaParticlePtr) sub);
                                 sub = sub->next;
                             }
                             tmp = pctxt->state;
@@ -11668,7 +11844,7 @@
 			    sub = particle->children->children;
                             while (sub != NULL) {
                                 xmlSchemaBuildAContentModel(pctxt,
-				    (xmlSchemaParticlePtr) sub, name);
+				    (xmlSchemaParticlePtr) sub);
                                 sub = sub->next;
                             }
                             xmlAutomataNewEpsilon(pctxt->am, pctxt->state,
@@ -11701,7 +11877,7 @@
                         sub = particle->children->children;
                         while (sub != NULL) {
                             xmlSchemaBuildAContentModel(pctxt,
-				(xmlSchemaParticlePtr) sub, name);
+				(xmlSchemaParticlePtr) sub);
                             sub = sub->next;
                         }
                         tmp = pctxt->state;
@@ -11718,7 +11894,7 @@
                         sub = particle->children->children;
                         while (sub != NULL) {
                             xmlSchemaBuildAContentModel(pctxt,
-				(xmlSchemaParticlePtr) sub, name);
+				(xmlSchemaParticlePtr) sub);
                             sub = sub->next;
                         }
                         if (particle->minOccurs == 0) {
@@ -11745,7 +11921,7 @@
                     while (sub != NULL) {
                         pctxt->state = start;
                         xmlSchemaBuildAContentModel(pctxt,
-			    (xmlSchemaParticlePtr) sub, name);
+			    (xmlSchemaParticlePtr) sub);
                         xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end);
                         sub = sub->next;
                     }
@@ -11770,7 +11946,7 @@
                     while (sub != NULL) {
                         pctxt->state = base;
                         xmlSchemaBuildAContentModel(pctxt,
-			    (xmlSchemaParticlePtr) sub, name);
+			    (xmlSchemaParticlePtr) sub);
                         xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop);
                         sub = sub->next;
                     }
@@ -11853,15 +12029,15 @@
 	    * If we hit a model group definition, then this means that
 	    * it was empty, thus was not substituted for the containing
 	    * model group. Just do nothing in this case.
+	    * TODO: But the group should be substituted and not occur at
+	    * all in the content model at this point. Fix this.
 	    */
 	    break;
         default:
-	    xmlSchemaPInternalErr(pctxt, "xmlSchemaBuildAContentModel",
-		"found unexpected term of type '%s' in content model of complex "
-		"type '%s'",
-		xmlSchemaCompTypeToString(particle->children->type), name);
-	    xmlGenericError(xmlGenericErrorContext,
-                    "Unexpected type: %d\n", particle->children->type);
+	    xmlSchemaInternalErr2(ACTXT_CAST pctxt,
+		"xmlSchemaBuildAContentModel",
+		"found unexpected term of type '%s' in content model",
+		xmlSchemaCompTypeToString(particle->children->type), NULL);
             return;
     }
 }
@@ -11876,8 +12052,7 @@
  */
 static void
 xmlSchemaBuildContentModel(xmlSchemaTypePtr type,
-			   xmlSchemaParserCtxtPtr ctxt,
-                           const xmlChar * name)
+			   xmlSchemaParserCtxtPtr ctxt)
 {
     xmlAutomataStatePtr start;
 
@@ -11895,11 +12070,11 @@
     ctxt->am = xmlNewAutomata();
     if (ctxt->am == NULL) {
         xmlGenericError(xmlGenericErrorContext,
-	    "Cannot create automata for complex type %s\n", name);
+	    "Cannot create automata for complex type %s\n", type->name);
         return;
     }
     start = ctxt->state = xmlAutomataGetInitState(ctxt->am);
-    xmlSchemaBuildAContentModel(ctxt, (xmlSchemaParticlePtr) type->subtypes, name);
+    xmlSchemaBuildAContentModel(ctxt, (xmlSchemaParticlePtr) type->subtypes);
     xmlAutomataSetFinalState(ctxt->am, ctxt->state);
     type->contModel = xmlAutomataCompile(ctxt->am);
     if (type->contModel == NULL) {
@@ -11926,7 +12101,7 @@
 }
 
 /**
- * xmlSchemaElementFixup:
+ * xmlSchemaResolveElementReferences:
  * @elem:  the schema element context
  * @ctxt:  the schema parser context
  *
@@ -11935,11 +12110,8 @@
  * term.
  */
 static void
-xmlSchemaElementFixup(xmlSchemaElementPtr elemDecl,
-                          xmlSchemaParserCtxtPtr ctxt,
-                          const xmlChar * name ATTRIBUTE_UNUSED,
-                          const xmlChar * context ATTRIBUTE_UNUSED,
-                          const xmlChar * namespace ATTRIBUTE_UNUSED)
+xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl,
+				  xmlSchemaParserCtxtPtr ctxt)
 {
     if ((ctxt == NULL) || (elemDecl == NULL) ||
 	((elemDecl != NULL) &&
@@ -11980,22 +12152,28 @@
 		"substitutionGroup", elemDecl->substGroup,
 		elemDecl->substGroupNs, XML_SCHEMA_TYPE_ELEMENT, NULL);
 	} else {
-	    xmlSchemaElementFixup(substHead, ctxt, NULL, NULL, NULL);
+	    xmlSchemaResolveElementReferences(substHead, ctxt);
 	    /*
 	    * Set the "substitution group affiliation".
 	    * NOTE that now we use the "refDecl" field for this.
 	    */
-	    elemDecl->refDecl = substHead;
+	    SUBST_GROUP_AFF(elemDecl) = substHead;
 	    /*
-	    * (type definition)...otherwise the {type definition} of the
-	    * element declaration ·resolved· to by the ·actual value· of
-	    * the substitutionGroup [attribute], if present
+	    * The type definitions is set to:
+	    * SPEC "...the {type definition} of the element
+	    * declaration ·resolved· to by the ·actual value·
+	    * of the substitutionGroup [attribute], if present"
 	    */
 	    if (elemDecl->subtypes == NULL)
 		elemDecl->subtypes = substHead->subtypes;
 	}
     }
-    if ((elemDecl->subtypes == NULL) && (elemDecl->namedType == NULL) &&
+    /*
+    * SPEC "The definition of anyType serves as the default type definition
+    * for element declarations whose XML representation does not specify one."
+    */
+    if ((elemDecl->subtypes == NULL) &&
+	(elemDecl->namedType == NULL) &&
 	(elemDecl->substGroup == NULL))
 	elemDecl->subtypes = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE);
 }
@@ -12215,9 +12393,11 @@
  */
 static int
 xmlSchemaBuildAttributeUsesOwned(xmlSchemaParserCtxtPtr ctxt,
+				 int isRestriction,
 				 xmlSchemaAttributePtr cur,
 				 xmlSchemaAttributeLinkPtr *uses,
-				 xmlSchemaAttributeLinkPtr *lastUse)
+				 xmlSchemaAttributeLinkPtr *lastUse,
+				 int *hasProhibitions)
 {
     xmlSchemaAttributeLinkPtr tmp;
     while (cur != NULL) {
@@ -12227,11 +12407,21 @@
 	     * to by the ·actual value·s of the ref [attribute] of the
 	     * <attributeGroup> [children], if any."
 	     */
-	    if (xmlSchemaBuildAttributeUsesOwned(ctxt,
+	    if (xmlSchemaBuildAttributeUsesOwned(ctxt, isRestriction,
 		((xmlSchemaAttributeGroupPtr) cur)->attributes, uses,
-		lastUse) == -1) {
+		lastUse, hasProhibitions) == -1) {
 		return (-1);
 	    }
+	} else if ((! isRestriction) &&
+		(cur->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED)) {
+	    /*
+	    * Warn about pointless prohibitions when extending.
+	    */
+	    xmlSchemaCustomWarning(ACTXT_CAST ctxt,
+		XML_SCHEMAP_WARN_ATTR_REDECL_PROH,
+		cur->node, NULL,
+		"Attribute use prohibitions are pointless when "
+		"extending a type", NULL, NULL, NULL);
 	} else {
 	    /* W3C: "1 The set of attribute uses corresponding to the
 	     * <attribute> [children], if any."
@@ -12249,6 +12439,8 @@
 	    else
 		(*lastUse)->next = tmp;
 	    *lastUse = tmp;
+	    if (cur->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED)
+		(*hasProhibitions)++;
 	}
 	cur = cur->next;
     }
@@ -12969,11 +13161,11 @@
 {
     xmlSchemaTypePtr baseType = NULL;
     xmlSchemaAttributeLinkPtr cur, base, tmp, id = NULL,
-	prev = NULL, uses = NULL, lastUse = NULL, lastBaseUse = NULL;
+	prev = NULL, localUses = NULL, lastUse = NULL, lastBaseUse = NULL;
     xmlSchemaAttributePtr attrs;
     xmlSchemaTypePtr anyType;
     xmlChar *str = NULL;
-    int err = 0;
+    int err = 0, hasProhibitions = 0;
 
     anyType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE);
     /*
@@ -12995,49 +13187,254 @@
     }
     baseType = type->baseType;
     /*
-     * Inherit the attribute uses of the base type.
-     */
-    /*
-     * NOTE: It is allowed to "extend" the anyType complex type.
-     */
-    if (! IS_ANYTYPE(baseType)) {
-	if (baseType != NULL) {
-	    for (cur = baseType->attributeUses; cur != NULL;
-		cur = cur->next) {
-		tmp = (xmlSchemaAttributeLinkPtr)
-		    xmlMalloc(sizeof(xmlSchemaAttributeLink));
-		if (tmp == NULL) {
-		    xmlSchemaPErrMemory(pctxt,
-			"building attribute uses of complexType", NULL);
-		    return (-1);
+    * Gather attribute uses defined by this type.
+    */
+    attrs = type->attributes;
+    if (attrs != NULL) {
+	if (xmlSchemaBuildAttributeUsesOwned(pctxt, 
+	    WXS_IS_RESTRICTION(type) ? 1 : 0,
+	    attrs,
+	    &localUses, &lastUse, &hasProhibitions) == -1) {
+	    return (-1);
+	}
+	/*
+	* Handle attribute wildcards.
+	*/
+	err = xmlSchemaBuildCompleteAttributeWildcard(pctxt,
+	    attrs, &type->attributeWildcard);
+	/*
+	* NOTE: During the parse time, the wildcard is created
+	* on the complexType directly, if encountered in a
+	* <restriction> or <extension> element.
+	*/
+	if (err == -1) {
+	    PERROR_INT("xmlSchemaBuildAttributeValidation",
+		"failed to build an intersected attribute wildcard");
+	    return (-1);
+	}
+    }
+    
+    if (hasProhibitions) {
+	xmlSchemaAttributeLinkPtr tmpPrev = NULL;
+	/*
+	* Handle annoying pointless prohibitions.
+        * Note that this will be done for restrictions only, since
+	* prohibitions are not gathered for extensions.
+	*/	
+	cur = localUses;
+
+pointless_prohib_next:    
+	while (cur != NULL) {
+	    tmp = cur->next;
+	    tmpPrev = cur;
+	    while (tmp != NULL) {
+		if ( ((cur->attr->occurs != XML_SCHEMAS_ATTR_USE_PROHIBITED) &&
+		      (tmp->attr->occurs != XML_SCHEMAS_ATTR_USE_PROHIBITED)) ||
+		    (xmlSchemaGetAttrName(cur->attr) !=
+			xmlSchemaGetAttrName(tmp->attr)) ||
+		    (xmlSchemaGetAttrTargetNsURI(cur->attr) !=
+			xmlSchemaGetAttrTargetNsURI(tmp->attr)))
+		{
+		    tmpPrev = tmp;
+		    tmp = tmp->next;
+		    continue;
 		}
-		tmp->attr = cur->attr;
-		tmp->next = NULL;
-		if (type->attributeUses == NULL) {
-		    type->attributeUses = tmp;
-		} else
-		    lastBaseUse->next = tmp;
-		lastBaseUse = tmp;
+		if (cur->attr->occurs == tmp->attr->occurs) {
+		    xmlSchemaAttributeLinkPtr tmpFree;
+		    /*
+		    * Warn about duplicate prohibitions.
+		    */
+		    xmlSchemaCustomWarning(ACTXT_CAST pctxt,
+			XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH,
+			tmp->attr->node, NULL,
+			"Skipping duplicate prohibition "
+			"of attribute use '%s'",
+			xmlSchemaFormatQName(&str,
+			    xmlSchemaGetAttrTargetNsURI(tmp->attr),
+			    xmlSchemaGetAttrName(tmp->attr)),
+			NULL, NULL);
+		    FREE_AND_NULL(str)
+		    /*
+		    * Remove the duplicate prohibition.
+		    */
+		    tmpFree = tmp;
+		    tmpPrev->next = tmp->next;
+		    tmp = tmp->next;
+		    xmlFree(tmpFree);
+		    hasProhibitions--;
+		    continue;
+		} else {
+		    xmlSchemaAttributeLinkPtr tmpFree;
+		    xmlSchemaAttributePtr reattr;
+		    /*
+		    * Annoying case:
+		    * This is the case when we prohibited
+		    * the base attribute decl in the previous
+		    * step; i.e. when we prohibit and declare the
+		    * same attribute in the same <complexType>.
+		    */
+		    if (cur->attr->occurs ==
+			XML_SCHEMAS_ATTR_USE_PROHIBITED)
+			reattr = cur->attr;
+		    else
+			reattr = tmp->attr;
+		    xmlSchemaCustomWarning(ACTXT_CAST pctxt,
+			XML_SCHEMAP_WARN_ATTR_REDECL_PROH,
+			reattr->node, NULL,
+			"Skipping pointless prohibition of "
+			"attribute use '%s', since a corresponding "
+			"attribute was explicitely declared as well",
+			xmlSchemaFormatQName(&str,
+			    xmlSchemaGetAttrTargetNsURI(reattr),
+			    xmlSchemaGetAttrName(reattr)),
+			NULL, NULL);
+		    FREE_AND_NULL(str);
+		    /*
+		    * Remove the prohibition.
+		    */
+		    if (reattr == cur->attr) {
+			tmpFree = cur;
+			if (prev != NULL)
+			    prev->next = cur->next;
+			else
+			    localUses = cur->next;
+			cur = cur->next;
+			xmlFree(tmpFree);
+			hasProhibitions--;
+			goto pointless_prohib_next;
+		    } else {
+			tmpFree = tmp;
+			tmpPrev->next = tmp->next;
+			tmp = tmp->next;
+			xmlFree(tmpFree);
+			hasProhibitions--;
+			continue;
+		    }
+		}
+		tmpPrev = tmp;
+		tmp = tmp->next;
 	    }
+	    prev = cur;
+	    cur = cur->next;
 	}
     }
-    attrs = type->attributes;    
-    /*
-    * Handle attribute wildcards.
+
+    /* 3.4.6 -> Complex Type Definition Properties Correct 4.
+    * "Two distinct attribute declarations in the {attribute uses} must
+    * not have identical {name}s and {target namespace}s."
+    *
+    * This is done here for <restriction>s. We will compare only the
+    * attr uses of the current type.
+    * For <extension>s this is done further down.
     */
-    err = xmlSchemaBuildCompleteAttributeWildcard(pctxt,
-	attrs, &type->attributeWildcard);
-    /*
-    * NOTE: During the parse time, the wildcard is created on the complexType
-    * directly, if encountered in a <restriction> or <extension> element.
-    */
-    if (err == -1) {
-	PERROR_INT("xmlSchemaBuildAttributeValidation",
-	    "failed to build an intersected attribute wildcard");
-	return (-1);
+    if ((localUses != NULL) && (localUses->next != NULL) &&
+	(WXS_IS_RESTRICTION(type))) {	
+	cur = localUses;
+	while (cur != NULL) {
+	    if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) {
+		cur = cur->next;
+		continue;
+	    }
+	    tmp = cur->next;
+	    while (tmp != NULL) {
+		if (tmp->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) {
+		    tmp = tmp->next;
+		    continue;
+		}
+		if ((xmlStrEqual(xmlSchemaGetAttrName(cur->attr),
+			xmlSchemaGetAttrName(tmp->attr))) &&
+		    (xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr),
+			xmlSchemaGetAttrTargetNsURI(tmp->attr)))) {
+		    /*
+		    * Duplicate attr uses.
+		    */
+		    xmlSchemaPAttrUseErr(pctxt,
+			XML_SCHEMAP_CT_PROPS_CORRECT_4,
+			type, cur->attr,
+			"Duplicate attribute use '%s' specified",
+			xmlSchemaFormatQName(&str,
+			xmlSchemaGetAttrTargetNsURI(tmp->attr),
+			xmlSchemaGetAttrName(tmp->attr)));
+		    FREE_AND_NULL(str)
+		    break;
+		}
+		tmp = tmp->next;
+	    }
+	    cur = cur->next;
+	}
     }
 
-    if ((type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) &&
+    /*
+    * Inherit the attribute uses of the base type, but leave out
+    * prohibited ones.
+    * NOTE: It is allowed to "extend" the anyType complex type.
+    */    
+    if (baseType->attributeUses != NULL) {	
+	base = baseType->attributeUses;
+inherit_start:
+	while (base != NULL) {		
+	    /*
+	    * Check if prohibited.
+	    */
+	    if (hasProhibitions) {
+		cur = localUses;
+		while (cur != NULL) {
+		    if ((cur->attr->occurs ==
+			    XML_SCHEMAS_ATTR_USE_PROHIBITED) &&
+			xmlStrEqual(xmlSchemaGetAttrName(cur->attr),
+			    xmlSchemaGetAttrName(base->attr)) &&
+			xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr),
+			    xmlSchemaGetAttrTargetNsURI(base->attr)))			
+		    {
+			/*
+			* Don't inherit prohibited attr uses.
+			*/
+			if (base->attr->occurs ==
+			    XML_SCHEMAS_ATTR_USE_REQUIRED) {
+			    /*
+			    * derivation-ok-restriction 3
+			    * There won't be an attr use left if
+			    * prohibiting the inherited one, so this
+			    * will automatically violate required
+			    * attr uses.
+			    */
+			    xmlSchemaPCustomErr(pctxt,
+				XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3,
+				NULL, type, NULL,
+				"A matching attribute use for the "
+				"'required' attribute use '%s' of the "
+				"base type is missing",
+				xmlSchemaFormatQName(&str,
+				xmlSchemaGetAttrTargetNsURI(base->attr),
+				xmlSchemaGetAttrName(base->attr)));
+			    FREE_AND_NULL(str)				
+			}
+			base = base->next;
+			goto inherit_start;
+		    }
+		    cur = cur->next;
+		}		
+	    }	   
+	    tmp = (xmlSchemaAttributeLinkPtr)
+		xmlMalloc(sizeof(xmlSchemaAttributeLink));
+	    if (tmp == NULL) {
+		xmlSchemaPErrMemory(pctxt,
+		    "allocating attribute uses", NULL);
+		return (-1);
+	    }
+	    tmp->attr = base->attr;
+	    tmp->next = NULL;
+	    if (type->attributeUses == NULL) {
+		type->attributeUses = tmp;
+	    } else
+		lastBaseUse->next = tmp;
+	    lastBaseUse = tmp;
+	    /* next */
+	    base = base->next;
+	}
+    }    
+
+    if ((WXS_IS_EXTENSION(type)) &&
 	((IS_ANYTYPE(baseType)) ||
 	 ((baseType != NULL) &&
 	  (baseType->type == XML_SCHEMA_TYPE_COMPLEX) &&
@@ -13061,7 +13458,7 @@
 	}
     }
 
-    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) {
+    if (WXS_IS_RESTRICTION(type)) {
 	if (type->attributeWildcard != NULL) {
 	    /*
 	    * Derivation Valid (Restriction, Complex)
@@ -13108,7 +13505,7 @@
 		return (1);
 	    }
 	}
-    } else if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) {
+    } else if (WXS_IS_EXTENSION(type)) {
 	/*
 	* Derivation Valid (Extension)
 	* At this point the type and the base have both, either
@@ -13130,80 +13527,40 @@
 	    }
 	}
     }
-
-    /*
-     * Gather attribute uses defined by this type.
-     */
-    if (attrs != NULL) {
-	if (xmlSchemaBuildAttributeUsesOwned(pctxt, attrs,
-	    &uses, &lastUse) == -1) {
-	    return (-1);
-	}
-    }
-    /* 3.4.6 -> Complex Type Definition Properties Correct 4.
-     * "Two distinct attribute declarations in the {attribute uses} must
-     * not have identical {name}s and {target namespace}s."
-     *
-     * For "extension" this is done further down.
-     */
-    if ((uses != NULL) && ((type->flags &
-	    XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) == 0)) {
-	cur = uses;
-	while (cur != NULL) {
-	    tmp = cur->next;
-	    while (tmp != NULL) {
-		if ((xmlStrEqual(xmlSchemaGetAttrName(cur->attr),
-		    xmlSchemaGetAttrName(tmp->attr))) &&
-		    (xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr),
-		    xmlSchemaGetAttrTargetNsURI(tmp->attr)))) {
-
-		    xmlSchemaPAttrUseErr(pctxt,
-			XML_SCHEMAP_CT_PROPS_CORRECT_4,
-			type, cur->attr,
-			"Duplicate attribute use %s specified",
-			xmlSchemaFormatQName(&str,
-			    xmlSchemaGetAttrTargetNsURI(tmp->attr),
-			    xmlSchemaGetAttrName(tmp->attr)));
-		    FREE_AND_NULL(str)
-		    break;
-		}
-		tmp = tmp->next;
-	    }
-	    cur = cur->next;
-	}
-    }
-    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) {
+    
+    if (localUses == NULL) {
+	/* PASS */
+    } else if (WXS_IS_RESTRICTION(type)) {
 	/*
-	 * Derive by restriction.
+	 * Derive by restriction. At this point prohibited uses are already
+	 * filtered out.
 	 */
 	if (IS_ANYTYPE(baseType)) {
-	    type->attributeUses = uses;
+	    type->attributeUses = localUses;
 	} else {
 	    int found, valid;
 	    const xmlChar *bEffValue;
 	    int effFixed;
 
-	    cur = uses;
+	    cur = localUses;
 	    while (cur != NULL) {
+		if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) {
+		    prev = cur;
+		    cur = cur->next;
+		    continue;
+		}
 		found = 0;
 		valid = 1;
 		base = type->attributeUses;
 		while (base != NULL) {
 		    if (xmlStrEqual(xmlSchemaGetAttrName(cur->attr),
-			xmlSchemaGetAttrName(base->attr)) &&
+			    xmlSchemaGetAttrName(base->attr)) &&
 			xmlStrEqual(xmlSchemaGetAttrTargetNsURI(cur->attr),
-			xmlSchemaGetAttrTargetNsURI(base->attr))) {
+			    xmlSchemaGetAttrTargetNsURI(base->attr))) {
 
 			found = 1;
 			
 			if ((cur->attr->occurs ==
-			    XML_SCHEMAS_ATTR_USE_PROHIBITED) &&
-			    (base->attr->occurs ==
-			    XML_SCHEMAS_ATTR_USE_OPTIONAL)) {
-			    /*
-			    * NOOP.
-			    */
-			} else if ((cur->attr->occurs ==
 			    XML_SCHEMAS_ATTR_USE_OPTIONAL) &&
 			    (base->attr->occurs ==
 			    XML_SCHEMAS_ATTR_USE_REQUIRED)) {
@@ -13216,23 +13573,6 @@
 				"The 'optional' use is inconsistent with a "
 				"matching 'required' use of the base type",
 				NULL);
-			} else if ((cur->attr->occurs ==
-			    XML_SCHEMAS_ATTR_USE_PROHIBITED) &&
-			    (base->attr->occurs ==
-			    XML_SCHEMAS_ATTR_USE_REQUIRED)) {
-			    /*
-			    * derivation-ok-restriction 3
-			    */
-			    xmlSchemaPCustomErr(pctxt,
-				XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3,
-				NULL, type, NULL,
-				"A matching attribute use for the 'required' "
-				"attribute use '%s' of the base type is "
-				"missing",
-				xmlSchemaFormatQName(&str,
-				xmlSchemaGetAttrTargetNsURI(base->attr),
-				xmlSchemaGetAttrName(base->attr)));
-			    FREE_AND_NULL(str)
 			} else if (xmlSchemaCheckCOSSTDerivedOK(
 			    cur->attr->subtypes, base->attr->subtypes, 0) != 0) {
 			    			    
@@ -13299,8 +13639,7 @@
 		    base = base->next;
 		}
 
-		if ((!found) && (cur->attr->occurs !=
-			XML_SCHEMAS_ATTR_USE_PROHIBITED)) {
+		if (!found) {
 		    /*
 		    * derivation-ok-restriction  2.2
 		    */
@@ -13326,7 +13665,7 @@
 			if (prev != NULL)
 			    prev->next = cur->next;
 			else
-			    uses = cur->next;
+			    localUses = cur->next;
 			cur = cur->next;
 			tmp->next = NULL;
 			if (type->attributeUses == NULL) {
@@ -13341,20 +13680,20 @@
 		prev = cur;
 		cur = cur->next;
 	    }
-	    if (uses != NULL)
-		xmlSchemaFreeAttributeUseList(uses);
+	    if (localUses != NULL)
+		xmlSchemaFreeAttributeUseList(localUses);
 	}
-    } else if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) {
+    } else if (WXS_IS_EXTENSION(type)) {
 	/*
 	 * The spec allows only appending, and not other kinds of extensions.
 	 *
 	 * This ensures: Schema Component Constraint: Derivation Valid (Extension) : 1.2
 	 */
-	if (uses != NULL) {
+	if (localUses != NULL) {
 	    if (type->attributeUses == NULL) {
-		type->attributeUses = uses;
+		type->attributeUses = localUses;
 	    } else
-		lastBaseUse->next = uses;
+		lastBaseUse->next = localUses;
 	}
     } else {
 	PERROR_INT("xmlSchemaBuildAttributeValidation",
@@ -13368,6 +13707,22 @@
 	cur = type->attributeUses;
 	prev = NULL;
 	while (cur != NULL) {
+	    if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) {
+		/*
+		* Remove "prohibited" attribute uses. The reason this is
+		* done at this late stage is to be able to catch
+		* dublicate attribute uses. So we had to keep prohibited
+		* uses in the list as well.
+		*/
+		tmp = cur;
+		if (prev == NULL)
+		    type->attributeUses = cur->next;
+		else
+		    prev->next = cur->next;
+		cur = cur->next;
+		xmlFree(tmp);
+		continue;
+	    }
 	    /*
 	    * 4. Two distinct attribute declarations in the {attribute uses} must
 	    * not have identical {name}s and {target namespace}s.
@@ -13375,7 +13730,7 @@
 	    * Note that this was already done for "restriction" and types derived from
 	    * the ur-type.
 	    */
-	    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) {
+	    if (WXS_IS_EXTENSION(type)) {
 		tmp = cur->next;
 		while (tmp != NULL) {
 		    if ((xmlStrEqual(xmlSchemaGetAttrName(cur->attr),
@@ -13391,42 +13746,29 @@
 		    }
 		    tmp = tmp->next;
 		}
-	    }
+	    }	    
+	    
 	    /*
-	    * 5. Two distinct attribute declarations in the {attribute uses} must
-	    * not have {type definition}s which are or are derived from ID.
+	    * 5. Two distinct attribute declarations in the
+	    * {attribute uses} must not have {type definition}s which
+	    * are or are derived from ID.
 	    */
 	    if ((cur->attr->subtypes != NULL) &&
 		(xmlSchemaIsDerivedFromBuiltInType(cur->attr->subtypes,
-		    XML_SCHEMAS_ID))) {
+		XML_SCHEMAS_ID))) {
 		if (id != NULL) {
 		    xmlSchemaPAttrUseErr(pctxt,
 			XML_SCHEMAP_CT_PROPS_CORRECT_5,
 			type, cur->attr,
-			"There must not exist more than one attribute use, "
-			"declared of type 'ID' or derived from it",
+			"There must not exist more than one attribute "
+			"use, declared of type 'ID' or derived from it",
 			NULL);
 		    FREE_AND_NULL(str)
 		}
 		id = cur;
-	    }
-	    /*
-	    * Remove "prohibited" attribute uses. The reason this is done at this late
-	    * stage is to be able to catch dublicate attribute uses. So we had to keep
-	    * prohibited uses in the list as well.
-	    */
-	    if (cur->attr->occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) {
-		tmp = cur;
-		if (prev == NULL)
-		    type->attributeUses = cur->next;
-		else
-		    prev->next = cur->next;
-		cur = cur->next;
-		xmlFree(tmp);
-	    } else {
-		prev = cur;
-		cur = cur->next;
-	    }
+	    }			    
+	    prev = cur;
+	    cur = cur->next;	    
 	}
     }
     /*
@@ -13760,8 +14102,7 @@
  */
 static void
 xmlSchemaCheckTypeDefCircular(xmlSchemaTypePtr item,
-			      xmlSchemaParserCtxtPtr ctxt,
-			      const xmlChar * name ATTRIBUTE_UNUSED)
+			      xmlSchemaParserCtxtPtr ctxt)
 {
     if ((item == NULL) ||
 	((item->type != XML_SCHEMA_TYPE_COMPLEX) &&
@@ -13777,16 +14118,78 @@
 	xmlSchemaCheckTypeDefCircularInternal(ctxt, item, item->baseType);
 }
 
+/*
+* Simple Type Definition Representation OK (src-simple-type) 4
+*
+* "4 Circular union type definition is disallowed. That is, if the
+* <union> alternative is chosen, there must not be any entries in the
+* memberTypes [attribute] at any depth which resolve to the component
+* corresponding to the <simpleType>."
+*
+* Note that this should work on the *representation* of a component,
+* thus assumes any union types in the member types not being yet
+* substituted. At this stage we need the variety of the types
+* to be already computed.
+*/
+static int
+xmlSchemaCheckUnionTypeDefCircularRecur(xmlSchemaParserCtxtPtr pctxt,
+					xmlSchemaTypePtr ctxType,
+					xmlSchemaTypeLinkPtr members)
+{    
+    xmlSchemaTypeLinkPtr member;
+    xmlSchemaTypePtr memberType;
+    
+    member = members;
+    while (member != NULL) {
+	memberType = member->type;
+	while ((memberType != NULL) &&
+	    (memberType->type != XML_SCHEMA_TYPE_BASIC)) {
+	    if (memberType == ctxType) {
+		xmlSchemaPCustomErr(pctxt,
+		    XML_SCHEMAP_SRC_SIMPLE_TYPE_4,
+		    NULL, ctxType, NULL,
+		    "The union type definition is circular", NULL);
+		return (XML_SCHEMAP_SRC_SIMPLE_TYPE_4);
+	    }
+	    if ((VARIETY_UNION(memberType)) &&
+		((memberType->flags & XML_SCHEMAS_TYPE_MARKED) == 0))
+	    {
+		int res;
+		memberType->flags |= XML_SCHEMAS_TYPE_MARKED;
+		res = xmlSchemaCheckUnionTypeDefCircularRecur(pctxt,
+		    ctxType,
+		    xmlSchemaGetUnionSimpleTypeMemberTypes(memberType));
+		memberType->flags ^= XML_SCHEMAS_TYPE_MARKED;
+		if (res != 0)
+		    return(res);
+	    }
+	    memberType = memberType->baseType;
+	}
+	member = member->next;
+    }
+    return(0);
+}
+
+static int
+xmlSchemaCheckUnionTypeDefCircular(xmlSchemaParserCtxtPtr pctxt,
+				   xmlSchemaTypePtr type)
+{
+    if (! VARIETY_UNION(type))
+	return(0);
+    return(xmlSchemaCheckUnionTypeDefCircularRecur(pctxt, type,
+	type->memberTypes));
+}
+
 /**
- * xmlSchemaResolveTypeDefs:
+ * xmlSchemaResolveTypeReferences:
  * @item:  the complex/simple type definition
  * @ctxt:  the parser context
  * @name:  the name
  *
- * Checks for circular type definitions.
+ * Resolvese type definition references
  */
 static void
-xmlSchemaResolveTypeDefs(xmlSchemaTypePtr typeDef,
+xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef,
 			 xmlSchemaParserCtxtPtr ctxt,
 			 const xmlChar * name ATTRIBUTE_UNUSED)
 {
@@ -13854,8 +14257,7 @@
 xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt,
 			     xmlSchemaTypePtr type)
 {
-    xmlSchemaTypePtr baseType = type->baseType, anySimpleType,
-	anyType;
+    xmlSchemaTypePtr baseType = type->baseType;
     xmlChar *str = NULL;
 
     /* STATE: error funcs converted. */
@@ -13865,8 +14267,6 @@
     * NOTE: This is somehow redundant, since we actually built a simple type
     * to have all the needed information; this acts as an self test.
     */
-    anySimpleType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
-    anyType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE);
     /* Base type: If the datatype has been ·derived· by ·restriction·
     * then the Simple Type Definition component from which it is ·derived·,
     * otherwise the Simple Type Definition for anySimpleType (§4.1.6).
@@ -13893,7 +14293,7 @@
 	return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
     }
     if ( (VARIETY_LIST(type) || VARIETY_UNION(type)) &&
-	 ((type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) == 0) &&
+	 (WXS_IS_RESTRICTION(type) == 0) &&
 	 (! IS_ANY_SIMPLE_TYPE(baseType))) {
 	xmlSchemaPCustomErr(ctxt,
 	    XML_SCHEMAP_ST_PROPS_CORRECT_1,
@@ -14046,7 +14446,7 @@
 	    return (-1);
 	}
 	if (IS_NOT_TYPEFIXED(itemType))
-	    xmlSchemaTypeFixup(itemType, pctxt, NULL);
+	    xmlSchemaTypeFixup(itemType, pctxt);
 	/*
 	* 2.1 The {item type definition} must have a {variety} of atomic or
 	* union (in which case all the {member type definitions}
@@ -14245,7 +14645,7 @@
 	member = type->memberTypes;
 	while (member != NULL) {
 	    if (IS_NOT_TYPEFIXED(member->type))
-		xmlSchemaTypeFixup(member->type, pctxt, NULL);
+		xmlSchemaTypeFixup(member->type, pctxt);
 
 	    if ((! VARIETY_ATOMIC(member->type)) &&
 		(! VARIETY_LIST(member->type))) {
@@ -14416,12 +14816,13 @@
  * @ctxt:  the schema parser context
  * @type:  the simple type definition
  *
- * Checks crc-simple-type constraints.
+ * Checks crc-simple-type constraints. 
  *
  * Returns 0 if the constraints are satisfied,
  * if not a positive error code and -1 on internal
  * errors.
  */
+#if 0
 static int
 xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt,
 			    xmlSchemaTypePtr type)
@@ -14430,82 +14831,32 @@
     * src-simple-type.1 The corresponding simple type definition, if any,
     * must satisfy the conditions set out in Constraints on Simple Type
     * Definition Schema Components (§3.14.6).
-    */
-    if ((xmlSchemaCheckSTPropsCorrect(ctxt, type) != 0) ||
-	(xmlSchemaCheckCOSSTRestricts(ctxt, type) != 0)) {
+    */    
+    if (WXS_IS_RESTRICTION(type)) {
 	/*
-	* TODO: Removed this, since it got annoying to get an
-	* extra error report, if anything failed until now.
-	* Enable this if needed.
-	*/
-	/*
-	xmlSchemaPErr(ctxt, type->node,
-	    XML_SCHEMAP_SRC_SIMPLE_TYPE_1,
-	    "Simple type '%s' does not satisfy the constraints "
-	    "on simple type definitions.\n",
-	    type->name, NULL);
-	*/
-	return (XML_SCHEMAP_SRC_SIMPLE_TYPE_1);
-    }
-
-    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) {
-	/*
-	* src-simple-type.2 If the <restriction> alternative is chosen,
+	* src-simple-type.2 "If the <restriction> alternative is chosen,
 	* either it must have a base [attribute] or a <simpleType> among its
-	* [children], but not both.
+	* [children], but not both."
+	* NOTE: This is checked in the parse function of <restriction>.
 	*/
 	/*
-	* XML_SCHEMAP_SRC_SIMPLE_TYPE_2
-	* NOTE: This is checked in the parse function of <restriction>.
+	* 
 	*/
     } else if (VARIETY_LIST(type)) {
-	/* src-simple-type.3 If the <list> alternative is chosen, either it must have
+	/* src-simple-type.3 "If the <list> alternative is chosen, either it must have
 	* an itemType [attribute] or a <simpleType> among its [children],
-	* but not both.
+	* but not both."
 	*
-	* REMOVED: This is checked in the parse function of <list>.
+	* NOTE: This is checked in the parse function of <list>.
 	*/
-    } else if (VARIETY_UNION(type)) {
-	xmlSchemaTypeLinkPtr member;
-	xmlSchemaTypePtr ancestor, anySimpleType;
-
-	anySimpleType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
-
-	/* src-simple-type.4 Circular union type definition is disallowed. That is, if
-	* the <union> alternative is chosen, there must not be any entries
-	* in the memberTypes [attribute] at any depth which resolve to the
-	* component corresponding to the <simpleType>.
+    } else if (VARIETY_UNION(type)) {	
+	/* 
+	* src-simple-type.4 is checked in xmlSchemaCheckUnionTypeDefCircular().
 	*/
-	member = type->memberTypes;
-	while (member != NULL) {
-	    ancestor = member->type;
-	    while ((ancestor != NULL) && (ancestor->type != XML_SCHEMA_TYPE_BASIC)) {
-		if (ancestor == type) {
-		    xmlSchemaPCustomErr(ctxt,
-			XML_SCHEMAP_SRC_SIMPLE_TYPE_4,
-			NULL, type, NULL,
-			"The definition is circular", NULL);
-		    return (XML_SCHEMAP_SRC_SIMPLE_TYPE_4);
-		}
-		if (IS_NOT_TYPEFIXED(ancestor))
-		    xmlSchemaTypeFixup(ancestor, ctxt,  NULL);
-		if (VARIETY_LIST(ancestor)) {
-		    /*
-		    * TODO, FIXME: Although a list simple type must not have a union ST
-		    * type as item type, which in turn has a list ST as member
-		    * type, we will assume this here as well, since this check
-		    * was not yet performed.
-		    */
-		}
-
-		ancestor = ancestor->baseType;
-	    }
-	    member = member->next;
-	}
     }
-
     return (0);
 }
+#endif
 
 static int
 xmlSchemaCreateVCtxtOnPCtxt(xmlSchemaParserCtxtPtr ctxt)
@@ -14521,7 +14872,8 @@
 	    return (-1);
 	}
 	/* TODO: Pass user data. */
-	xmlSchemaSetValidErrors(ctxt->vctxt, ctxt->error, ctxt->warning, NULL);
+	xmlSchemaSetValidErrors(ctxt->vctxt,
+	    ctxt->error, ctxt->warning, ctxt->userData);
     }
     return (0);
 }
@@ -14601,10 +14953,10 @@
     * as defined by String Valid (§3.14.4).
     */
     if (IS_SIMPLE_TYPE(type))
-	ret = xmlSchemaVCheckCVCSimpleType((xmlSchemaAbstractCtxtPtr) pctxt, node,
+	ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node,
 	    type, value, val, 1, 1, 0);
     else if (HAS_SIMPLE_CONTENT(type))
-	ret = xmlSchemaVCheckCVCSimpleType((xmlSchemaAbstractCtxtPtr) pctxt, node,
+	ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node,
 	    type->contentTypeDef, value, val, 1, 1, 0);
     else
 	return (ret);
@@ -14644,7 +14996,7 @@
     */
     if ((type->baseType != NULL) &&
 	(IS_SIMPLE_TYPE(type->baseType)) &&
-	((type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) == 0)) {
+	(WXS_IS_EXTENSION(type) == 0)) {
 	/*
 	* SPEC (2) "If the {base type definition} is a simple type definition,
 	* the {derivation method} must be extension."
@@ -14719,10 +15071,8 @@
 	* SPEC (1) "If B and D are not the same type definition, then the
 	* {derivation method} of D must not be in the subset."
 	*/
-	if (((set & SUBSET_EXTENSION) &&
-	    (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)) ||
-	    ((set & SUBSET_RESTRICTION) &&
-	    (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)))
+	if (((set & SUBSET_EXTENSION) && (WXS_IS_EXTENSION(type))) ||
+	    ((set & SUBSET_RESTRICTION) && (WXS_IS_RESTRICTION(type))))
 	    return (1);
     } else {
 	/*
@@ -15132,7 +15482,7 @@
     ret = xmlSchemaCheckCTPropsCorrect(ctxt, type);
     if (ret != 0)
 	return (ret);
-    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)
+    if (WXS_IS_EXTENSION(type))
 	ret = xmlSchemaCheckCOSCTExtends(ctxt, type);
     else
 	ret = xmlSchemaCheckDerivationOKRestriction(ctxt, type);
@@ -15190,8 +15540,7 @@
 	* base [attribute] must be one of the following:
 	*/
 	if (IS_SIMPLE_TYPE(base)) {
-	    if ((type->flags &
-		XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) == 0) {
+	    if (WXS_IS_EXTENSION(type) == 0) {
 		xmlChar *str = NULL;
 		/*
 		* 2.1.3 only if the <extension> alternative is also
@@ -15227,8 +15576,7 @@
 		    return (-1);
 		}
 	    } else if ((base->contentType == XML_SCHEMA_CONTENT_MIXED) &&
-		(type->flags &
-		    XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)) {
+		(WXS_IS_RESTRICTION(type))) {
 
 		/*
 		* 2.1.2 only if the <restriction> alternative is also
@@ -15268,7 +15616,7 @@
 	}
 	if (ret > 0) {
 	    xmlChar *str = NULL;
-	    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) {
+	    if (WXS_IS_RESTRICTION(type)) {
 		xmlSchemaPCustomErr(ctxt,
 		    XML_SCHEMAP_SRC_CT_1,
 		    NULL, type, NULL,
@@ -15758,6 +16106,12 @@
 	xmlFree(msg);
 }
 
+/*
+* xmlSchemaDeriveAndValidateFacets:
+*
+* Schema Component Constraint: Simple Type Restriction (Facets)
+* (st-restrict-facets)
+*/
 static int
 xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt,
 				 xmlSchemaTypePtr type)
@@ -15774,14 +16128,29 @@
 	bfmininc = NULL, bfmaxinc = NULL,
 	bfminexc = NULL, bfmaxexc = NULL;
     int res, err = 0, fixedErr;
+
     /*
-    * 3 The {facets} of R are the union of S and the {facets}
+    * SPEC st-restrict-facets 1:
+    * "The {variety} of R is the same as that of B."    
+    */
+    /*
+    * SPEC st-restrict-facets 2:
+    * "If {variety} is atomic, the {primitive type definition}
+    * of R is the same as that of B."
+    *
+    * NOTE: we leave 1 & 2 out for now, since this will be
+    * satisfied by the derivation process.
+    * CONSTRUCTION TODO: Maybe needed if using a construction API.
+    */
+    /*
+    * SPEC st-restrict-facets 3:
+    * "The {facets} of R are the union of S and the {facets}
     * of B, eliminating duplicates. To eliminate duplicates,
     * when a facet of the same kind occurs in both S and the
     * {facets} of B, the one in the {facets} of B is not
     * included, with the exception of enumeration and pattern
     * facets, for which multiple occurrences with distinct values
-    * are allowed.
+    * are allowed."
     */
 
     if ((type->facetSet == NULL) && (base->facetSet == NULL))
@@ -16278,10 +16647,8 @@
 
     return (0);
 internal_error:
-    xmlSchemaPCustomErr(pctxt,
-	XML_SCHEMAP_INVALID_FACET_VALUE,
-	NULL, type, NULL,
-	"Internal error: xmlSchemaDeriveAndValidateFacets", NULL);
+    PERROR_INT("xmlSchemaDeriveAndValidateFacets",
+	"an error occured");
     return (-1);
 }
 
@@ -16299,7 +16666,7 @@
     while (link != NULL) {
 
 	if (IS_NOT_TYPEFIXED(link->type))
-	    xmlSchemaTypeFixup(link->type, pctxt, NULL);
+	    xmlSchemaTypeFixup(link->type, pctxt);
 
 	if (VARIETY_UNION(link->type)) {
 	    subLink = xmlSchemaGetUnionSimpleTypeMemberTypes(link->type);
@@ -16451,451 +16818,82 @@
     return (0);
 }
 
-/**
- * xmlSchemaTypeFixup:
- * @typeDecl:  the schema type definition
- * @ctxt:  the schema parser context
- *
- * Fixes the content model of the type.
- */
-static void
-xmlSchemaTypeFixup(xmlSchemaTypePtr type,
-                   xmlSchemaParserCtxtPtr pctxt, const xmlChar * name)
+static int
+xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt,
+			  xmlSchemaTypePtr type)
 {
-    if (type == NULL)
-        return;
-    if ((type->type != XML_SCHEMA_TYPE_COMPLEX) &&
-	(type->type != XML_SCHEMA_TYPE_SIMPLE))
-	return;
-    if (! IS_NOT_TYPEFIXED(type))
-	return;
-    type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
-    if (name == NULL)
-        name = type->name;
+    if (type->type != XML_SCHEMA_TYPE_SIMPLE)
+	return(0);
+    if (! TYPE_IS_NOT_FIXEDUP_1(type))
+	return(0);
+    type->flags |= XML_SCHEMAS_TYPE_FIXUP_1;
 
-    if (type->baseType == NULL) {
-	xmlSchemaPCustomErr(pctxt,
-	    XML_SCHEMAP_INTERNAL,
-	    NULL, type, NULL,
-	    "Internal error: xmlSchemaTypeFixup, "
-	    "baseType is missing on '%s'", type->name);
-	return;
-    }
-
-    if (type->type == XML_SCHEMA_TYPE_COMPLEX) {
-	xmlSchemaTypePtr baseType = type->baseType;
-
+    if (VARIETY_LIST(type)) {
 	/*
-	* Type-fix the base type.
+	* Corresponds to <simpleType><list>...
 	*/
-	if (IS_NOT_TYPEFIXED(baseType))
-	    xmlSchemaTypeFixup(baseType, pctxt, NULL);
-	if (baseType->flags & XML_SCHEMAS_TYPE_INTERNAL_INVALID) {
+	if (type->subtypes == NULL) {
 	    /*
-	    * Skip fixup if the base type is invalid.
-	    * TODO: Generate a warning!
+	    * This one is really needed, so get out.
 	    */
-	    return;
-	}	
-	/*
-	* This basically checks if the base type can be derived.
-	*/
-	if (xmlSchemaCheckSRCCT(pctxt, type) != 0) {
-	    type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID;
-	    return;
+	    PERROR_INT("xmlSchemaFixupSimpleTypeStageOne",
+		"list type has no item-type assigned");
+	    return(-1);
 	}
+    } else if (VARIETY_UNION(type)) {
 	/*
-	* Fixup the content type.
-	*/
-	if (type->contentType == XML_SCHEMA_CONTENT_SIMPLE) {
+	* Corresponds to <simpleType><union>...
+	*/	
+	if (type->memberTypes == NULL) {
 	    /*
-	    * Corresponds to <complexType><simpleContent>...
+	    * This one is really needed, so get out.
 	    */
-	    if ((IS_COMPLEX_TYPE(baseType)) &&
-		(baseType->contentTypeDef != NULL) &&
-		(type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)) {
-		xmlSchemaTypePtr contentBase, content;
-		char buf[30];
-		const xmlChar *tmpname;
-		/*
-		* SPEC (1) If <restriction> + base type is <complexType>,
-		* "whose own {content type} is a simple type..."
-		*/
-		if (type->contentTypeDef != NULL) {
-		    /*
-		    * SPEC (1.1) "the simple type definition corresponding to the
-		    * <simpleType> among the [children] of <restriction> if there
-		    * is one;"
-		    * Note that this "<simpleType> among the [children]" was put
-		    * into ->contentTypeDef during parsing.
-		    */
-		    contentBase = type->contentTypeDef;
-		    type->contentTypeDef = NULL;
-		} else {
-		    /*
-		    * (1.2) "...otherwise (<restriction> has no <simpleType>
-		    * among its [children]), the simple type definition which
-		    * is the {content type} of the ... base type."
-		    */
-		    contentBase = baseType->contentTypeDef;
-		}
-		/*
-		* SPEC
-		* "... a simple type definition which restricts the simple
-		* type definition identified in clause 1.1 or clause 1.2
-		* with a set of facet components"
-		*
-		* Create the anonymous simple type, which will be the content
-		* type of the complex type.
-		*/		
-		snprintf(buf, 29, "#scST%d", ++(pctxt->counter));
-		tmpname = xmlDictLookup(pctxt->dict, BAD_CAST buf, -1);
-		content = xmlSchemaAddType(pctxt,
-		    pctxt->schema, tmpname, tmpname, type->node, 0);
-		if (content == NULL)
-		    return;
-		/*
-		* We will use the same node as for the <complexType>
-		* to have it somehow anchored in the schema doc.
-		*/
-		content->node = type->node;
-		content->type = XML_SCHEMA_TYPE_SIMPLE;
-		content->contentType = XML_SCHEMA_CONTENT_SIMPLE;
-		content->baseType = contentBase;
-		/*
-		* Move the facets, previously anchored on the complexType.
-		*/
-		content->facets = type->facets;
-		type->facets = NULL;
-		content->facetSet = type->facetSet;
-		type->facetSet = NULL;
-
-		type->contentTypeDef = content;
-		if (IS_NOT_TYPEFIXED(contentBase))
-		    xmlSchemaTypeFixup(contentBase, pctxt, NULL);
-		xmlSchemaTypeFixup(content, pctxt, NULL);
-
-	    } else if ((IS_COMPLEX_TYPE(baseType)) &&
-		(baseType->contentType == XML_SCHEMA_CONTENT_MIXED) &&
-		(type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)) {
-		/*
-		* SPEC (2) If <restriction> + base is a mixed <complexType> with
-		* an emptiable particle, then a simple type definition which
-		* restricts the <restriction>'s <simpleType> child.
-		*/
-		if ((type->contentTypeDef == NULL) ||
-		    (type->contentTypeDef->baseType == NULL)) {
-		    /*
-		    * TODO: Check if this ever happens.
-		    */
-		    xmlSchemaPCustomErr(pctxt,
-			XML_SCHEMAP_INTERNAL,
-			NULL, type, NULL,
-			"Internal error: xmlSchemaTypeFixup, "
-			"complex type '%s': the <simpleContent><restriction> "
-			"is missing a <simpleType> child, but was not catched "
-			"by xmlSchemaCheckSRCCT()", type->name);
-		}
-	    } else if ((IS_COMPLEX_TYPE(baseType)) &&
-		(type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)) {
-		/*
-		* SPEC (3) If <extension> + base is <complexType> with
-		* <simpleType> content, "...then the {content type} of that
-		* complex type definition"
-		*/
-		if (baseType->contentTypeDef == NULL) {
-		    /*
-		    * TODO: Check if this ever happens. xmlSchemaCheckSRCCT
-		    * should have catched this already.
-		    */
-		    xmlSchemaPCustomErr(pctxt,
-			XML_SCHEMAP_INTERNAL,
-			NULL, type, NULL,
-			"Internal error: xmlSchemaTypeFixup, "
-			"complex type '%s': the <extension>ed base type is "
-			"a complex type with no simple content type",
-			type->name);
-		}
-		type->contentTypeDef = baseType->contentTypeDef;
-	    } else if ((IS_SIMPLE_TYPE(baseType)) &&
-		(type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION)) {
-		/*
-		* SPEC (4) <extension> + base is <simpleType>
-		* "... then that simple type definition"
-		*/
-		type->contentTypeDef = baseType;
-	    } else {
-		/*
-		* TODO: Check if this ever happens.
-		*/
-		xmlSchemaPCustomErr(pctxt,
-		    XML_SCHEMAP_INTERNAL,
-		    NULL, type, NULL,
-		    "Internal error: xmlSchemaTypeFixup, "
-		    "complex type '%s' with <simpleContent>: unhandled "
-		    "derivation case", type->name);
-	    }
-	} else {
-	    int dummySequence = 0;
-	    xmlSchemaParticlePtr particle =
-		(xmlSchemaParticlePtr) type->subtypes;
-	    /*
-	    * Corresponds to <complexType><complexContent>...
-	    *
-	    * NOTE that the effective mixed was already set during parsing of
-	    * <complexType> and <complexContent>; its flag value is
-	    * XML_SCHEMAS_TYPE_MIXED.
-	    *
-	    * Compute the "effective content":
-	    * (2.1.1) + (2.1.2) + (2.1.3)
-	    */
-	    if ((particle == NULL) ||
-		((particle->type == XML_SCHEMA_TYPE_PARTICLE) &&
-		 ((particle->children->type == XML_SCHEMA_TYPE_ALL) ||
-		  (particle->children->type == XML_SCHEMA_TYPE_SEQUENCE) ||
-		  ((particle->children->type == XML_SCHEMA_TYPE_CHOICE) &&
-		   (particle->minOccurs == 0))) &&
-		   ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) {
-		if (type->flags & XML_SCHEMAS_TYPE_MIXED) {
-		    /*
-		    * SPEC (2.1.4) "If the ·effective mixed· is true, then
-		    * a particle whose properties are as follows:..."
-		    *
-		    * Empty sequence model group with
-		    * minOccurs/maxOccurs = 1 (i.e. a "particle emptiable").
-		    * NOTE that we sill assign it the <complexType> node to
-		    * somehow anchor it in the doc.
-		    */
-		    if ((particle == NULL) ||
-			(particle->children->type != XML_SCHEMA_TYPE_SEQUENCE)) {
-			/*
-			* Create the particle.
-			*/
-			particle = xmlSchemaAddParticle(pctxt, pctxt->schema,
-			    type->node, 1, 1);
-			if (particle == NULL)
-			    return;
-			/*
-			* Create the model group.
-			*/
-			particle->children = (xmlSchemaTreeItemPtr)
-			    xmlSchemaAddModelGroup(pctxt, pctxt->schema,
-				XML_SCHEMA_TYPE_SEQUENCE, NULL, type->node);
-			if (particle->children == NULL)
-			    return;
-
-			type->subtypes = (xmlSchemaTypePtr) particle;
-		    }
-		    dummySequence = 1;
-		    type->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
-		} else {
-		    /*
-		    * SPEC (2.1.5) "otherwise empty"
-		    */
-		    type->contentType = XML_SCHEMA_CONTENT_EMPTY;
-		}
-	    } else {
-		/*
-	 	* SPEC (2.2) "otherwise the particle corresponding to the
-		* <all>, <choice>, <group> or <sequence> among the
-		* [children]."
-		*/
-		type->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
-	    }
-	    /*
-	    * Compute the "content type".
-	    */
-	    if (type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) {
-		/*
-		* SPEC (3.1) "If <restriction>..."
-		* (3.1.1) + (3.1.2) */
-		if (type->contentType != XML_SCHEMA_CONTENT_EMPTY) {
-		    if (type->flags & XML_SCHEMAS_TYPE_MIXED)
-			type->contentType = XML_SCHEMA_CONTENT_MIXED;
-		}
-	    } else {
-		/*
-		* SPEC (3.2) "If <extension>..."
-		*/
-		if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) {
-		    /*
-		    * SPEC (3.2.1)
-		    */
-		    type->contentType = baseType->contentType;
-		    type->subtypes = baseType->subtypes;
-		    /*
-		    * NOTE that the effective mixed is ignored here.
-		    */
-		} else if (baseType->contentType == XML_SCHEMA_CONTENT_EMPTY) {
-		    /*
-		    * SPEC (3.2.2)
-		    */
-		    if (type->flags & XML_SCHEMAS_TYPE_MIXED)
-			type->contentType = XML_SCHEMA_CONTENT_MIXED;
-		} else {
-		    /*
-		    * SPEC (3.2.3)
-		    */
-		    if (type->flags & XML_SCHEMAS_TYPE_MIXED)
-			type->contentType = XML_SCHEMA_CONTENT_MIXED;
-		    /*
-		    * "A model group whose {compositor} is sequence and whose
-		    * {particles} are..."
-		    */
-		    if (! dummySequence) {
-			xmlSchemaTreeItemPtr effectiveContent =
-			    (xmlSchemaTreeItemPtr) type->subtypes;
-			/*
-			* Create the particle.
-			*/
-			particle = xmlSchemaAddParticle(pctxt, pctxt->schema,
-			    type->node, 1, 1);
-			if (particle == NULL)
-			    return;
-			/*
-			* Create the "sequence" model group.
-			*/
-			particle->children = (xmlSchemaTreeItemPtr)
-			    xmlSchemaAddModelGroup(pctxt, pctxt->schema,
-				XML_SCHEMA_TYPE_SEQUENCE, NULL, type->node);
-			if (particle->children == NULL)
-			    return;
-			type->subtypes = (xmlSchemaTypePtr) particle;
-			/*
-			* SPEC "the particle of the {content type} of
-			* the ... base ..."
-			* Create a duplicate of the base type's particle
-			* and assign its "term" to it.
-			*/
-			particle->children->children =
-			    (xmlSchemaTreeItemPtr) xmlSchemaAddParticle(pctxt,
-				pctxt->schema, type->node,
-				((xmlSchemaParticlePtr) type->subtypes)->minOccurs,
-				((xmlSchemaParticlePtr) type->subtypes)->maxOccurs);
-			if (particle->children->children == NULL)
-			    return;
-			particle = (xmlSchemaParticlePtr)
-			    particle->children->children;
-			particle->children =
-				((xmlSchemaParticlePtr) baseType->subtypes)->children;
-			/*
-			* SPEC "followed by the ·effective content·."
-			*/
-			particle->next = effectiveContent;
-		    } else {
-			/*
-			* This is the case when there is already an empty
-			* <sequence> with minOccurs==maxOccurs==1.
-			* Just add the base types's content type.
-			* NOTE that, although we miss to add an intermediate
-			* <sequence>, this should produce no difference to
-			* neither the regex compilation of the content model,
-			* nor to the complex type contraints.
-			*/
-			particle->children->children =
-			    (xmlSchemaTreeItemPtr) baseType->subtypes;
-		    }
-		}
-	    }
-	}
+	    PERROR_INT("xmlSchemaFixupSimpleTypeStageOne",
+		"union type has no member-types assigned");
+	    return(-1);
+	}	    
+    } else {    
 	/*
-	* Apply the complex type component constraints; this will not
-	* check attributes, since this is done in
-	* xmlSchemaBuildAttributeValidation().
+	* Corresponds to <simpleType><restriction>...
 	*/
-	if (xmlSchemaCheckCTComponent(pctxt, type) != 0)
-	    return;
-	/*
-	* Inherit & check constraints for attributes.
-	*/
-	xmlSchemaBuildAttributeValidation(pctxt, type);
-    } else if (type->type == XML_SCHEMA_TYPE_SIMPLE) {
-	/*
-	* Simple Type Definition Schema Component
-	*/
-	type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
-	if (VARIETY_LIST(type)) {
-	    /*
-	    * Corresponds to <simpleType><list>...
-	    */
-	    if (type->subtypes == NULL) {
-		/*
-		* This one is really needed, so get out.
-		*/
-		PERROR_INT("xmlSchemaTypeFixup",
-		"list type has no item-type assigned");
-		return;
-	    }
-	    if (IS_NOT_TYPEFIXED(type->subtypes))
-		xmlSchemaTypeFixup(type->subtypes, pctxt, NULL);
-	} else if (VARIETY_UNION(type)) {
-	    /*
-	    * Corresponds to <simpleType><union>...
-	    */
-	    if (type->memberTypes == NULL) {
-		/*
-		* This one is really needed, so get out.
-		*/
-		return;
-	    }
-	    if (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1)
-		return;
-	} else {
-	    xmlSchemaTypePtr baseType = type->baseType;
-	    /*
-	    * Corresponds to <simpleType><restriction>...
-	    */
-	    if (IS_NOT_TYPEFIXED(baseType))
-		xmlSchemaTypeFixup(baseType, pctxt, NULL);
-	    /*
-	    * Variety
-	    * If the <restriction> alternative is chosen, then the
-	    * {variety} of the {base type definition}.
-	    */
-	    if (VARIETY_ATOMIC(baseType))
-		type->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
-	    else if (VARIETY_LIST(baseType)) {
-		type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
-		/*
-		* Inherit the itemType.
-		*/
-		type->subtypes = baseType->subtypes;
-	    } else if (VARIETY_UNION(baseType)) {
-		type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION;
-		/*
-		* NOTE that we won't assign the memberTypes of the base,
-		* since this will make trouble when freeing them; we will
-		* use a lookup function to access them instead.
-		*/
-	    }
+	if (type->baseType == NULL) {
+	    PERROR_INT("xmlSchemaFixupSimpleTypeStageOne",
+		"type has no base-type assigned");
+	    return(-1);
 	}
+	if (TYPE_IS_NOT_FIXEDUP_1(type->baseType))
+	    if (xmlSchemaFixupSimpleTypeStageOne(pctxt, type->baseType) == -1)
+		return(-1);
 	/*
-	* Check constraints.
-	*
-	* TODO: Split this somehow, we need to know first if we can derive
-	* from the base type at all!
+	* Variety
+	* If the <restriction> alternative is chosen, then the
+	* {variety} of the {base type definition}.
 	*/
-	if (type->baseType != NULL) {
+	if (VARIETY_ATOMIC(type->baseType))
+	    type->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
+	else if (VARIETY_LIST(type->baseType)) {
+	    type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
 	    /*
-	    * Schema Component Constraint: Simple Type Restriction
-	    * (Facets)
-	    * NOTE: Satisfaction of 1 and 2 arise from the fixup
-	    * applied beforehand.
+	    * Inherit the itemType.
 	    */
-	    xmlSchemaCheckSRCSimpleType(pctxt, type);
-	    xmlSchemaCheckFacetValues(type, pctxt);
-	    if ((type->facetSet != NULL) ||
-		(type->baseType->facetSet != NULL))
-		xmlSchemaDeriveAndValidateFacets(pctxt, type);
+	    type->subtypes = type->baseType->subtypes;
+	} else if (VARIETY_UNION(type->baseType)) {
+	    type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION;
 	    /*
-	    * Whitespace value.
+	    * NOTE that we won't assign the memberTypes of the base,
+	    * since this will make trouble when freeing them; we will
+	    * use a lookup function to access them instead.
 	    */
-	    xmlSchemaTypeFixupWhitespace(type);
-	    xmlSchemaTypeFixupOptimFacets(type);
 	}
     }
+    return(0);
+}
 
 #ifdef DEBUG_TYPE
+static void
+xmlSchemaDebugFixedType(xmlSchemaParserCtxtPtr pctxt,
+		       xmlSchemaTypePtr type)
+{
     if (type->node != NULL) {
         xmlGenericError(xmlGenericErrorContext,
                         "Type of %s : %s:%d :", name,
@@ -16941,10 +16939,506 @@
 		break;
 	}
     }
+}
 #endif
+
+/*
+* 3.14.6 Constraints on Simple Type Definition Schema Components
+*/
+static int
+xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt,
+				 xmlSchemaTypePtr type)
+{
+    int res, olderrs = pctxt->nberrors;
+
+    if (type->type != XML_SCHEMA_TYPE_SIMPLE)
+	return(-1);
+
+    if (! IS_NOT_TYPEFIXED(type))
+	return(0);
+
+    type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
+    type->contentType = XML_SCHEMA_CONTENT_SIMPLE;
+
+    if (type->baseType == NULL) {
+	PERROR_INT("xmlSchemaFixupSimpleTypeStageTwo",
+	    "missing baseType");
+	goto exit_failure;
+    }
+    if (IS_NOT_TYPEFIXED(type->baseType))
+	xmlSchemaTypeFixup(type->baseType, pctxt);
+    /* 
+    * If a member type of a union is a union itself, we need to substitute
+    * that member type for its member types.
+    */
+    if ((type->memberTypes != NULL) &&
+	(xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1))
+	return(-1);        
+    /*
+    * SPEC src-simple-type 1 
+    * "The corresponding simple type definition, if any, must satisfy
+    * the conditions set out in Constraints on Simple Type Definition
+    * Schema Components (§3.14.6)."
+    */
+    /*
+    * Schema Component Constraint: Simple Type Definition Properties Correct
+    * (st-props-correct)
+    */
+    res = xmlSchemaCheckSTPropsCorrect(pctxt, type);
+    HFAILURE HERROR
+    /* 
+    * Schema Component Constraint: Derivation Valid (Restriction, Simple)
+    * (cos-st-restricts)
+    */
+    res = xmlSchemaCheckCOSSTRestricts(pctxt, type);
+    HFAILURE HERROR
+    /*
+    * TODO: Removed the error report, since it got annoying to get an
+    * extra error report, if anything failed until now.
+    * Enable this if needed.
+    *
+    * xmlSchemaPErr(ctxt, type->node,
+    *    XML_SCHEMAP_SRC_SIMPLE_TYPE_1,
+    *    "Simple type '%s' does not satisfy the constraints "
+    *    "on simple type definitions.\n",
+    *    type->name, NULL);
+    */
+    /*
+    * Schema Component Constraint: Simple Type Restriction (Facets)
+    * (st-restrict-facets)
+    */
+    res = xmlSchemaCheckFacetValues(type, pctxt);
+    HFAILURE HERROR
+    if ((type->facetSet != NULL) ||
+	(type->baseType->facetSet != NULL)) {
+	res = xmlSchemaDeriveAndValidateFacets(pctxt, type);
+	HFAILURE HERROR
+    }
+    /*
+    * Whitespace value.
+    */
+    res = xmlSchemaTypeFixupWhitespace(type);
+    HFAILURE HERROR
+    xmlSchemaTypeFixupOptimFacets(type);    
+
+exit_error:
+#ifdef DEBUG_TYPE
+    xmlSchemaDebugFixedType(pctxt, type);
+#endif
+    if (olderrs != pctxt->nberrors)
+	return(pctxt->err);
+    return(0);
+
+exit_failure:
+#ifdef DEBUG_TYPE
+    xmlSchemaDebugFixedType(pctxt, type);
+#endif
+    return(-1);
 }
 
+static int
+xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
+			  xmlSchemaTypePtr type)
+{
+    int res = 0, olderrs = pctxt->nberrors;
+    xmlSchemaTypePtr baseType = type->baseType;
+
+    if (! IS_NOT_TYPEFIXED(type))
+	return(0);
+    type->flags |= XML_SCHEMAS_TYPE_INTERNAL_RESOLVED;
+    if (baseType == NULL) {
+	PERROR_INT("xmlSchemaFixupSimpleTypeStageTwo",
+	    "missing baseType");
+	goto exit_failure;
+    }    
+    /*
+    * Fixup the base type.
+    */
+    if (IS_NOT_TYPEFIXED(baseType))
+	xmlSchemaTypeFixup(baseType, pctxt);
+    if (baseType->flags & XML_SCHEMAS_TYPE_INTERNAL_INVALID) {
+	/*
+	* Skip fixup if the base type is invalid.
+	* TODO: Generate a warning!
+	*/
+	return(0);
+    }	
+    /*
+    * This basically checks if the base type can be derived.
+    */
+    res = xmlSchemaCheckSRCCT(pctxt, type);
+    HFAILURE HERROR   
+    /*
+    * Fixup the content type.
+    */
+    if (type->contentType == XML_SCHEMA_CONTENT_SIMPLE) {
+	/*
+	* Corresponds to <complexType><simpleContent>...
+	*/
+	if ((IS_COMPLEX_TYPE(baseType)) &&
+	    (baseType->contentTypeDef != NULL) &&
+	    (WXS_IS_RESTRICTION(type))) {
+	    xmlSchemaTypePtr contentBase, content;
+#ifdef ENABLE_NAMED_LOCALS
+	    char buf[30];
+	    const xmlChar *tmpname;
+#endif
+	    /*
+	    * SPEC (1) If <restriction> + base type is <complexType>,
+	    * "whose own {content type} is a simple type..."
+	    */
+	    if (type->contentTypeDef != NULL) {
+		/*
+		* SPEC (1.1) "the simple type definition corresponding to the
+		* <simpleType> among the [children] of <restriction> if there
+		* is one;"
+		* Note that this "<simpleType> among the [children]" was put
+		* into ->contentTypeDef during parsing.
+		*/
+		contentBase = type->contentTypeDef;
+		type->contentTypeDef = NULL;
+	    } else {
+		/*
+		* (1.2) "...otherwise (<restriction> has no <simpleType>
+		* among its [children]), the simple type definition which
+		* is the {content type} of the ... base type."
+		*/
+		contentBase = baseType->contentTypeDef;
+	    }
+	    /*
+	    * SPEC
+	    * "... a simple type definition which restricts the simple
+	    * type definition identified in clause 1.1 or clause 1.2
+	    * with a set of facet components"
+	    *
+	    * Create the anonymous simple type, which will be the content
+	    * type of the complex type.
+	    */
+#ifdef ENABLE_NAMED_LOCALS
+	    snprintf(buf, 29, "#scST%d", ++(pctxt->counter));
+	    tmpname = xmlDictLookup(pctxt->dict, BAD_CAST buf, -1);
+	    content = xmlSchemaAddType(pctxt,
+		pctxt->schema, tmpname, type->targetNamespace,
+		type->node, 0);
+#else
+	    content = xmlSchemaAddType(pctxt,
+		pctxt->schema, NULL, type->targetNamespace,
+		type->node, 0);
+#endif
+	    if (content == NULL)
+		goto exit_failure;
+	    /*
+	    * We will use the same node as for the <complexType>
+	    * to have it somehow anchored in the schema doc.
+	    */
+	    content->type = XML_SCHEMA_TYPE_SIMPLE;
+	    content->baseType = contentBase;
+	    /*
+	    * Move the facets, previously anchored on the
+	    * complexType during parsing.
+	    */
+	    content->facets = type->facets;
+	    type->facets = NULL;
+	    content->facetSet = type->facetSet;
+	    type->facetSet = NULL;
+	    
+	    type->contentTypeDef = content;
+	    if (IS_NOT_TYPEFIXED(contentBase))
+		xmlSchemaTypeFixup(contentBase, pctxt);
+	    /*
+	    * Fixup the newly created type. We don't need to check
+	    * for circularity here.
+	    */
+	    res = xmlSchemaFixupSimpleTypeStageOne(pctxt, content);
+	    HFAILURE HERROR 
+	    res = xmlSchemaFixupSimpleTypeStageTwo(pctxt, content);
+	    HFAILURE HERROR 
+		
+	} else if ((IS_COMPLEX_TYPE(baseType)) &&
+	    (baseType->contentType == XML_SCHEMA_CONTENT_MIXED) &&
+	    (WXS_IS_RESTRICTION(type))) {
+	    /*
+	    * SPEC (2) If <restriction> + base is a mixed <complexType> with
+	    * an emptiable particle, then a simple type definition which
+	    * restricts the <restriction>'s <simpleType> child.
+	    */
+	    if ((type->contentTypeDef == NULL) ||
+		(type->contentTypeDef->baseType == NULL)) {
+		/*
+		* TODO: Check if this ever happens.
+		*/
+		xmlSchemaPCustomErr(pctxt,
+		    XML_SCHEMAP_INTERNAL,
+		    NULL, type, NULL,
+		    "Internal error: xmlSchemaTypeFixup, "
+		    "complex type '%s': the <simpleContent><restriction> "
+		    "is missing a <simpleType> child, but was not catched "
+		    "by xmlSchemaCheckSRCCT()", type->name);
+		goto exit_failure;
+	    }
+	} else if ((IS_COMPLEX_TYPE(baseType)) && WXS_IS_EXTENSION(type)) {
+	    /*
+	    * SPEC (3) If <extension> + base is <complexType> with
+	    * <simpleType> content, "...then the {content type} of that
+	    * complex type definition"
+	    */
+	    if (baseType->contentTypeDef == NULL) {
+		/*
+		* TODO: Check if this ever happens. xmlSchemaCheckSRCCT
+		* should have catched this already.
+		*/
+		xmlSchemaPCustomErr(pctxt,
+		    XML_SCHEMAP_INTERNAL,
+		    NULL, type, NULL,
+		    "Internal error: xmlSchemaTypeFixup, "
+		    "complex type '%s': the <extension>ed base type is "
+		    "a complex type with no simple content type",
+		    type->name);
+		goto exit_failure;
+	    }
+	    type->contentTypeDef = baseType->contentTypeDef;
+	} else if ((IS_SIMPLE_TYPE(baseType)) && WXS_IS_EXTENSION(type)) {
+	    /*
+	    * SPEC (4) <extension> + base is <simpleType>
+	    * "... then that simple type definition"
+	    */
+	    type->contentTypeDef = baseType;
+	} else {
+	    /*
+	    * TODO: Check if this ever happens.
+	    */
+	    xmlSchemaPCustomErr(pctxt,
+		XML_SCHEMAP_INTERNAL,
+		NULL, type, NULL,
+		"Internal error: xmlSchemaTypeFixup, "
+		"complex type '%s' with <simpleContent>: unhandled "
+		"derivation case", type->name);
+	    goto exit_failure;
+	}
+    } else {
+	int dummySequence = 0;
+	xmlSchemaParticlePtr particle =
+	    (xmlSchemaParticlePtr) type->subtypes;
+	/*
+	* Corresponds to <complexType><complexContent>...
+	*
+	* NOTE that the effective mixed was already set during parsing of
+	* <complexType> and <complexContent>; its flag value is
+	* XML_SCHEMAS_TYPE_MIXED.
+	*
+	* Compute the "effective content":
+	* (2.1.1) + (2.1.2) + (2.1.3)
+	*/
+	if ((particle == NULL) ||
+	    ((particle->type == XML_SCHEMA_TYPE_PARTICLE) &&
+	    ((particle->children->type == XML_SCHEMA_TYPE_ALL) ||
+	    (particle->children->type == XML_SCHEMA_TYPE_SEQUENCE) ||
+	    ((particle->children->type == XML_SCHEMA_TYPE_CHOICE) &&
+	    (particle->minOccurs == 0))) &&
+	    ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) {
+	    if (type->flags & XML_SCHEMAS_TYPE_MIXED) {
+		/*
+		* SPEC (2.1.4) "If the ·effective mixed· is true, then
+		* a particle whose properties are as follows:..."
+		*
+		* Empty sequence model group with
+		* minOccurs/maxOccurs = 1 (i.e. a "particle emptiable").
+		* NOTE that we sill assign it the <complexType> node to
+		* somehow anchor it in the doc.
+		*/
+		if ((particle == NULL) ||
+		    (particle->children->type != XML_SCHEMA_TYPE_SEQUENCE)) {
+		    /*
+		    * Create the particle.
+		    */
+		    particle = xmlSchemaAddParticle(pctxt, pctxt->schema,
+			type->node, 1, 1);
+		    if (particle == NULL)
+			goto exit_failure;
+		    /*
+		    * Create the model group.
+		    */
+		    particle->children = (xmlSchemaTreeItemPtr)
+			xmlSchemaAddModelGroup(pctxt, pctxt->schema,
+			XML_SCHEMA_TYPE_SEQUENCE, type->node);
+		    if (particle->children == NULL)
+			goto exit_failure;
+		    
+		    type->subtypes = (xmlSchemaTypePtr) particle;
+		}
+		dummySequence = 1;
+		type->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
+	    } else {
+		/*
+		* SPEC (2.1.5) "otherwise empty"
+		*/
+		type->contentType = XML_SCHEMA_CONTENT_EMPTY;
+	    }
+	} else {
+	    /*
+	    * SPEC (2.2) "otherwise the particle corresponding to the
+	    * <all>, <choice>, <group> or <sequence> among the
+	    * [children]."
+	    */
+	    type->contentType = XML_SCHEMA_CONTENT_ELEMENTS;
+	}
+	/*
+	* Compute the "content type".
+	*/
+	if (WXS_IS_RESTRICTION(type)) {
+	    /*
+	    * SPEC (3.1) "If <restriction>..."
+	    * (3.1.1) + (3.1.2) */
+	    if (type->contentType != XML_SCHEMA_CONTENT_EMPTY) {
+		if (type->flags & XML_SCHEMAS_TYPE_MIXED)
+		    type->contentType = XML_SCHEMA_CONTENT_MIXED;
+	    }
+	} else {
+	    /*
+	    * SPEC (3.2) "If <extension>..."
+	    */
+	    if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) {
+		/*
+		* SPEC (3.2.1)
+		*/
+		type->contentType = baseType->contentType;
+		type->subtypes = baseType->subtypes;
+		/*
+		* NOTE that the effective mixed is ignored here.
+		*/
+	    } else if (baseType->contentType == XML_SCHEMA_CONTENT_EMPTY) {
+		/*
+		* SPEC (3.2.2)
+		*/
+		if (type->flags & XML_SCHEMAS_TYPE_MIXED)
+		    type->contentType = XML_SCHEMA_CONTENT_MIXED;
+	    } else {
+		/*
+		* SPEC (3.2.3)
+		*/
+		if (type->flags & XML_SCHEMAS_TYPE_MIXED)
+		    type->contentType = XML_SCHEMA_CONTENT_MIXED;
+		    /*
+		    * "A model group whose {compositor} is sequence and whose
+		    * {particles} are..."
+		    */
+		if (! dummySequence) {
+		    xmlSchemaTreeItemPtr effectiveContent =
+			(xmlSchemaTreeItemPtr) type->subtypes;
+		    /*
+		    * Create the particle.
+		    */
+		    particle = xmlSchemaAddParticle(pctxt, pctxt->schema,
+			type->node, 1, 1);
+		    if (particle == NULL)
+			goto exit_failure;
+		    /*
+		    * Create the "sequence" model group.
+		    */
+		    particle->children = (xmlSchemaTreeItemPtr)
+			xmlSchemaAddModelGroup(pctxt, pctxt->schema,
+			XML_SCHEMA_TYPE_SEQUENCE, type->node);
+		    if (particle->children == NULL)
+			goto exit_failure;
+		    type->subtypes = (xmlSchemaTypePtr) particle;
+		    /*
+		    * SPEC "the particle of the {content type} of
+		    * the ... base ..."
+		    * Create a duplicate of the base type's particle
+		    * and assign its "term" to it.
+		    */
+		    particle->children->children =
+			(xmlSchemaTreeItemPtr) xmlSchemaAddParticle(pctxt,
+			pctxt->schema, type->node,
+			((xmlSchemaParticlePtr) type->subtypes)->minOccurs,
+			((xmlSchemaParticlePtr) type->subtypes)->maxOccurs);
+		    if (particle->children->children == NULL)
+			goto exit_failure;
+		    particle = (xmlSchemaParticlePtr)
+			particle->children->children;
+		    particle->children =
+			((xmlSchemaParticlePtr) baseType->subtypes)->children;
+		    /*
+		    * SPEC "followed by the ·effective content·."
+		    */
+		    particle->next = effectiveContent;
+		} else {
+		    /*
+		    * This is the case when there is already an empty
+		    * <sequence> with minOccurs==maxOccurs==1.
+		    * Just add the base types's content type.
+		    * NOTE that, although we miss to add an intermediate
+		    * <sequence>, this should produce no difference to
+		    * neither the regex compilation of the content model,
+		    * nor to the complex type contraints.
+		    */
+		    particle->children->children =
+			(xmlSchemaTreeItemPtr) baseType->subtypes;
+		}
+	    }
+	}
+    }
+    /*
+    * Apply the complex type component constraints; this will not
+    * check attributes, since this is done in
+    * xmlSchemaBuildAttributeValidation().
+    */
+    res = xmlSchemaCheckCTComponent(pctxt, type);
+    HFAILURE HERROR
+    /*
+    * Inherit & check constraints for attributes.
+    */
+    res = xmlSchemaBuildAttributeValidation(pctxt, type);
+    HFAILURE HERROR
+
+#ifdef DEBUG_TYPE
+    xmlSchemaDebugFixedType(pctxt, type);
+#endif
+    if (olderrs != pctxt->nberrors)
+	return(pctxt->err);
+    else
+	return(0);
+
+exit_error:
+    type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID;
+#ifdef DEBUG_TYPE
+    xmlSchemaDebugFixedType(pctxt, type);
+#endif
+    return(pctxt->err);
+
+exit_failure:
+    type->flags |= XML_SCHEMAS_TYPE_INTERNAL_INVALID;
+#ifdef DEBUG_TYPE
+    xmlSchemaDebugFixedType(pctxt, type);
+#endif
+    return(-1);
+}
+
+
 /**
+ * xmlSchemaTypeFixup:
+ * @typeDecl:  the schema type definition
+ * @ctxt:  the schema parser context
+ *
+ * Fixes the content model of the type.
+ * URGENT TODO: We need an int result!
+ */
+static int
+xmlSchemaTypeFixup(xmlSchemaTypePtr type,
+                   xmlSchemaParserCtxtPtr pctxt)
+{
+    if (type == NULL)
+        return(0);
+    if (! IS_NOT_TYPEFIXED(type))
+	return(0);
+    if (type->type == XML_SCHEMA_TYPE_COMPLEX)
+	return(xmlSchemaFixupComplexType(pctxt, type));
+    else if (type->type == XML_SCHEMA_TYPE_SIMPLE)
+	return(xmlSchemaFixupSimpleTypeStageTwo(pctxt, type));
+    return(0);
+}
+
+/**
  * xmlSchemaCheckFacet:
  * @facet:  the facet
  * @typeDecl:  the schema type definition
@@ -17031,13 +17525,13 @@
 		* of the facet.
 		*/		
 		ret = xmlSchemaVCheckCVCSimpleType(
-		    (xmlSchemaAbstractCtxtPtr) pctxt, facet->node, base,
+		    ACTXT_CAST pctxt, facet->node, base,
 		    facet->value, &(facet->val), 1, 1, 0);
                 if (ret != 0) {
 		    if (ret < 0) {
 			/* No error message for RelaxNG. */
 			if (ctxtGiven) {			    
-			    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) pctxt,
+			    xmlSchemaCustomErr(ACTXT_CAST pctxt,
 				XML_SCHEMAP_INTERNAL, facet->node, NULL,
 				"Internal error: xmlSchemaCheckFacet, " 
 				"failed to validate the value '%s' of the "
@@ -17051,7 +17545,7 @@
 		    if (ctxtGiven) {
 			xmlChar *str = NULL;
 
-			xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) pctxt,
+			xmlSchemaCustomErr(ACTXT_CAST pctxt,
 			    ret, facet->node, (xmlSchemaTypePtr) facet,
 			    "The value '%s' of the facet does not validate "
 			    "against the base type '%s'",
@@ -17076,7 +17570,7 @@
 		ret = XML_SCHEMAP_REGEXP_INVALID;
 		/* No error message for RelaxNG. */
 		if (ctxtGiven) {
-		    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) pctxt,
+		    xmlSchemaCustomErr(ACTXT_CAST pctxt,
 			ret, facet->node, typeDecl,
 			"The value '%s' of the facet 'pattern' is not a "
 			"valid regular expression",
@@ -17105,7 +17599,7 @@
 		    /* No error message for RelaxNG. */
 		    if (ctxtGiven) {
 			/* error code */
-                        xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) pctxt,
+                        xmlSchemaCustomErr(ACTXT_CAST pctxt,
 			    ret, facet->node, typeDecl,
 			    "The value '%s' of the facet '%s' is not a valid "
 			    "'nonNegativeInteger'",
@@ -17127,7 +17621,7 @@
                     /* No error message for RelaxNG. */
 		    if (ctxtGiven) {
 			/* error was previously: XML_SCHEMAP_INVALID_WHITE_SPACE */
-			xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) pctxt,
+			xmlSchemaCustomErr(ACTXT_CAST pctxt,
 			    ret, facet->node, typeDecl,
 			    "The value '%s' of the facet 'whitespace' is not "
 			    "valid", facet->value, NULL);
@@ -17154,10 +17648,11 @@
  *
  * Checks the default values types, especially for facets
  */
-static void
+static int
 xmlSchemaCheckFacetValues(xmlSchemaTypePtr typeDecl,
-			  xmlSchemaParserCtxtPtr ctxt)
+			  xmlSchemaParserCtxtPtr pctxt)
 {
+    int res, olderrs = pctxt->nberrors;
     const xmlChar *name = typeDecl->name;
     /*
     * NOTE: It is intended to use the facets list, instead
@@ -17170,19 +17665,23 @@
 	* Temporarily assign the "schema" to the validation context
 	* of the parser context. This is needed for NOTATION validation.
 	*/
-	if (ctxt->vctxt == NULL) {
-	    if (xmlSchemaCreateVCtxtOnPCtxt(ctxt) == -1)
-		return;
+	if (pctxt->vctxt == NULL) {
+	    if (xmlSchemaCreateVCtxtOnPCtxt(pctxt) == -1)
+		return(-1);
 	}
-	ctxt->vctxt->schema = ctxt->schema;
-
+	pctxt->vctxt->schema = pctxt->schema;
 	while (facet != NULL) {
-	    xmlSchemaCheckFacet(facet, typeDecl, ctxt, name);
+	    res = xmlSchemaCheckFacet(facet, typeDecl, pctxt, name);
+	    HFAILURE
 	    facet = facet->next;
 	}
-
-	ctxt->vctxt->schema = NULL;
+	pctxt->vctxt->schema = NULL;
     }
+    if (olderrs != pctxt->nberrors)
+	return(pctxt->err);
+    return(0);
+exit_failure:
+    return(-1);
 }
 
 /**
@@ -17253,8 +17752,7 @@
  */
 static void
 xmlSchemaCheckGroupDefCircular(xmlSchemaModelGroupDefPtr item,
-			       xmlSchemaParserCtxtPtr ctxt,
-			       const xmlChar * name ATTRIBUTE_UNUSED)
+			       xmlSchemaParserCtxtPtr ctxt)
 {
     /*
     * Schema Component Constraint: Model Group Correct
@@ -17296,7 +17794,7 @@
 }
 
 /**
- * xmlSchemaGroupDefTermFixup:
+ * xmlSchemaGroupDefReferenceTermFixup:
  * @item:  the particle with a model group definition as term
  * @ctxt:  the parser context
  * @name:  the name
@@ -17305,11 +17803,11 @@
  *
  * Assigns the model group of model group definitions to the "term"
  * of the referencing particle.
- * In xmlSchemaMiscRefFixup the model group definitions was assigned
+ * In xmlSchemaResolveParticleReferences the model group definitions was assigned
  * to the "term", since needed for the circularity check. 
  */
 static void
-xmlSchemaGroupDefTermFixup(xmlSchemaParticlePtr item,
+xmlSchemaGroupDefReferenceTermFixup(xmlSchemaParticlePtr item,
 			   xmlSchemaParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
 			   const xmlChar * name ATTRIBUTE_UNUSED)
 {
@@ -17402,9 +17900,8 @@
  * Checks for circular references of attribute groups.
  */
 static void
-xmlSchemaCheckAttributeGroupCircular(xmlSchemaAttributeGroupPtr attrGr,
-					xmlSchemaParserCtxtPtr ctxt,
-					const xmlChar * name ATTRIBUTE_UNUSED)
+xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr,
+					xmlSchemaParserCtxtPtr ctxt)
 {
     /*
     * Schema Representation Constraint:
@@ -17451,7 +17948,7 @@
 }
 
 /**
- * xmlSchemaAttrGrpFixup:
+ * xmlSchemaResolveAttrGroupReferences:
  * @attrgrpDecl:  the schema attribute definition
  * @ctxt:  the schema parser context
  * @name:  the attribute name
@@ -17459,7 +17956,7 @@
  * Fixes finish doing the computations on the attributes definitions
  */
 static void
-xmlSchemaAttrGrpFixup(xmlSchemaAttributeGroupPtr attrgrp,
+xmlSchemaResolveAttrGroupReferences(xmlSchemaAttributeGroupPtr attrgrp,
                       xmlSchemaParserCtxtPtr ctxt, const xmlChar * name)
 {
     if (name == NULL)
@@ -17481,9 +17978,11 @@
         }
 	attrgrp->refItem = ref;
 	/*
-	* Check for self reference!
-	*/
-        xmlSchemaAttrGrpFixup(ref, ctxt, NULL);
+	* URGENT TODO: Do we need to resolve refs of the
+	* referenced attr. group itself first? I don't think so.
+	* If we need this, then check for circularity first!
+	* REMOVED: xmlSchemaResolveAttrGroupReferences(ref, ctxt, NULL);
+	*/        
         attrgrp->attributes = ref->attributes;
 	attrgrp->attributeWildcard = ref->attributeWildcard;
     }
@@ -17504,8 +18003,7 @@
  */
 static void
 xmlSchemaCheckAttrValConstr(xmlSchemaAttributePtr item,
-			    xmlSchemaParserCtxtPtr pctxt,
-			    const xmlChar * name ATTRIBUTE_UNUSED)
+			    xmlSchemaParserCtxtPtr pctxt)
 {
 
     /*
@@ -17521,7 +18019,7 @@
 		"type is missing");
 	    return;
 	}
-	ret = xmlSchemaVCheckCVCSimpleType((xmlSchemaAbstractCtxtPtr) pctxt,
+	ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt,
 	    item->node, item->subtypes, item->defValue, &(item->defVal),
 	    1, 1, 0);
 	if (ret != 0) {
@@ -17531,7 +18029,7 @@
 		return;
 	    }
 	    ret = XML_SCHEMAP_A_PROPS_CORRECT_2;
-	    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) pctxt,
+	    xmlSchemaCustomErr(ACTXT_CAST pctxt,
 		ret, item->node, (xmlSchemaTypePtr) item,
 		"The value of the value constraint is not valid", NULL, NULL);
 	    return;
@@ -17587,7 +18085,7 @@
     if (SUBST_GROUP_AFF(elemDecl) != NULL) {
 	xmlSchemaElementPtr head = SUBST_GROUP_AFF(elemDecl), circ;
 
-	xmlSchemaCheckElementDeclComponent(head, pctxt, NULL);
+	xmlSchemaCheckElementDeclComponent(head, pctxt);
 	/*
 	* SPEC (3) "If there is a non-·absent· {substitution group
 	* affiliation}, then {scope} must be global."
@@ -17807,13 +18305,11 @@
 	    * The set of all {derivation method}s involved in the derivation
 	    */
 	    while ((type != NULL) && (type != headType)) {
-		if ((type->flags &
-			XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) &&
+		if ((WXS_IS_EXTENSION(type)) &&
 		    ((methSet & XML_SCHEMAS_TYPE_BLOCK_RESTRICTION) == 0))
 		    methSet |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
 
-		if ((type->flags &
-			XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION) &&
+		if (WXS_IS_RESTRICTION(type) &&
 		    ((methSet & XML_SCHEMAS_TYPE_BLOCK_RESTRICTION) == 0))
 		    methSet |= XML_SCHEMAS_TYPE_BLOCK_RESTRICTION;
 
@@ -17867,8 +18363,7 @@
  */
 static void
 xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl,
-				   xmlSchemaParserCtxtPtr ctxt,
-				   const xmlChar * name ATTRIBUTE_UNUSED)
+				   xmlSchemaParserCtxtPtr ctxt)
 {
     if (elemDecl == NULL)
 	return;
@@ -17880,7 +18375,7 @@
 }
 
 /**
- * xmlSchemaMiscRefFixup:
+ * xmlSchemaResolveParticleReferences:
  * @item:  an schema component
  * @ctxt:  a schema parser context
  * @name:  the internal name of the component
@@ -17888,38 +18383,38 @@
  * Resolves references of misc. schema components.
  */
 static void
-xmlSchemaMiscRefFixup(xmlSchemaTreeItemPtr item,
+xmlSchemaResolveParticleReferences(xmlSchemaTreeItemPtr item,
                    xmlSchemaParserCtxtPtr ctxt,
 		   const xmlChar * name ATTRIBUTE_UNUSED)
 {
-    if (item->type == XML_SCHEMA_TYPE_PARTICLE) {
-	if ((item->children != NULL) &&
-	    (item->children->type == XML_SCHEMA_EXTRA_QNAMEREF)) {
-	    xmlSchemaQNameRefPtr ref = (xmlSchemaQNameRefPtr) item->children;
-	    xmlSchemaTreeItemPtr refItem;
-	    /*
-	    * Resolve the reference.
-	    */
-	    item->children = NULL;
-	    refItem = xmlSchemaGetNamedComponent(ctxt->schema,
-		ref->itemType, ref->name, ref->targetNamespace);
-	    if (refItem == NULL) {
-		xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE,
-		    NULL, GET_NODE(item), "ref", ref->name,
-		    ref->targetNamespace, ref->itemType, NULL);
-	    } else {
-		if (refItem->type == XML_SCHEMA_TYPE_GROUP) {
-		    /*
-		    * NOTE that we will assign the model group definition
-		    * itself to the "term" of the particle. This will ease
-		    * the check for circular model group definitions. After
-		    * that the "term" will be assigned the model group of the
-		    * model group definition.
-		    */
-		    item->children = refItem;
-		} else
-		    item->children = refItem;
-	    }
+    if (item->type != XML_SCHEMA_TYPE_PARTICLE)
+	return;
+    if ((item->children != NULL) &&
+	(item->children->type == XML_SCHEMA_EXTRA_QNAMEREF)) {
+	xmlSchemaQNameRefPtr ref = (xmlSchemaQNameRefPtr) item->children;
+	xmlSchemaBasicItemPtr refItem;
+	/*
+	* Resolve the reference.
+	*/
+	item->children = NULL;
+	refItem = xmlSchemaGetNamedComponent(ctxt->schema,
+	    ref->itemType, ref->name, ref->targetNamespace);
+	if (refItem == NULL) {
+	    xmlSchemaPResCompAttrErr(ctxt, XML_SCHEMAP_SRC_RESOLVE,
+		NULL, GET_NODE(item), "ref", ref->name,
+		ref->targetNamespace, ref->itemType, NULL);
+	} else {
+	    if (refItem->type == XML_SCHEMA_TYPE_GROUP) {
+		/*
+		* NOTE that we will assign the model group definition
+		* itself to the "term" of the particle. This will ease
+		* the check for circular model group definitions. After
+		* that the "term" will be assigned the model group of the
+		* model group definition.
+		*/
+		item->children = (xmlSchemaTreeItemPtr) refItem;
+	    } else
+		item->children = (xmlSchemaTreeItemPtr) refItem;
 	}
     }
 }
@@ -17984,7 +18479,7 @@
 }
 
 /**
- * xmlSchemaAttrFixup:
+ * xmlSchemaResolveAttrReferences:
  * @item:  an schema attribute declaration/use.
  * @ctxt:  a schema parser context
  * @name:  the name of the attribute
@@ -17992,7 +18487,7 @@
  * Fixes finish doing the computations on attribute declarations/uses.
  */
 static void
-xmlSchemaAttrFixup(xmlSchemaAttributePtr item,
+xmlSchemaResolveAttrReferences(xmlSchemaAttributePtr item,
                    xmlSchemaParserCtxtPtr ctxt,
 		   const xmlChar * name ATTRIBUTE_UNUSED)
 {
@@ -18047,7 +18542,7 @@
             return;
         }
 	item->refDecl = decl;
-        xmlSchemaAttrFixup(decl, ctxt, NULL);
+        xmlSchemaResolveAttrReferences(decl, ctxt, NULL);
         item->subtypes = decl->subtypes;
 	/*
 	* Attribute Use Correct
@@ -18083,12 +18578,13 @@
 	    */
 	}
     } else {
+	/* The type of this attribute is the xs:anySimpleType. */
 	item->subtypes = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE);
     }
 }
 
 /**
- * xmlSchemaResolveIDCKeyRef:
+ * xmlSchemaResolveIDCKeyReferences:
  * @idc:  the identity-constraint definition
  * @ctxt:  the schema parser context
  * @name:  the attribute name
@@ -18096,27 +18592,27 @@
  * Resolve keyRef references to key/unique IDCs.
  */
 static void
-xmlSchemaResolveIDCKeyRef(xmlSchemaIDCPtr idc,
+xmlSchemaResolveIDCKeyReferences(xmlSchemaIDCPtr idc,
 			  xmlSchemaParserCtxtPtr pctxt,
 			  const xmlChar * name ATTRIBUTE_UNUSED)
 {
     if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF)
         return;
     if (idc->ref->name != NULL) {
-	idc->ref->item = (xmlSchemaBasicItemPtr) xmlHashLookup2(
-	    pctxt->schema->idcDef,
-	    idc->ref->name,
-	    idc->ref->targetNamespace);
+	idc->ref->item = (xmlSchemaBasicItemPtr)
+	    xmlSchemaGetIDC(pctxt->schema, idc->ref->name,
+		idc->ref->targetNamespace);
         if (idc->ref->item == NULL) {
 	    /*
-	    * TODO: It is actually not an error to fail to resolve.
+	    * TODO: It is actually not an error to fail to resolve
+	    * at this stage. BUT we need to be that strict!
 	    */
 	    xmlSchemaPResCompAttrErr(pctxt,
 		XML_SCHEMAP_SRC_RESOLVE,
 		(xmlSchemaTypePtr) idc, idc->node,
 		"refer", idc->ref->name,
 		idc->ref->targetNamespace,
-		XML_SCHEMA_TYPE_IDC_KEYREF, NULL);
+		XML_SCHEMA_TYPE_IDC_KEY, NULL);
             return;
 	} else {
 	    if (idc->nbFields !=
@@ -18145,6 +18641,277 @@
     }
 }
 
+
+static int
+xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt)
+{
+    xmlSchemaConstructionCtxtPtr con = pctxt->constructor;
+    xmlSchemaTreeItemPtr item, *items;
+    int nbItems, i;
+
+#define FIXHFAILURE if (pctxt->err == XML_SCHEMAP_INTERNAL) goto exit_failure;
+
+    if ((con->pending == NULL) ||
+	(con->pending->nbItems == 0))
+	return(0);
+
+    pctxt->ctxtType = NULL;
+    pctxt->parentItem = NULL;
+    items = (xmlSchemaTreeItemPtr *) con->pending->items;
+    nbItems = con->pending->nbItems;
+    /*
+    * Now that we have parsed *all* the schema document(s) and converted
+    * them to schema components, we can resolve references, apply component
+    * constraints, create the FSA from the content model, etc.
+    */    
+    /*
+    * Resolve references of..
+    *
+    * 1. element declarations:
+    *   - the type definition
+    *   - the substitution group affiliation
+    * 2. simple/complex types:
+    *   - the base type definition
+    *   - the memberTypes of union types
+    *   - the itemType of list types
+    * 3. attributes declarations and attribute uses:
+    *   - the type definition
+    *   - if an attribute use, then the attribute declaration
+    * 4. attribute group references:
+    *   - the attribute group definition
+    * 5. particles:
+    *   - the term of the particle (e.g. a model group)
+    * 6. IDC key-references:
+    *   - the referenced IDC 'key' or 'unique' definition
+    */        
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	switch (item->type) {
+	    case XML_SCHEMA_TYPE_ELEMENT:
+		xmlSchemaResolveElementReferences(
+		    (xmlSchemaElementPtr) item, pctxt);
+		FIXHFAILURE;
+		break;
+	    case XML_SCHEMA_TYPE_COMPLEX:
+	    case XML_SCHEMA_TYPE_SIMPLE:
+		xmlSchemaResolveTypeReferences(
+		    (xmlSchemaTypePtr) item, pctxt, NULL);
+		FIXHFAILURE;
+		break;
+	    case XML_SCHEMA_TYPE_ATTRIBUTE:
+		xmlSchemaResolveAttrReferences(
+		    (xmlSchemaAttributePtr) item, pctxt, NULL);
+		FIXHFAILURE;
+		break;
+	    case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
+		xmlSchemaResolveAttrGroupReferences(
+		    (xmlSchemaAttributeGroupPtr) item, pctxt, NULL);
+		FIXHFAILURE;
+		break;
+	    case XML_SCHEMA_TYPE_PARTICLE:
+		xmlSchemaResolveParticleReferences(
+		    (xmlSchemaTreeItemPtr) item, pctxt, NULL);
+		FIXHFAILURE;
+		break;
+	    case XML_SCHEMA_TYPE_IDC_KEY:
+	    case XML_SCHEMA_TYPE_IDC_UNIQUE:
+	    case XML_SCHEMA_TYPE_IDC_KEYREF:
+		xmlSchemaResolveIDCKeyReferences(
+		    (xmlSchemaIDCPtr) item, pctxt, NULL);
+		FIXHFAILURE;
+		break;
+	    default:
+		break;
+	}
+    }
+    if (pctxt->nberrors != 0)
+	goto exit_error;
+    
+    /*
+    * Now that all references are resolved we
+    * can check for circularity of...
+    * 1. the base axis of type definitions 
+    * 2. nested model group definitions
+    * 3. nested attribute group definitions
+    * TODO: check for circual substitution groups.
+    */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	/*
+	* Let's better stop on the first error here.
+	*/
+	switch (item->type) {
+	    case XML_SCHEMA_TYPE_COMPLEX:
+	    case XML_SCHEMA_TYPE_SIMPLE:
+		xmlSchemaCheckTypeDefCircular(
+		    (xmlSchemaTypePtr) item, pctxt);
+		FIXHFAILURE;
+		if (pctxt->nberrors != 0)
+		    goto exit_error;
+		break;
+	    case XML_SCHEMA_TYPE_GROUP:
+		xmlSchemaCheckGroupDefCircular(
+		    (xmlSchemaModelGroupDefPtr) item, pctxt);
+		FIXHFAILURE;
+		if (pctxt->nberrors != 0)
+		    goto exit_error;
+		break;
+	    case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
+		xmlSchemaCheckAttrGroupCircular(
+		    (xmlSchemaAttributeGroupPtr) item, pctxt);
+		FIXHFAILURE;
+		if (pctxt->nberrors != 0)
+		    goto exit_error;
+		break;
+	    default:
+		break;
+	}	
+    }
+    /*
+    * Model group definition references:
+    * Such a reference is reflected by a particle at the component
+    * level. Until now the 'term' of such particles pointed
+    * to the model group definition; this was done, in order to
+    * ease circularity checks. Now we need to set the 'term' of
+    * such particles to the model group of the model group definition.
+    */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	if ((item->type == XML_SCHEMA_TYPE_PARTICLE) &&
+	    (item->children != NULL) &&
+	    (item->children->type == XML_SCHEMA_TYPE_GROUP)) {
+	    xmlSchemaGroupDefReferenceTermFixup(
+		(xmlSchemaParticlePtr) item, pctxt, NULL);
+	    FIXHFAILURE;
+	}
+    }
+    if (pctxt->nberrors != 0)
+	goto exit_error;
+    /*
+    * Now that all references are resolved, no circularity occured
+    * and the 'term's of particles was fixed we can:
+    * 1. finish computation of properties of types
+    * 2. restrict type definitions and check those restrictions
+    * 3. extend type definitions and check those extensions
+    *
+    * This is the most complex part during schema construction.
+    * TODO: Maybe it would be better to stop at the first error here.
+    */
+    /* 
+    * First compute the variety of simple types. This is needed as
+    * a seperate step, since otherwise we won't be able to detect
+    * circular union types in all cases.
+    */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	switch (item->type) {
+            case XML_SCHEMA_TYPE_SIMPLE:
+		if (TYPE_IS_NOT_FIXEDUP_1((xmlSchemaTypePtr) item)) {
+		    xmlSchemaFixupSimpleTypeStageOne(pctxt,
+			(xmlSchemaTypePtr) item);
+		    FIXHFAILURE;
+		}
+		break;
+	    default:
+		break;
+	}
+    }
+    /*
+    * Detect circular union types. Note that this needs the variety to
+    * be already computed.
+    */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	switch (item->type) {
+            case XML_SCHEMA_TYPE_SIMPLE:
+		if (((xmlSchemaTypePtr) item)->memberTypes != NULL) {
+		    xmlSchemaCheckUnionTypeDefCircular(pctxt,	
+			(xmlSchemaTypePtr) item);
+		    FIXHFAILURE;
+		}
+		break;
+	    default:
+		break;
+	}
+    }
+    if (pctxt->nberrors != 0)
+	goto exit_error;
+    /* Now do the complete type fixup. */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	switch (item->type) {
+            case XML_SCHEMA_TYPE_SIMPLE:
+	    case XML_SCHEMA_TYPE_COMPLEX:
+		xmlSchemaTypeFixup((xmlSchemaTypePtr) item, pctxt);
+		FIXHFAILURE;
+		break;
+	    default:
+		break;
+	}
+    }
+    if (pctxt->nberrors != 0)
+	goto exit_error;
+    
+    /*
+    * Now that we are sure the type definitions are finally constructed,
+    * we can:
+    * 1. check value contraint values of attribute declarations
+    * 2. apply various constraints to element declarations
+    */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	switch (item->type) {
+	    case XML_SCHEMA_TYPE_ATTRIBUTE:
+		if (((xmlSchemaAttributePtr)item)->defValue != NULL) {
+		    xmlSchemaCheckAttrValConstr(
+			(xmlSchemaAttributePtr) item, pctxt);
+		    FIXHFAILURE;
+		}
+		break;
+	    case XML_SCHEMA_TYPE_ELEMENT:
+		if ((((xmlSchemaElementPtr) item)->flags & 
+		    XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) {
+		    xmlSchemaCheckElementDeclComponent(
+			(xmlSchemaElementPtr) item, pctxt);
+		    FIXHFAILURE;
+		}
+		break;
+	    default:
+		break;
+	}
+    }
+    if (pctxt->nberrors != 0)
+	goto exit_error;
+    /*
+    * Finally we can build the automaton from the content model of
+    * complex types.
+    */
+    for (i = 0; i < nbItems; i++) {
+	item = items[i];
+	switch (item->type) {
+	    case XML_SCHEMA_TYPE_COMPLEX:
+		xmlSchemaBuildContentModel((xmlSchemaTypePtr) item, pctxt);
+		FIXHFAILURE;
+		break;
+	    default:
+		break;
+	}
+    }
+    if (pctxt->nberrors != 0)
+	goto exit_error;
+
+    /*
+    * URGENT TODO: cos-element-consistent, cos-all-limited
+    */    
+    con->pending->nbItems = 0;
+    return(0);
+exit_error:
+    con->pending->nbItems = 0;
+    return(pctxt->err);
+exit_failure:
+    con->pending->nbItems = 0;
+    return(-1);
+}
 /**
  * xmlSchemaParse:
  * @ctxt:  a schema validation context
@@ -18159,10 +18926,9 @@
 xmlSchemaPtr
 xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
 {
-    xmlSchemaPtr ret = NULL;
-    xmlDocPtr doc;
-    xmlNodePtr root;
-    int preserve = 0;
+    xmlSchemaPtr schema = NULL;
+    xmlSchemaBucketPtr bucket = NULL;
+    int res;
 
     /*
     * This one is used if the schema to be parsed was specified via
@@ -18174,187 +18940,106 @@
     if (ctxt == NULL)
         return (NULL);
 
+    /* TODO: Init the context. Is this all we need?*/
     ctxt->nberrors = 0;
+    ctxt->err = 0;
     ctxt->counter = 0;
-    ctxt->container = NULL;
 
+    /* Create the *main* schema. */
+    schema = xmlSchemaNewSchema(ctxt);
+    if (schema == NULL)
+	goto exit_failure;
     /*
-     * First step is to parse the input document into an DOM/Infoset
-     */
-    if (ctxt->URL != NULL) {
-        doc = xmlReadFile((const char *) ctxt->URL, NULL,
-	                  SCHEMAS_PARSE_OPTIONS);
-        if (doc == NULL) {
-	    xmlSchemaPErr(ctxt, NULL,
-			  XML_SCHEMAP_FAILED_LOAD,
-                          "xmlSchemaParse: could not load '%s'.\n",
-                          ctxt->URL, NULL);
-            return (NULL);
-        }
-    } else if (ctxt->buffer != NULL) {
-        doc = xmlReadMemory(ctxt->buffer, ctxt->size, NULL, NULL,
-	                    SCHEMAS_PARSE_OPTIONS);
-        if (doc == NULL) {
-	    xmlSchemaPErr(ctxt, NULL,
-			  XML_SCHEMAP_FAILED_PARSE,
-                          "xmlSchemaParse: could not parse.\n",
-                          NULL, NULL);
-            return (NULL);
-        }
-        doc->URL = xmlStrdup(BAD_CAST "in_memory_buffer");
-        ctxt->URL = xmlDictLookup(ctxt->dict, BAD_CAST "in_memory_buffer", -1);
-    } else if (ctxt->doc != NULL) {
-        doc = ctxt->doc;
-	preserve = 1;
-    } else {
-	xmlSchemaPErr(ctxt, NULL,
-		      XML_SCHEMAP_NOTHING_TO_PARSE,
-		      "xmlSchemaParse: could not parse.\n",
-		      NULL, NULL);
-        return (NULL);
+    * Create the schema constructor.
+    */
+    if (ctxt->constructor == NULL) {
+	ctxt->constructor = xmlSchemaConstructionCtxtCreate(ctxt->dict);
+	if (ctxt->constructor == NULL)
+	    return(NULL);
+	/* Take ownership of the constructor to be able to free it. */
+	ctxt->ownsConstructor = 1;
     }
-
+    ctxt->constructor->schema = schema;
     /*
-     * Then extract the root and Schema parse it
-     */
-    root = xmlDocGetRootElement(doc);
-    if (root == NULL) {
-	xmlSchemaPErr(ctxt, (xmlNodePtr) doc,
-		      XML_SCHEMAP_NOROOT,
-		      "The schema has no document element.\n", NULL, NULL);
-	if (!preserve) {
-	    xmlFreeDoc(doc);
-	}
-        return (NULL);
-    }
+    * Locate and add the schema document.
+    */
+    res = xmlSchemaAddSchemaDoc(ctxt, XML_SCHEMA_SCHEMA_MAIN,
+	ctxt->URL, ctxt->doc, ctxt->buffer, ctxt->size, NULL,
+	NULL, NULL, &bucket);
+    if (res == -1)
+	goto exit_failure;
+    if (res != 0)
+	goto exit;
 
-    /*
-     * Remove all the blank text nodes
-     */
-    xmlSchemaCleanupDoc(ctxt, root);
-
-    /*
-     * Then do the parsing for good
-     */
-    ret = xmlSchemaParseSchema(ctxt, root);
-    if (ret == NULL) {
-        if (!preserve) {
-	    xmlFreeDoc(doc);
-	}
-        return (NULL);
+    if (bucket == NULL) {
+	/* TODO: Error code, actually we failed to *locate* the schema. */
+	if (ctxt->URL) 
+	    xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_FAILED_LOAD,
+		NULL, NULL,
+		"Failed to locate the main schema resource at '%s'",
+		ctxt->URL, NULL);
+	else
+	    xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_FAILED_LOAD,
+		NULL, NULL,
+		"Failed to locate the main schema resource",
+		    NULL, NULL);
+	goto exit;
     }
-    ret->doc = doc;
-    ret->preserve = preserve;
-    ctxt->schema = ret;
-    ctxt->ctxtType = NULL;
-    ctxt->parentItem = NULL;
-
-    /*
-    * Resolve base types of simple/complex types.
-    */
-    xmlHashScan(ret->typeDecl, (xmlHashScanner) xmlSchemaResolveTypeDefs, ctxt);
-
+    /* Set the main schema bucket. */
+    ctxt->constructor->bucket = bucket;
+    ctxt->targetNamespace = bucket->targetNamespace;    
+    schema->targetNamespace = bucket->targetNamespace;
+    
+    /* Then do the parsing for good. */
+    if (xmlSchemaParseNewDocWithContext(ctxt, schema, bucket) == -1)
+	goto exit_failure;
     if (ctxt->nberrors != 0)
 	goto exit;
 
-    if (ret->volatiles != NULL) {
-	xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) ret->volatiles;
-	int i;
-	xmlSchemaTreeItemPtr item;
+    schema->doc = bucket->doc;
+    schema->preserve = ctxt->preserve;
 
-	for (i = 0; i < list->nbItems; i++) {
-	    item = (xmlSchemaTreeItemPtr) list->items[i];
-	    if (item->type == XML_SCHEMA_TYPE_PARTICLE)
-		xmlSchemaMiscRefFixup(item, ctxt, NULL);
-	}
-    }
+    ctxt->schema = schema;
+
+    if (xmlSchemaFixupComponents(ctxt) == -1)
+	goto exit_failure;
+
     /*
-     * Then fixup all attributes declarations
-     */
-    xmlHashScan(ret->attrDecl, (xmlHashScanner) xmlSchemaAttrFixup, ctxt);
-    /*
-     * Then fixup all attributes group declarations
-     */
-    xmlHashScan(ret->attrgrpDecl, (xmlHashScanner) xmlSchemaAttrGrpFixup,
-                ctxt);
-    /*
-    * Resolve identity-constraint keyRefs.
+    * TODO: This is not nice, since we cannot distinguish from the
+    * result if there was an internal error or not.
     */
-    xmlHashScan(ret->idcDef, (xmlHashScanner) xmlSchemaResolveIDCKeyRef, ctxt);
-    /*
-    * Check type defnitions for circular references.
-    */
-    xmlHashScan(ret->typeDecl, (xmlHashScanner)
-	xmlSchemaCheckTypeDefCircular, ctxt);
-    /*
-    * Check model groups defnitions for circular references.
-    */
-    xmlHashScan(ret->groupDecl, (xmlHashScanner)
-	xmlSchemaCheckGroupDefCircular, ctxt);
-    /*
-    * Set the "term" of particles pointing to model group definitions
-    * to the contained model group.
-    */
-    if (ret->volatiles != NULL) {
-	xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) ret->volatiles;
-	int i;
-	xmlSchemaParticlePtr item;
-
-	for (i = 0; i < list->nbItems; i++) {
-	    item = (xmlSchemaParticlePtr) list->items[i];
-	    if (item->type == XML_SCHEMA_TYPE_PARTICLE)
-		xmlSchemaGroupDefTermFixup(item, ctxt, NULL);
+exit:       
+    if (ctxt->nberrors != 0) {	
+	if (schema) {
+	    xmlSchemaFree(schema);
+	    schema = NULL;
 	}
+	if (ctxt->constructor) {
+	    xmlSchemaConstructionCtxtFree(ctxt->constructor);
+	    ctxt->constructor = NULL;
+	    ctxt->ownsConstructor = 0;
+	}
     }
-    /*
-    * Check attribute groups for circular references.
+    ctxt->schema = NULL;
+    return(schema);
+exit_failure:
+    /* 
+    * Quite verbose, but should catch internal errors, which were
+    * not communitated.
     */
-    xmlHashScan(ret->attrgrpDecl, (xmlHashScanner)
-	xmlSchemaCheckAttributeGroupCircular, ctxt);
-    /*
-     * Then fix references of element declaration; apply constraints.
-     */
-    xmlHashScanFull(ret->elemDecl,
-                    (xmlHashScannerFull) xmlSchemaElementFixup, ctxt);
-    /*
-    * We will stop here if the schema was not valid to avoid internal errors
-    * on missing sub-components. This is not conforming to the spec, since it
-    * allows missing components, but it might make further processing crash.
-    * So see it as a very strict handling, which might be made more lax in the
-    * future.
-    */
-    if (ctxt->nberrors != 0)
-	goto exit;
-    /*
-     * Then fixup all types properties
-     */
-    xmlHashScan(ret->typeDecl, (xmlHashScanner) xmlSchemaTypeFixup, ctxt);
-    /*
-    * Validate the value constraint of attribute declarations/uses.
-    */
-    xmlHashScan(ret->attrDecl, (xmlHashScanner) xmlSchemaCheckAttrValConstr, ctxt);
-    /*
-    * Validate the value constraint of element declarations.
-    */
-    xmlHashScan(ret->elemDecl, (xmlHashScanner) xmlSchemaCheckElementDeclComponent, ctxt);
-
-    if (ctxt->nberrors != 0)
-	goto exit;
-
-    /*
-    * TODO: cos-element-consistent, cos-all-limited
-    *
-    * Then build the content model for all complex types
-    */
-    xmlHashScan(ret->typeDecl,
-                (xmlHashScanner) xmlSchemaBuildContentModel, ctxt);
-
-exit:
-    if (ctxt->nberrors != 0) {
-        xmlSchemaFree(ret);
-        ret = NULL;
+    if (schema) {
+        xmlSchemaFree(schema);
+	schema = NULL;
     }
-    return (ret);
+    if (ctxt->constructor) {
+	xmlSchemaConstructionCtxtFree(ctxt->constructor);
+	ctxt->constructor = NULL;
+	ctxt->ownsConstructor = 0;
+    }
+    PERROR_INT2("xmlSchemaParse",
+	"An internal error occured");    
+    ctxt->schema = NULL;
+    return(NULL);
 }
 
 /**
@@ -18504,154 +19189,6 @@
  * 									*
  ************************************************************************/
 
-static void
-xmlSchemaPostSchemaAssembleFixup(xmlSchemaParserCtxtPtr ctxt)
-{
-    int i, nbItems;
-    xmlSchemaTypePtr item, *items;
-
-
-    /*
-    * During the Assemble of the schema ctxt->curItems has
-    * been filled with the relevant new items. Fix those up.
-    */
-    nbItems = ctxt->assemble->nbItems;
-    items = (xmlSchemaTypePtr *) ctxt->assemble->items;
-
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	switch (item->type) {
-	    case XML_SCHEMA_TYPE_COMPLEX:
-	    case XML_SCHEMA_TYPE_SIMPLE:
-		xmlSchemaResolveTypeDefs(item, ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_ATTRIBUTE:
-		xmlSchemaAttrFixup((xmlSchemaAttributePtr) item, ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
-		xmlSchemaAttrGrpFixup((xmlSchemaAttributeGroupPtr) item,
-		    ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_PARTICLE:
-		xmlSchemaMiscRefFixup((xmlSchemaTreeItemPtr) item, ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_IDC_KEY:
-	    case XML_SCHEMA_TYPE_IDC_UNIQUE:
-	    case XML_SCHEMA_TYPE_IDC_KEYREF:
-		xmlSchemaResolveIDCKeyRef((xmlSchemaIDCPtr) item, ctxt, NULL);
-		break;
-	    default:
-		break;
-	}
-    }
-    if (ctxt->nberrors != 0)
-	return;
-    /*
-    * Circularity checks.
-    */
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	switch (item->type) {
-	    case XML_SCHEMA_TYPE_COMPLEX:
-	    case XML_SCHEMA_TYPE_SIMPLE:
-		xmlSchemaCheckTypeDefCircular(
-		    (xmlSchemaTypePtr) item, ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_GROUP:
-		xmlSchemaCheckGroupDefCircular(
-		    (xmlSchemaModelGroupDefPtr) item, ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_ATTRIBUTEGROUP:
-		xmlSchemaCheckAttributeGroupCircular(
-		    (xmlSchemaAttributeGroupPtr) item, ctxt, NULL);
-		break;
-	    default:
-		break;
-	}
-    }
-    if (ctxt->nberrors != 0)
-	return;
-    /*
-    * Set the "term" of particles pointing to model group definitions
-    * to the contained model group.
-    */
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	if ((item->type == XML_SCHEMA_TYPE_PARTICLE) &&
-	    (((xmlSchemaParticlePtr) item)->children != NULL) &&
-	    (((xmlSchemaParticlePtr) item)->children->type ==
-	    XML_SCHEMA_TYPE_GROUP)) {
-	    xmlSchemaGroupDefTermFixup((xmlSchemaParticlePtr) item,
-		ctxt, NULL);
-	}
-    }
-    if (ctxt->nberrors != 0)
-	return;
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	switch (item->type) {
-	    case XML_SCHEMA_TYPE_ELEMENT:
-		xmlSchemaElementFixup((xmlSchemaElementPtr) item, ctxt,
-		    NULL, NULL, NULL);
-		break;
-	    default:
-		break;
-	}
-    }
-    if (ctxt->nberrors != 0)
-	return;
-
-    /*
-    * Fixup for simple/complex types.
-    */
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	switch (item->type) {
-            case XML_SCHEMA_TYPE_SIMPLE:
-	    case XML_SCHEMA_TYPE_COMPLEX:
-		xmlSchemaTypeFixup(item, ctxt, NULL);
-		break;
-	    default:
-		break;
-	}
-    }
-    if (ctxt->nberrors != 0)
-	return;
-    /*
-    * Validate value contraint values.
-    */
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	switch (item->type) {
-	    case XML_SCHEMA_TYPE_ATTRIBUTE:
-		xmlSchemaCheckAttrValConstr((xmlSchemaAttributePtr) item,
-		    ctxt, NULL);
-		break;
-	    case XML_SCHEMA_TYPE_ELEMENT:
-		xmlSchemaCheckElementDeclComponent((xmlSchemaElementPtr) item,
-		    ctxt, NULL);
-		break;
-	    default:
-		break;
-	}
-    }
-    if (ctxt->nberrors != 0)
-	return;
-    /*
-    * Build the content model for complex types.
-    */
-    for (i = 0; i < nbItems; i++) {
-	item = items[i];
-	switch (item->type) {
-	    case XML_SCHEMA_TYPE_COMPLEX:
-		xmlSchemaBuildContentModel(item, ctxt, NULL);
-		break;
-	    default:
-		break;
-	}
-    }
-}
-
 /**
  * xmlSchemaAssembleByLocation:
  * @pctxt:  a schema parser context
@@ -18673,108 +19210,89 @@
 			    const xmlChar *nsName,
 			    const xmlChar *location)
 {
-    const xmlChar *targetNs, *oldtns;
-    xmlDocPtr doc, olddoc;
-    int oldflags, ret = 0, oldIsS4S;
-    xmlNodePtr docElem;
+    int ret = 0;
     xmlSchemaParserCtxtPtr pctxt;
+    xmlSchemaBucketPtr bucket = NULL;
 
-    /*
-    * This should be used:
-    * 1. on <import>(s)
-    * 2. if requested by the validated instance
-    * 3. if requested via the API
-    */
     if ((vctxt == NULL) || (schema == NULL))
 	return (-1);
+
+    if (vctxt->pctxt == NULL) {
+	VERROR_INT("xmlSchemaAssembleByLocation",
+	    "no parser context available");
+	return(-1);
+    }
+    pctxt = vctxt->pctxt;
+    if (pctxt->constructor == NULL) {
+	PERROR_INT("xmlSchemaAssembleByLocation",
+	    "no constructor");
+	return(-1);
+    }
     /*
-    * Create a temporary parser context.
+    * Acquire the schema document.
     */
-    if ((vctxt->pctxt == NULL) &&
-	(xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
-	return (-1);
-    pctxt = vctxt->pctxt;
+    location = xmlSchemaBuildAbsoluteURI(pctxt->dict,
+	location, node);
     /*
-    * Set the counter to produce unique names for anonymous items.
+    * Note that we pass XML_SCHEMA_SCHEMA_IMPORT here;
+    * the process will automatically change this to
+    * XML_SCHEMA_SCHEMA_MAIN if it is the first schema document.
     */
-    pctxt->counter = schema->counter;
+    ret = xmlSchemaAddSchemaDoc(pctxt, XML_SCHEMA_SCHEMA_IMPORT,
+	location, NULL, NULL, 0, node, NULL, nsName, 
+	&bucket);
+    if (ret != 0)
+	return(ret);
+    if (bucket == NULL) {
+	PERROR_INT("xmlSchemaAssembleByLocation",
+	    "no schema bucket aquired");
+	return(-1);
+    } 
     /*
-    * Acquire the schema document.
+    * The first located schema will be handled as if all other
+    * schemas imported by XSI were imported by this first schema.
     */
-    ret = xmlSchemaAcquireSchemaDoc((xmlSchemaAbstractCtxtPtr) vctxt, schema,
-	node, nsName, location, &doc, &targetNs, 0);
-    if (ret != 0) {
-	if (doc != NULL)
-	    xmlFreeDoc(doc);
-    } else if (doc != NULL) {
-	docElem = xmlDocGetRootElement(doc);
-	/*
-	* Create new assemble info.
+    if ((bucket != NULL) &&
+	(WXS_CONSTRUCTOR(pctxt)->bucket == NULL))
+	WXS_CONSTRUCTOR(pctxt)->bucket = bucket;
+    /*
+    * TODO: Is this handled like an import? I.e. is it not an error
+    * if the schema cannot be located?
+    */
+    if ((bucket == NULL) || (! CAN_PARSE_SCHEMA(bucket)))
+	return(0);
+    /*
+    * We will reuse the parser context for every schema imported
+    * directly via XSI. So reset the context.
+    */
+    pctxt->nberrors = 0;
+    pctxt->err = 0;
+    pctxt->doc = bucket->doc;
+    
+    ret = xmlSchemaParseNewDocWithContext(pctxt, schema, bucket);        
+    if (ret == -1) {
+	pctxt->doc = NULL;
+	goto exit_failure;
+    }
+    /* Paranoid error channelling. */
+    if ((ret == 0) && (pctxt->nberrors != 0))
+	ret = pctxt->err;    
+    if (pctxt->nberrors == 0) {
+	/* 
+	* Only bother to fixup pending components, if there was
+	* no error yet.
 	*/
-	if (pctxt->assemble == NULL) {
-	    pctxt->assemble = xmlSchemaNewAssemble();
-	    if (pctxt->assemble == NULL) {
-		xmlSchemaVErrMemory(vctxt,
-		    "Memory error: xmlSchemaAssembleByLocation, "
-		    "allocating assemble info", NULL);
-		xmlFreeDoc(doc);
-		return (-1);
-	    }
-	}
-	/*
-	* Save and reset the context & schema.
-	*/
-	oldflags = schema->flags;
-	oldtns = schema->targetNamespace;
-	olddoc = schema->doc;
-	oldIsS4S = vctxt->pctxt->isS4S;
-
-	xmlSchemaClearSchemaDefaults(schema);
-	schema->targetNamespace = targetNs;
-	if ((targetNs != NULL) &&
-	    xmlStrEqual(targetNs, xmlSchemaNs)) {
-	    /*
-	    * We are parsing the schema for schema!
-	    */
-	    vctxt->pctxt->isS4S = 1;
-	}
-	/* schema->nbCurItems = 0; */
-	pctxt->schema = schema;
-	pctxt->ctxtType = NULL;
-	pctxt->parentItem = NULL;
-
-	xmlSchemaParseSchemaDefaults(pctxt, schema, docElem);
-	if (pctxt->nberrors != 0) {
-	    vctxt->nberrors += pctxt->nberrors;
-	    goto finally;
-	}
-	xmlSchemaParseSchemaTopLevel(pctxt, schema, docElem->children);
-	if (pctxt->nberrors != 0) {
-	    vctxt->nberrors += pctxt->nberrors;
-	    goto finally;
-	}
-	xmlSchemaPostSchemaAssembleFixup(pctxt);
-	if (pctxt->nberrors != 0)
-	    vctxt->nberrors += pctxt->nberrors;
-finally:
-	/*
-	* Set the counter of items.
-	*/
-	schema->counter = pctxt->counter;
-	/*
-	* Free the list of assembled components.
-	*/
-	pctxt->assemble->nbItems = 0;
-	/*
-	* Restore the context & schema.
-	*/
-	vctxt->pctxt->isS4S = oldIsS4S;
-	schema->flags = oldflags;
-	schema->targetNamespace = oldtns;
-	schema->doc = olddoc;
-	ret = pctxt->err;
+	xmlSchemaFixupComponents(pctxt);
+	vctxt->nberrors += pctxt->nberrors;
+    } else {
+	/* Add to validation error sum. */ 
+	vctxt->nberrors += pctxt->nberrors;
     }
-    return (ret);
+    pctxt->doc = NULL;
+    return(ret);
+exit_failure:
+    pctxt->doc = NULL;
+    return (-1);
 }
 
 static xmlSchemaAttrInfoPtr
@@ -18973,8 +19491,7 @@
 		xmlFree(localName);
 		return (1);
 	    }
-	    if (xmlHashLookup2(schema->notaDecl, localName,
-		nsName) != NULL) {
+	    if (xmlSchemaGetNotation(schema, localName, nsName) != NULL) {
 		if (valNeeded && (val != NULL)) {
 		    (*val) = xmlSchemaNewNOTATIONValue(BAD_CAST localName,
 			BAD_CAST xmlStrdup(nsName));
@@ -18986,7 +19503,7 @@
 	    xmlFree(prefix);
 	    xmlFree(localName);
 	} else {
-	    if (xmlHashLookup2(schema->notaDecl, value, NULL) != NULL) {
+	    if (xmlSchemaGetNotation(schema, value, NULL) != NULL) {
 		if (valNeeded && (val != NULL)) {
 		    (*val) = xmlSchemaNewNOTATIONValue(
 			BAD_CAST xmlStrdup(value), NULL);
@@ -19683,16 +20200,19 @@
 	}	
 	if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) {
 	    if (! IS_SIMPLE_TYPE(type)) {
+		xmlChar *str = NULL;
 		/*
 		* Not qualified if the field resolves to a node of non
 		* simple type.
 		*/	
-		xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		xmlSchemaCustomErr(ACTXT_CAST vctxt,
 		    XML_SCHEMAV_CVC_IDC, NULL,		    
 		    (xmlSchemaTypePtr) sto->matcher->aidc->def,
-		    "The field '%s' does evaluate to a node of "
-		    "non-simple type", sto->sel->xpath, NULL);
-		
+		    "The field '%s' of %s does evaluate to a node of "
+		    "non-simple type",
+		    sto->sel->xpath,
+		    xmlSchemaGetIDCDesignation(&str, sto->matcher->aidc->def));
+		FREE_AND_NULL(str);
 		sto->nbHistory--;
 		goto deregister_check;
 	    }
@@ -19771,6 +20291,7 @@
 		    goto create_sequence;
 		} else {
 		    if (keySeq[idx] != NULL) {
+			xmlChar *str = NULL;
 			/*
 			* cvc-identity-constraint:
 			* 3 For each node in the ·target node set· all
@@ -19781,12 +20302,14 @@
 			* 
 			* The key was already set; report an error.
 			*/
-			xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt, 
+			xmlSchemaCustomErr(ACTXT_CAST vctxt, 
 			    XML_SCHEMAV_CVC_IDC, NULL,
 			    (xmlSchemaTypePtr) matcher->aidc->def,
-			    "The field '%s' evaluates to a node-set "
+			    "The field '%s' of %s evaluates to a node-set "
 			    "with more than one member",
-			    sto->sel->xpath, NULL);
+			    sto->sel->xpath,
+			    xmlSchemaGetIDCDesignation(&str, matcher->aidc->def));
+			FREE_AND_NULL(str);
 			sto->nbHistory--;
 			goto deregister_check;
 		    } else {
@@ -19939,17 +20462,19 @@
 		    i++;
 		} while (i < bind->nbNodes);
 		if (i != bind->nbNodes) {
-		    xmlChar *str = NULL;
+		    xmlChar *str = NULL, *strB = NULL;
 		    /*   
 		    * TODO: Try to report the key-sequence.
 		    */
-		    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt, 
+		    xmlSchemaCustomErr(ACTXT_CAST vctxt, 
 			XML_SCHEMAV_CVC_IDC, NULL,
 			(xmlSchemaTypePtr) idc,
-			"Duplicate key-sequence %s",
+			"Duplicate key-sequence %s in %s",
 			xmlSchemaFormatIDCKeySequence(vctxt, &str,
-			    (*keySeq), nbKeys), NULL);
-		    FREE_AND_NULL(str)
+			    (*keySeq), nbKeys),
+			xmlSchemaGetIDCDesignation(&strB, idc));
+		    FREE_AND_NULL(str);
+		    FREE_AND_NULL(strB);
 		    goto selector_leave;
 		}
 	    }
@@ -20014,14 +20539,21 @@
 	    
 	    goto selector_leave;
 selector_key_error:
-	    /*
-	    * 4.2.1 (KEY) The ·target node set· and the 
-	    * ·qualified node set· are equal, that is, every 
-	    * member of the ·target node set· is also a member
-	    * of the ·qualified node set· and vice versa.
-	    */
-	    VERROR(XML_SCHEMAV_CVC_IDC, (xmlSchemaTypePtr) idc,
-		"All 'key' fields must evaluate to a node");
+	    {
+		xmlChar *str = NULL;
+		/*
+		* 4.2.1 (KEY) The ·target node set· and the 
+		* ·qualified node set· are equal, that is, every 
+		* member of the ·target node set· is also a member
+		* of the ·qualified node set· and vice versa.
+		*/
+		xmlSchemaCustomErr(ACTXT_CAST vctxt, 
+		    XML_SCHEMAV_CVC_IDC, NULL,
+		    (xmlSchemaTypePtr) idc,
+		    "Not all fields of %s evaluate to a node",
+		    xmlSchemaGetIDCDesignation(&str, idc), NULL);
+		FREE_AND_NULL(str);
+	    }
 selector_leave:
 	    /*
 	    * Free the key-sequence if not added to the IDC table.
@@ -21046,7 +21578,7 @@
 	*/
 	if (nsName == NULL) {
 	    ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1;
-	    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt, ret, NULL,
+	    xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL,
 		xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME),
 		"The QName value '%s' has no "
 		"corresponding namespace declaration in "
@@ -21430,7 +21962,7 @@
     if (ret == -1)
 	return (-1);
     if (ret > 0) {
-	xmlSchemaSimpleTypeErr((xmlSchemaAbstractCtxtPtr) vctxt,
+	xmlSchemaSimpleTypeErr(ACTXT_CAST vctxt,
 	    XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, NULL,
 	    value, xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME), 1);
 	return (1);
@@ -21459,7 +21991,7 @@
 	    * A namespace must be found if the prefix is NOT NULL.
 	    */
 	    if (*nsName == NULL) {
-		xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		xmlSchemaCustomErr(ACTXT_CAST vctxt,
 		    XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, NULL,
 		    xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME),
 		    "The QName value '%s' has no "
@@ -21521,7 +22053,7 @@
 	if (*localType == NULL) {
 	    xmlChar *str = NULL;
 
-	    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+	    xmlSchemaCustomErr(ACTXT_CAST vctxt,
 		XML_SCHEMAV_CVC_ELT_4_2, NULL,
 		xmlSchemaGetBuiltInType(XML_SCHEMAS_QNAME),
 		"The QName value '%s' of the xsi:type attribute does not "
@@ -21563,7 +22095,7 @@
 		elemDecl->subtypes, set) != 0) {
 		xmlChar *str = NULL;
 
-		xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		xmlSchemaCustomErr(ACTXT_CAST vctxt,
 		    XML_SCHEMAV_CVC_ELT_4_3, NULL, NULL,
 		    "The type definition '%s', specified by xsi:type, is "
 		    "blocked or not validly derived from the type definition "
@@ -21628,7 +22160,7 @@
 	    * Validate the value.
 	    */
 	    ret = xmlSchemaVCheckCVCSimpleType(
-		(xmlSchemaAbstractCtxtPtr) vctxt, NULL,
+		ACTXT_CAST vctxt, NULL,
 		xmlSchemaGetBuiltInType(XML_SCHEMAS_BOOLEAN),
 		iattr->value, &(iattr->val), 1, 0, 0);
 	    ACTIVATE_ELEM;
@@ -21732,7 +22264,7 @@
 	iattr = vctxt->attrInfos[i];
 	if (! iattr->metaType) {
 	    ACTIVATE_ATTRIBUTE(iattr)
-	    xmlSchemaIllegalAttrErr((xmlSchemaAbstractCtxtPtr) vctxt,
+	    xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
 		XML_SCHEMAV_CVC_TYPE_3_1_1, iattr, NULL);
 	    ret = XML_SCHEMAV_CVC_TYPE_3_1_1;
         }
@@ -22204,12 +22736,12 @@
 	    * Request a computed value.
 	    */
 	    res = xmlSchemaVCheckCVCSimpleType(
-		(xmlSchemaAbstractCtxtPtr) vctxt,
+		ACTXT_CAST vctxt,
 		attr->node, attr->typeDef, attr->value, &(attr->val),
 		1, 1, 0);
 	} else {
 	    res = xmlSchemaVCheckCVCSimpleType(
-		(xmlSchemaAbstractCtxtPtr) vctxt,
+		ACTXT_CAST vctxt,
 		attr->node, attr->typeDef, attr->value, NULL,
 		1, 0, 0);
 	}
@@ -22318,7 +22850,7 @@
 	    case XML_SCHEMAS_ATTR_ERR_MISSING: {
 		    xmlChar *str = NULL;
 		    ACTIVATE_ELEM;
-		    xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		    xmlSchemaCustomErr(ACTXT_CAST vctxt,
 			XML_SCHEMAV_CVC_COMPLEX_TYPE_4, NULL, NULL,
 			"The attribute '%s' is required but missing",
 			xmlSchemaFormatQName(&str,
@@ -22333,7 +22865,7 @@
 		    "The type definition is absent");
 		break;
 	    case XML_SCHEMAS_ATTR_ERR_FIXED_VALUE:
-		xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		xmlSchemaCustomErr(ACTXT_CAST vctxt,
 		    XML_SCHEMAV_CVC_AU, NULL, NULL,
 		    "The value '%s' does not match the fixed "
 		    "value constraint '%s'", 
@@ -22352,10 +22884,10 @@
 		* for the following errors.
 		*/
 		if (type->attributeWildcard == NULL) {
-		    xmlSchemaIllegalAttrErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		    xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
 			XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, attr, NULL);
 		} else {
-		    xmlSchemaIllegalAttrErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		    xmlSchemaIllegalAttrErr(ACTXT_CAST vctxt,
 			XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, attr, NULL);
 		}
 		break;
@@ -22398,9 +22930,8 @@
     {
 	xmlSchemaElementPtr decl = NULL;
 
-	decl = xmlHashLookup3(vctxt->schema->elemDecl,
-	    vctxt->inode->localName, vctxt->inode->nsName,
-	    NULL);
+	decl = xmlSchemaGetElem(vctxt->schema,
+	    vctxt->inode->localName, vctxt->inode->nsName);	    
 	if (decl != NULL) {
 	    vctxt->inode->decl = decl;
 	    return (0);
@@ -22503,12 +23034,12 @@
     */  
     if (IS_SIMPLE_TYPE(inode->typeDef)) {
 
-	ret = xmlSchemaVCheckCVCSimpleType((xmlSchemaAbstractCtxtPtr) vctxt,
+	ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
 	    NULL, inode->typeDef, value, val, 1, 1, 0);
 
     } else if (HAS_SIMPLE_CONTENT(inode->typeDef)) {
 
-	ret = xmlSchemaVCheckCVCSimpleType((xmlSchemaAbstractCtxtPtr) vctxt,
+	ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt,
 	    NULL, inode->typeDef->contentTypeDef, value, val, 1, 1, 0);
     }
     if (ret < 0) {
@@ -22567,11 +23098,11 @@
 {
     if (inode->flags & XML_SCHEMA_NODE_INFO_VALUE_NEEDED)
 	return (xmlSchemaVCheckCVCSimpleType(
-	    (xmlSchemaAbstractCtxtPtr) vctxt, NULL,
+	    ACTXT_CAST vctxt, NULL,
 	    type, value, &(inode->val), 1, 1, 0));
     else
 	return (xmlSchemaVCheckCVCSimpleType(
-	    (xmlSchemaAbstractCtxtPtr) vctxt, NULL,
+	    ACTXT_CAST vctxt, NULL,
 	    type, value, NULL, 1, 0, 0));
 }
 
@@ -22654,7 +23185,7 @@
 		ret = 1;
 		inode->flags |=
 		    XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT;
-		xmlSchemaComplexTypeErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
 		    XML_SCHEMAV_ELEMENT_CONTENT, NULL, NULL,
 		    "Missing child element(s)",
 		    nbval, nbneg, values);
@@ -22889,7 +23420,7 @@
 			* VAL TODO: Implement the canonical stuff.
 			*/
 			ret = XML_SCHEMAV_CVC_ELT_5_2_2_2_1;
-			xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt, 
+			xmlSchemaCustomErr(ACTXT_CAST vctxt, 
 			    ret, NULL, NULL,
 			    "The initial value '%s' does not match the fixed "
 			    "value constraint '%s'",
@@ -22912,7 +23443,7 @@
 		    if (! xmlStrEqual(inode->value,
 			    inode->decl->value)) {
 			ret = XML_SCHEMAV_CVC_ELT_5_2_2_2_2;
-			xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) vctxt,
+			xmlSchemaCustomErr(ACTXT_CAST vctxt,
 			    ret, NULL, NULL,
 			    "The actual value '%s' does not match the fixed "
 			    "value constraint '%s'", 
@@ -23183,7 +23714,7 @@
 	    if (ret < 0) {
 		xmlRegExecErrInfo(regexCtxt, NULL, &nbval, &nbneg,
 		    &values[0], &terminal);
-		xmlSchemaComplexTypeErr((xmlSchemaAbstractCtxtPtr) vctxt,
+		xmlSchemaComplexTypeErr(ACTXT_CAST vctxt,
 		    XML_SCHEMAV_ELEMENT_CONTENT, NULL,NULL,
 		    "This element is not expected",
 		    nbval, nbneg, values);
@@ -23377,6 +23908,10 @@
 	goto internal_error;
     }
     if (vctxt->xsiAssemble) {
+	/* 
+	* URGENT TODO: Better to fully stop validation
+	* if there was an error during dynamic schema construction.
+	*/
 	if (xmlSchemaAssembleByXSI(vctxt) == -1)
 	    goto internal_error;
     }
@@ -23488,11 +24023,13 @@
     * during validation against the declaration. This must be done
     * _before_ attribute validation.
     */
-    ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE);
-    if (ret == -1) {
-	VERROR_INT("xmlSchemaValidateElem",
-	    "calling xmlSchemaXPathEvaluate()");
-	goto internal_error;
+    if (vctxt->xpathStates != NULL) {
+	ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE);
+	if (ret == -1) {
+	    VERROR_INT("xmlSchemaValidateElem",
+		"calling xmlSchemaXPathEvaluate()");
+	    goto internal_error;
+	}
     }
     /*
     * Validate attributes.
@@ -24477,24 +25014,43 @@
     vctxt->nberrors = 0;
     vctxt->depth = -1;
     vctxt->skipDepth = -1;
+    vctxt->xsiAssemble = 0;
     /*
     * Create a schema + parser if necessary.
     */
     if (vctxt->schema == NULL) {
-
+	xmlSchemaParserCtxtPtr pctxt;
+	
+	vctxt->xsiAssemble = 1;
+	/* 
+	* If not schema was given then we will create a schema
+	* dynamically using XSI schema locations.
+	*
+	* Create the schema parser context.
+	*/
 	if ((vctxt->pctxt == NULL) &&
 	   (xmlSchemaCreatePCtxtOnVCtxt(vctxt) == -1))
 	   return (-1);
-
-	vctxt->schema = xmlSchemaNewSchema(vctxt->pctxt);
-	if (vctxt->schema == NULL) {
-	    VERROR_INT("xmlSchemaVStartValidation",
-		    "creating a schema");
-	    return (-1);
-	}
-	vctxt->xsiAssemble = 1;
-    } else
-	vctxt->xsiAssemble = 0;
+	pctxt = vctxt->pctxt;
+	pctxt->xsiAssemble = 1;
+	/*
+	* Create the schema.
+	*/
+	vctxt->schema = xmlSchemaNewSchema(pctxt);
+	if (vctxt->schema == NULL)
+	    return (-1);		
+	/* 
+	* Create the schema construction context.
+	*/
+	pctxt->constructor = xmlSchemaConstructionCtxtCreate(pctxt->dict);
+	if (pctxt->constructor == NULL)
+	    return(-1);
+	pctxt->constructor->schema = vctxt->schema;
+	/*
+	* Take ownership of the constructor to be able to free it.
+	*/
+	pctxt->ownsConstructor = 1;
+    }	
     /*
     * Augment the IDC definitions.
     */
@@ -24544,7 +25100,7 @@
 	 */
 	ret = xmlParseDocument(vctxt->parserCtxt);
     } else {
-	VERROR_INT("xmlSchemaVStartValidation",
+	VERROR_INT("xmlSchemaVStart",
 	    "no instance to validate");
 	ret = -1;
     }
@@ -24599,7 +25155,7 @@
     ctxt->doc = doc;
     ctxt->node = xmlDocGetRootElement(doc);
     if (ctxt->node == NULL) {
-        xmlSchemaCustomErr((xmlSchemaAbstractCtxtPtr) ctxt,
+        xmlSchemaCustomErr(ACTXT_CAST ctxt,
 	    XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING,
 	    (xmlNodePtr) doc, NULL,
 	    "The document has no document element", NULL, NULL);

Modified: packages/libxml2/trunk/xstc/Makefile.in
===================================================================
--- packages/libxml2/trunk/xstc/Makefile.in	2005-09-13 09:59:17 UTC (rev 477)
+++ packages/libxml2/trunk/xstc/Makefile.in	2005-09-13 16:06:20 UTC (rev 478)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,6 +33,7 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
 subdir = xstc
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -229,6 +230,8 @@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -379,7 +382,7 @@
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"




More information about the debian-xml-sgml-commit mailing list