try to cope with the fact that apps may still have allocated smaller SAX

* parser.c: try to cope with the fact that apps may still
  have allocated smaller SAX callbak block
Daniel
diff --git a/ChangeLog b/ChangeLog
index 68f1635..3a23da9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Sep  7 22:53:06 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+	* parser.c: try to cope with the fact that apps may still
+          have allocated smaller SAX callbak block
+
 Sun Sep  7 11:11:45 CEST 2003 Daniel Veillard <daniel@veillard.com>
 
 	* dict.c: allow to give -1 for undefined length in lookups
diff --git a/parser.c b/parser.c
index dafebb6..b5ae4a8 100644
--- a/parser.c
+++ b/parser.c
@@ -8574,7 +8574,7 @@
     /*
      * SAX: detecting the level.
      */
-    if ((ctxt->sax) &&
+    if ((ctxt->sax) &&  (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
         ((ctxt->sax->startElementNs != NULL) ||
          (ctxt->sax->endElementNs != NULL) ||
          (ctxt->sax->attributeNs != NULL))) ctxt->sax2 = 1;
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index 310d272..dd11b54 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -572,41 +572,53 @@
 
     # functions from module xpointer
     xpointerNewContext()
-Class xpathContext()
-    # accessors
-    contextDoc()
-    contextNode()
-    contextPosition()
-    contextSize()
-    function()
-    functionURI()
-    setContextDoc()
-    setContextNode()
-
-    # functions from module python
-    registerXPathFunction()
-
-    # functions from module xpath
-    xpathEval()
-    xpathEvalExpression()
-    xpathFreeContext()
-
-    # functions from module xpathInternals
-    xpathNewParserContext()
-    xpathNsLookup()
-    xpathRegisterAllFunctions()
-    xpathRegisterNs()
-    xpathRegisteredFuncsCleanup()
-    xpathRegisteredNsCleanup()
-    xpathRegisteredVariablesCleanup()
-    xpathVariableLookup()
-    xpathVariableLookupNS()
-
-    # functions from module xpointer
-    xpointerEval()
 
 
 Class xmlAttribute(xmlNode)
+Class xmlTextReaderLocator()
+
+    # functions from module xmlreader
+    BaseURI()
+    LineNumber()
+
+
+Class xmlNs(xmlNode)
+
+    # functions from module tree
+    copyNamespace()
+    copyNamespaceList()
+    freeNs()
+    freeNsList()
+    newChild()
+    newDocNode()
+    newDocNodeEatName()
+    newDocRawNode()
+    newNodeEatName()
+    newNsProp()
+    newNsPropEatName()
+    newTextChild()
+    setNs()
+    setNsProp()
+    unsetNsProp()
+
+    # functions from module xpathInternals
+    xpathNodeSetFreeNs()
+
+
+Class xmlDtd(xmlNode)
+
+    # functions from module debugXML
+    debugDumpDTD()
+
+    # functions from module tree
+    copyDtd()
+    freeDtd()
+
+    # functions from module valid
+    dtdAttrDesc()
+    dtdElementDesc()
+    dtdQAttrDesc()
+    dtdQElementDesc()
 Class catalog()
 
     # functions from module catalog
@@ -620,106 +632,6 @@
     resolvePublic()
     resolveSystem()
     resolveURI()
-
-
-Class xmlElement(xmlNode)
-
-
-Class xmlAttr(xmlNode)
-
-    # functions from module debugXML
-    debugDumpAttr()
-    debugDumpAttrList()
-
-    # functions from module tree
-    copyProp()
-    copyPropList()
-    freeProp()
-    freePropList()
-    removeProp()
-
-    # functions from module valid
-    removeID()
-    removeRef()
-
-
-Class xmlTextReader(xmlTextReaderCore)
-
-    # functions from module xmlreader
-    AttributeCount()
-    BaseUri()
-    Close()
-    CurrentDoc()
-    CurrentNode()
-    Depth()
-    Expand()
-    GetAttribute()
-    GetAttributeNo()
-    GetAttributeNs()
-    GetParserProp()
-    GetRemainder()
-    HasAttributes()
-    HasValue()
-    IsDefault()
-    IsEmptyElement()
-    IsValid()
-    LocalName()
-    LookupNamespace()
-    MoveToAttribute()
-    MoveToAttributeNo()
-    MoveToAttributeNs()
-    MoveToElement()
-    MoveToFirstAttribute()
-    MoveToNextAttribute()
-    Name()
-    NamespaceUri()
-    Next()
-    NodeType()
-    Normalization()
-    Prefix()
-    QuoteChar()
-    Read()
-    ReadAttributeValue()
-    ReadInnerXml()
-    ReadOuterXml()
-    ReadState()
-    ReadString()
-    RelaxNGSetSchema()
-    RelaxNGValidate()
-    SetParserProp()
-    Value()
-    XmlLang()
-Class xmlReg()
-
-    # functions from module xmlregexp
-    regexpExec()
-    regexpFreeRegexp()
-    regexpIsDeterminist()
-    regexpPrint()
-
-
-Class xmlEntity(xmlNode)
-
-    # functions from module parserInternals
-    handleEntity()
-Class relaxNgSchema()
-
-    # functions from module relaxng
-    relaxNGDump()
-    relaxNGDumpTree()
-    relaxNGFree()
-    relaxNGNewValidCtxt()
-
-    # functions from module xmlreader
-    RelaxNGSetSchema()
-Class relaxNgValidCtxt()
-
-    # functions from module relaxng
-    relaxNGValidateDoc()
-    relaxNGValidateFullElement()
-    relaxNGValidatePopElement()
-    relaxNGValidatePushCData()
-    relaxNGValidatePushElement()
 Class xpathParserContext()
     # accessors
     context()
@@ -864,62 +776,6 @@
     stringDecodeEntities()
 
 
-Class xmlDtd(xmlNode)
-
-    # functions from module debugXML
-    debugDumpDTD()
-
-    # functions from module tree
-    copyDtd()
-    freeDtd()
-
-    # functions from module valid
-    dtdAttrDesc()
-    dtdElementDesc()
-    dtdQAttrDesc()
-    dtdQElementDesc()
-
-
-Class xmlNs(xmlNode)
-
-    # functions from module tree
-    copyNamespace()
-    copyNamespaceList()
-    freeNs()
-    freeNsList()
-    newChild()
-    newDocNode()
-    newDocNodeEatName()
-    newDocRawNode()
-    newNodeEatName()
-    newNsProp()
-    newNsPropEatName()
-    newTextChild()
-    setNs()
-    setNsProp()
-    unsetNsProp()
-
-    # functions from module xpathInternals
-    xpathNodeSetFreeNs()
-
-
-Class inputBuffer(ioReadWrapper)
-
-    # functions from module xmlIO
-    freeParserInputBuffer()
-    grow()
-    push()
-    read()
-
-    # functions from module xmlreader
-    newTextReader()
-Class relaxNgParserCtxt()
-
-    # functions from module relaxng
-    relaxNGFreeParserCtxt()
-    relaxNGParse()
-
-
 Class outputBuffer(ioWriteWrapper)
 
     # functions from module HTMLtree
@@ -938,11 +794,98 @@
     flush()
     write()
     writeString()
-Class xmlTextReaderLocator()
+
+
+Class xmlElement(xmlNode)
+Class relaxNgSchema()
+
+    # functions from module relaxng
+    relaxNGDump()
+    relaxNGDumpTree()
+    relaxNGFree()
+    relaxNGNewValidCtxt()
 
     # functions from module xmlreader
-    BaseURI()
-    LineNumber()
+    RelaxNGSetSchema()
+
+
+Class xmlEntity(xmlNode)
+
+    # functions from module parserInternals
+    handleEntity()
+
+
+Class xmlTextReader(xmlTextReaderCore)
+
+    # functions from module xmlreader
+    AttributeCount()
+    BaseUri()
+    Close()
+    CurrentDoc()
+    CurrentNode()
+    Depth()
+    Expand()
+    GetAttribute()
+    GetAttributeNo()
+    GetAttributeNs()
+    GetParserProp()
+    GetRemainder()
+    HasAttributes()
+    HasValue()
+    IsDefault()
+    IsEmptyElement()
+    IsValid()
+    LocalName()
+    LookupNamespace()
+    MoveToAttribute()
+    MoveToAttributeNo()
+    MoveToAttributeNs()
+    MoveToElement()
+    MoveToFirstAttribute()
+    MoveToNextAttribute()
+    Name()
+    NamespaceUri()
+    Next()
+    NodeType()
+    Normalization()
+    Prefix()
+    QuoteChar()
+    Read()
+    ReadAttributeValue()
+    ReadInnerXml()
+    ReadOuterXml()
+    ReadState()
+    ReadString()
+    RelaxNGSetSchema()
+    RelaxNGValidate()
+    SetParserProp()
+    Value()
+    XmlLang()
+
+
+Class xmlAttr(xmlNode)
+
+    # functions from module debugXML
+    debugDumpAttr()
+    debugDumpAttrList()
+
+    # functions from module tree
+    copyProp()
+    copyPropList()
+    freeProp()
+    freePropList()
+    removeProp()
+
+    # functions from module valid
+    removeID()
+    removeRef()
+Class xmlReg()
+
+    # functions from module xmlregexp
+    regexpExec()
+    regexpFreeRegexp()
+    regexpIsDeterminist()
+    regexpPrint()
 Class URI()
     # accessors
     authority()
@@ -969,3 +912,60 @@
     parseURIReference()
     printURI()
     saveUri()
+Class relaxNgParserCtxt()
+
+    # functions from module relaxng
+    relaxNGFreeParserCtxt()
+    relaxNGParse()
+Class xpathContext()
+    # accessors
+    contextDoc()
+    contextNode()
+    contextPosition()
+    contextSize()
+    function()
+    functionURI()
+    setContextDoc()
+    setContextNode()
+
+    # functions from module python
+    registerXPathFunction()
+
+    # functions from module xpath
+    xpathEval()
+    xpathEvalExpression()
+    xpathFreeContext()
+
+    # functions from module xpathInternals
+    xpathNewParserContext()
+    xpathNsLookup()
+    xpathRegisterAllFunctions()
+    xpathRegisterNs()
+    xpathRegisteredFuncsCleanup()
+    xpathRegisteredNsCleanup()
+    xpathRegisteredVariablesCleanup()
+    xpathVariableLookup()
+    xpathVariableLookupNS()
+
+    # functions from module xpointer
+    xpointerEval()
+
+
+Class inputBuffer(ioReadWrapper)
+
+    # functions from module xmlIO
+    freeParserInputBuffer()
+    grow()
+    push()
+    read()
+
+    # functions from module xmlreader
+    newTextReader()
+Class relaxNgValidCtxt()
+
+    # functions from module relaxng
+    relaxNGValidateDoc()
+    relaxNGValidateFullElement()
+    relaxNGValidatePopElement()
+    relaxNGValidatePushCData()
+    relaxNGValidatePushElement()