- added xmlRemoveID() and xmlRemoveRef()
- added check and handling when possibly removing an ID
- fixed some entities problems
- added xmlParseTryOrFinish()
- changed the way struct aredeclared to allow gtk-doc to expose those
- closed #4960
- fixes to libs detection from Albert Chin-A-Young
- preparing 1.8.3 release
Daniel
diff --git a/include/libxml/HTMLparser.h b/include/libxml/HTMLparser.h
index ecb91cb..22fe614 100644
--- a/include/libxml/HTMLparser.h
+++ b/include/libxml/HTMLparser.h
@@ -30,7 +30,9 @@
 /*
  * Internal description of an HTML element
  */
-typedef struct htmlElemDesc {
+typedef struct _htmlElemDesc htmlElemDesc;
+typedef htmlElemDesc *htmlElemDescPtr;
+struct _htmlElemDesc {
     const char *name;	/* The tag name */
     int startTag;       /* Whether the start tag can be implied */
     int endTag;         /* Whether the end tag can be implied */
@@ -38,16 +40,18 @@
     int depr;           /* Is this a deprecated element ? */
     int dtd;            /* 1: only in Loose DTD, 2: only Frameset one */
     const char *desc;   /* the description */
-} htmlElemDesc, *htmlElemDescPtr;
+};
 
 /*
  * Internal description of an HTML entity
  */
-typedef struct htmlEntityDesc {
+typedef struct _htmlEntityDesc htmlEntityDesc;
+typedef htmlEntityDesc *htmlEntityDescPtr;
+struct _htmlEntityDesc {
     int value;		/* the UNICODE value for the character */
     const char *name;	/* The entity name */
     const char *desc;   /* the description */
-} htmlEntityDesc, *htmlEntityDescPtr;
+};
 
 /*
  * There is only few public functions.
diff --git a/include/libxml/debugXML.h b/include/libxml/debugXML.h
index 8774f0b..5d4d2ae 100644
--- a/include/libxml/debugXML.h
+++ b/include/libxml/debugXML.h
@@ -64,7 +64,9 @@
  * The shell context itself
  * TODO: add the defined function tables.
  */
-typedef struct xmlShellCtxt {
+typedef struct _xmlShellCtxt xmlShellCtxt;
+typedef xmlShellCtxt *xmlShellCtxtPtr;
+struct _xmlShellCtxt {
     char *filename;
     xmlDocPtr doc;
     xmlNodePtr node;
@@ -72,7 +74,7 @@
     int loaded;
     FILE *output;
     xmlShellReadlineFunc input;
-} xmlShellCtxt, *xmlShellCtxtPtr;
+};
 
 /**
  * xmlShellCmd:
diff --git a/include/libxml/encoding.h b/include/libxml/encoding.h
index 6a42335..5eb1a52 100644
--- a/include/libxml/encoding.h
+++ b/include/libxml/encoding.h
@@ -90,12 +90,13 @@
  * Block defining the handlers for non UTF-8 encodings.
  */
 
-typedef struct xmlCharEncodingHandler {
+typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
+typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
+struct _xmlCharEncodingHandler {
     char                       *name;
     xmlCharEncodingInputFunc   input;
     xmlCharEncodingOutputFunc output;
-} xmlCharEncodingHandler;
-typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
+};
 
 void	xmlInitCharEncodingHandlers	(void);
 void	xmlCleanupCharEncodingHandlers	(void);
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
index 84ad7c1..0347170 100644
--- a/include/libxml/entities.h
+++ b/include/libxml/entities.h
@@ -27,7 +27,9 @@
  * and the linkind data needed for the linking in the hash table.
  */
 
-typedef struct xmlEntity {
+typedef struct _xmlEntity xmlEntity;
+typedef xmlEntity *xmlEntityPtr;
+struct _xmlEntity {
     int type;			/* The entity type */
     int len;			/* The lenght of the name */
     const xmlChar  *name;	/* Name of the entity */
@@ -36,8 +38,7 @@
     xmlChar *content;		/* The entity content or ndata if unparsed */
     int length;			/* the content length */
     xmlChar *orig;		/* The entity cont without ref substitution */
-} xmlEntity;
-typedef xmlEntity *xmlEntityPtr;
+};
 
 /*
  * ALl entities are stored in a table there is one table per DTD
@@ -46,12 +47,13 @@
 
 #define XML_MIN_ENTITIES_TABLE	32
 
-typedef struct xmlEntitiesTable {
+typedef struct _xmlEntitiesTable xmlEntitiesTable;
+typedef xmlEntitiesTable *xmlEntitiesTablePtr;
+struct _xmlEntitiesTable {
     int nb_entities;		/* number of elements stored */
     int max_entities;		/* maximum number of elements */
     xmlEntityPtr table;	        /* the table of entities */
-} xmlEntitiesTable;
-typedef xmlEntitiesTable *xmlEntitiesTablePtr;
+};
 
 
 /*
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 938ea8c..e02751c 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -34,7 +34,9 @@
  */
 
 typedef void (* xmlParserInputDeallocate)(xmlChar *);
-typedef struct xmlParserInput {
+typedef struct _xmlParserInput xmlParserInput;
+typedef xmlParserInput *xmlParserInputPtr;
+struct _xmlParserInput {
     /* Input buffer */
     xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
 
@@ -47,35 +49,36 @@
     int col;                          /* Current column */
     int consumed;                     /* How many xmlChars already consumed */
     xmlParserInputDeallocate free;    /* function to deallocate the base */
-} xmlParserInput;
-typedef xmlParserInput *xmlParserInputPtr;
+};
 
 /**
  * the parser can be asked to collect Node informations, i.e. at what
  * place in the file they were detected. 
  * NOTE: This is off by default and not very well tested.
  */
-typedef struct _xmlParserNodeInfo {
-  const struct xmlNode* node;
+typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
+typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
+
+struct _xmlParserNodeInfo {
+  const struct _xmlNode* node;
   /* Position & line # that text that created the node begins & ends on */
   unsigned long begin_pos;
   unsigned long begin_line;
   unsigned long end_pos;
   unsigned long end_line;
-} _xmlParserNodeInfo;
-typedef _xmlParserNodeInfo xmlParserNodeInfo;
+};
 
-typedef struct xmlParserNodeInfoSeq {
+typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
+typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
+struct _xmlParserNodeInfoSeq {
   unsigned long maximum;
   unsigned long length;
   xmlParserNodeInfo* buffer;
-} _xmlParserNodeInfoSeq;
-typedef _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
-typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
+};
 
 /**
- * The parser is not (yet) a state based parser, but we need to maintain
- * minimum state informations, especially for entities processing.
+ * The parser is now working also as a state based parser
+ * The recursive one use the stagte info for entities processing
  */
 typedef enum {
     XML_PARSER_EOF = -1,	/* nothing is to be parsed */
@@ -105,8 +108,10 @@
  *      takes as the only argument the parser context pointer, so migrating
  *      to a state based parser for progressive parsing shouldn't be too hard.
  */
-typedef struct _xmlParserCtxt {
-    struct xmlSAXHandler *sax;        /* The SAX handler */
+typedef struct _xmlParserCtxt xmlParserCtxt;
+typedef xmlParserCtxt *xmlParserCtxtPtr;
+struct _xmlParserCtxt {
+    struct _xmlSAXHandler *sax;       /* The SAX handler */
     void            *userData;        /* the document being built */
     xmlDocPtr           myDoc;        /* the document being built */
     int            wellFormed;        /* is the document well formed */
@@ -154,21 +159,19 @@
 
     long               nbChars;       /* number of xmlChar processed */
     long            checkIndex;       /* used by progressive parsing lookup */
-} _xmlParserCtxt;
-typedef _xmlParserCtxt xmlParserCtxt;
-typedef xmlParserCtxt *xmlParserCtxtPtr;
+};
 
 /**
  * a SAX Locator.
  */
-typedef struct xmlSAXLocator {
+typedef struct _xmlSAXLocator xmlSAXLocator;
+typedef xmlSAXLocator *xmlSAXLocatorPtr;
+struct _xmlSAXLocator {
     const xmlChar *(*getPublicId)(void *ctx);
     const xmlChar *(*getSystemId)(void *ctx);
     int (*getLineNumber)(void *ctx);
     int (*getColumnNumber)(void *ctx);
-} _xmlSAXLocator;
-typedef _xmlSAXLocator xmlSAXLocator;
-typedef xmlSAXLocator *xmlSAXLocatorPtr;
+};
 
 /**
  * a SAX handler is bunch of callbacks called by the parser when processing
@@ -221,7 +224,9 @@
 typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
 typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
 
-typedef struct xmlSAXHandler {
+typedef struct _xmlSAXHandler xmlSAXHandler;
+typedef xmlSAXHandler *xmlSAXHandlerPtr;
+struct _xmlSAXHandler {
     internalSubsetSAXFunc internalSubset;
     isStandaloneSAXFunc isStandalone;
     hasInternalSubsetSAXFunc hasInternalSubset;
@@ -248,8 +253,7 @@
     fatalErrorSAXFunc fatalError;
     getParameterEntitySAXFunc getParameterEntity;
     cdataBlockSAXFunc cdataBlock;
-} xmlSAXHandler;
-typedef xmlSAXHandler *xmlSAXHandlerPtr;
+};
 
 /**
  * External entity loaders types
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index 0ff3a51..1346994 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -67,12 +67,13 @@
  * a DTD Notation definition
  */
 
-typedef struct xmlNotation {
+typedef struct _xmlNotation xmlNotation;
+typedef xmlNotation *xmlNotationPtr;
+struct _xmlNotation {
     const xmlChar               *name;	/* Notation name */
     const xmlChar               *PublicID;	/* Public identifier, if any */
     const xmlChar               *SystemID;	/* System identifier, if any */
-} xmlNotation;
-typedef xmlNotation *xmlNotationPtr;
+};
 
 /*
  * a DTD Attribute definition
@@ -98,23 +99,25 @@
     XML_ATTRIBUTE_FIXED
 } xmlAttributeDefault;
 
-typedef struct xmlEnumeration {
-    struct xmlEnumeration    *next;	/* next one */
-    const xmlChar            *name;	/* Enumeration name */
-} xmlEnumeration;
+typedef struct _xmlEnumeration xmlEnumeration;
 typedef xmlEnumeration *xmlEnumerationPtr;
+struct _xmlEnumeration {
+    struct _xmlEnumeration    *next;	/* next one */
+    const xmlChar            *name;	/* Enumeration name */
+};
 
-typedef struct xmlAttribute {
+typedef struct _xmlAttribute xmlAttribute;
+typedef xmlAttribute *xmlAttributePtr;
+struct _xmlAttribute {
     const xmlChar         *elem;	/* Element holding the attribute */
     const xmlChar         *name;	/* Attribute name */
-    struct xmlAttribute   *next;        /* list of attributes of an element */
+    struct _xmlAttribute   *next;       /* list of attributes of an element */
     xmlAttributeType       type;	/* The type */
     xmlAttributeDefault    def;		/* the default */
     const xmlChar         *defaultValue;/* or the default value */
     xmlEnumerationPtr      tree;        /* or the enumeration tree if any */
     const xmlChar         *prefix;      /* the namespace prefix if any */
-} xmlAttribute;
-typedef xmlAttribute *xmlAttributePtr;
+};
 
 /*
  * a DTD Element definition.
@@ -133,14 +136,15 @@
     XML_ELEMENT_CONTENT_PLUS
 } xmlElementContentOccur;
 
-typedef struct xmlElementContent {
+typedef struct _xmlElementContent xmlElementContent;
+typedef xmlElementContent *xmlElementContentPtr;
+struct _xmlElementContent {
     xmlElementContentType     type;	/* PCDATA, ELEMENT, SEQ or OR */
     xmlElementContentOccur    ocur;	/* ONCE, OPT, MULT or PLUS */
     const xmlChar            *name;	/* Element name */
-    struct xmlElementContent *c1;	/* first child */
-    struct xmlElementContent *c2;	/* second child */
-} xmlElementContent;
-typedef xmlElementContent *xmlElementContentPtr;
+    struct _xmlElementContent *c1;	/* first child */
+    struct _xmlElementContent *c2;	/* second child */
+};
 
 typedef enum {
     XML_ELEMENT_TYPE_EMPTY = 1,
@@ -149,13 +153,14 @@
     XML_ELEMENT_TYPE_ELEMENT
 } xmlElementTypeVal;
 
-typedef struct xmlElement {
+typedef struct _xmlElement xmlElement;
+typedef xmlElement *xmlElementPtr;
+struct _xmlElement {
     const xmlChar          *name;	/* Element name */
     xmlElementTypeVal       type;	/* The type */
     xmlElementContentPtr content;	/* the allowed element content */
     xmlAttributePtr   attributes;	/* List of the declared attributes */
-} xmlElement;
-typedef xmlElement *xmlElementPtr;
+};
 
 /*
  * An XML namespace.
@@ -168,18 +173,21 @@
     XML_LOCAL_NAMESPACE		/* new style local scoping */
 } xmlNsType;
 
-typedef struct xmlNs {
-    struct xmlNs  *next;	/* next Ns link for this node  */
+typedef struct _xmlNs xmlNs;
+typedef xmlNs *xmlNsPtr;
+struct _xmlNs {
+    struct _xmlNs  *next;	/* next Ns link for this node  */
     xmlNsType      type;	/* global or local */
     const xmlChar *href;	/* URL for the namespace */
     const xmlChar *prefix;	/* prefix for the namespace */
-} xmlNs;
-typedef xmlNs *xmlNsPtr;
+};
 
 /*
  * An XML DtD, as defined by <!DOCTYPE.
  */
-typedef struct xmlDtd {
+typedef struct _xmlDtd xmlDtd;
+typedef xmlDtd *xmlDtdPtr;
+struct _xmlDtd {
     const xmlChar *name;	/* Name of the DTD */
     const xmlChar *ExternalID;	/* External identifier for PUBLIC DTD */
     const xmlChar *SystemID;	/* URI for a SYSTEM or PUBLIC DTD */
@@ -188,47 +196,49 @@
     void          *attributes;  /* Hash table for attributes if any */
     void          *entities;    /* Hash table for entities if any */
     /* struct xmlDtd *next;	 * next  link for this document  */
-} xmlDtd;
-typedef xmlDtd *xmlDtdPtr;
+};
 
 /*
  * A attribute of an XML node.
  */
-typedef struct xmlAttr {
+typedef struct _xmlAttr xmlAttr;
+typedef xmlAttr *xmlAttrPtr;
+struct _xmlAttr {
 #ifndef XML_WITHOUT_CORBA
     void           *_private;	/* for Corba, must be first ! */
     void           *vepv;	/* for Corba, must be next ! */
 #endif
     xmlElementType  type;       /* XML_ATTRIBUTE_NODE, must be third ! */
-    struct xmlNode *node;	/* attr->node link */
-    struct xmlAttr *next;	/* attribute list link */
-    const xmlChar  *name;       /* the name of the property */
-    struct xmlNode *val;        /* the value of the property */
-    xmlNs          *ns;         /* pointer to the associated namespace */
-} xmlAttr;
-typedef xmlAttr *xmlAttrPtr;
+    struct _xmlNode *node;	/* attr->node link */
+    struct _xmlAttr *next;	/* attribute list link */
+    const xmlChar   *name;      /* the name of the property */
+    struct _xmlNode *val;       /* the value of the property */
+    xmlNs           *ns;        /* pointer to the associated namespace */
+};
 
 /*
  * An XML ID instance.
  */
 
-typedef struct xmlID {
-    struct xmlID     *next;	/* next ID */
+typedef struct _xmlID xmlID;
+typedef xmlID *xmlIDPtr;
+struct _xmlID {
+    struct _xmlID    *next;	/* next ID */
     const xmlChar    *value;	/* The ID name */
     xmlAttrPtr        attr;	/* The attribut holding it */
-} xmlID;
-typedef xmlID *xmlIDPtr;
+};
 
 /*
  * An XML IDREF instance.
  */
 
-typedef struct xmlRef {
-    struct xmlRef     *next;	/* next Ref */
+typedef struct _xmlRef xmlRef;
+typedef xmlRef *xmlRefPtr;
+struct _xmlRef {
+    struct _xmlRef    *next;	/* next Ref */
     const xmlChar     *value;	/* The Ref name */
     xmlAttrPtr        attr;	/* The attribut holding it */
-} xmlRef;
-typedef xmlRef *xmlRefPtr;
+};
 
 /*
  * A buffer structure
@@ -239,31 +249,33 @@
     XML_BUFFER_ALLOC_EXACT
 } xmlBufferAllocationScheme;
 
-typedef struct xmlBuffer {
+typedef struct _xmlBuffer xmlBuffer;
+typedef xmlBuffer *xmlBufferPtr;
+struct _xmlBuffer {
     xmlChar *content;		/* The buffer content UTF8 */
     unsigned int use;		/* The buffer size used */
     unsigned int size;		/* The buffer size */
     xmlBufferAllocationScheme alloc; /* The realloc method */
-} _xmlBuffer;
-typedef _xmlBuffer xmlBuffer;
-typedef xmlBuffer *xmlBufferPtr;
+};
 
 /*
  * A node in an XML tree.
  */
-typedef struct xmlNode {
+typedef struct _xmlNode xmlNode;
+typedef xmlNode *xmlNodePtr;
+struct _xmlNode {
 #ifndef XML_WITHOUT_CORBA
     void           *_private;	/* for Corba, must be first ! */
     void           *vepv;	/* for Corba, must be next ! */
 #endif
     xmlElementType  type;	/* type number in the DTD, must be third ! */
-    struct xmlDoc  *doc;	/* the containing document */
-    struct xmlNode *parent;	/* child->parent link */
-    struct xmlNode *next;	/* next sibling link  */
-    struct xmlNode *prev;	/* previous sibling link  */
-    struct xmlNode *childs;	/* parent->childs link */
-    struct xmlNode *last;	/* last child link */
-    struct xmlAttr *properties;	/* properties list */
+    struct _xmlDoc  *doc;	/* the containing document */
+    struct _xmlNode *parent;	/* child->parent link */
+    struct _xmlNode *next;	/* next sibling link  */
+    struct _xmlNode *prev;	/* previous sibling link  */
+    struct _xmlNode *childs;	/* parent->childs link */
+    struct _xmlNode *last;	/* last child link */
+    struct _xmlAttr *properties;/* properties list */
     const xmlChar  *name;       /* the name of the node, or the entity */
     xmlNs          *ns;         /* pointer to the associated namespace */
     xmlNs          *nsDef;      /* namespace definitions on this node */
@@ -272,14 +284,14 @@
 #else
     xmlBufferPtr   content;     /* the content in a buffer */
 #endif
-} _xmlNode;
-typedef _xmlNode xmlNode;
-typedef _xmlNode *xmlNodePtr;
+};
 
 /*
  * An XML document.
  */
-typedef struct xmlDoc {
+typedef struct _xmlDoc xmlDoc;
+typedef xmlDoc *xmlDocPtr;
+struct _xmlDoc {
 #ifndef XML_WITHOUT_CORBA
     void           *_private;	/* for Corba, must be first ! */
     void           *vepv;	/* for Corba, must be next ! */
@@ -290,15 +302,13 @@
     const xmlChar  *encoding;   /* encoding, if any */
     int             compression;/* level of zlib compression */
     int             standalone; /* standalone document (no external refs) */
-    struct xmlDtd  *intSubset;	/* the document internal subset */
-    struct xmlDtd  *extSubset;	/* the document external subset */
-    struct xmlNs   *oldNs;	/* Global namespace, the old way */
-    struct xmlNode *root;	/* the document tree */
+    struct _xmlDtd  *intSubset;	/* the document internal subset */
+    struct _xmlDtd  *extSubset;	/* the document external subset */
+    struct _xmlNs   *oldNs;	/* Global namespace, the old way */
+    struct _xmlNode *root;	/* the document tree */
     void           *ids;        /* Hash table for ID attributes if any */
     void           *refs;       /* Hash table for IDREFs attributes if any */
-} _xmlDoc;
-typedef _xmlDoc xmlDoc;
-typedef xmlDoc *xmlDocPtr;
+};
 
 /*
  * Variables.
diff --git a/include/libxml/valid.h b/include/libxml/valid.h
index 7190bbf..8c86b17 100644
--- a/include/libxml/valid.h
+++ b/include/libxml/valid.h
@@ -23,11 +23,13 @@
 typedef void (*xmlValidityErrorFunc) (void *ctx, const char *msg, ...);
 typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...);
 
-typedef struct xmlValidCtxt {
+typedef struct _xmlValidCtxt xmlValidCtxt;
+typedef xmlValidCtxt *xmlValidCtxtPtr;
+struct _xmlValidCtxt {
     void *userData;			/* user specific data block */
     xmlValidityErrorFunc error;		/* the callback in case of errors */
     xmlValidityWarningFunc warning;	/* the callback in case of warning */
-} xmlValidCtxt, *xmlValidCtxtPtr;
+};
 
 /*
  * ALl notation declarations are stored in a table
@@ -36,12 +38,13 @@
 
 #define XML_MIN_NOTATION_TABLE	32
 
-typedef struct xmlNotationTable {
+typedef struct _xmlNotationTable xmlNotationTable;
+typedef xmlNotationTable *xmlNotationTablePtr;
+struct _xmlNotationTable {
     int nb_notations;		/* number of notations stored */
     int max_notations;		/* maximum number of notations */
     xmlNotationPtr *table;	/* the table of attributes */
-} xmlNotationTable;
-typedef xmlNotationTable *xmlNotationTablePtr;
+};
 
 /*
  * ALl element declarations are stored in a table
@@ -50,12 +53,13 @@
 
 #define XML_MIN_ELEMENT_TABLE	32
 
-typedef struct xmlElementTable {
+typedef struct _xmlElementTable xmlElementTable;
+typedef xmlElementTable *xmlElementTablePtr;
+struct _xmlElementTable {
     int nb_elements;		/* number of elements stored */
     int max_elements;		/* maximum number of elements */
     xmlElementPtr *table;	/* the table of elements */
-} xmlElementTable;
-typedef xmlElementTable *xmlElementTablePtr;
+};
 
 /*
  * ALl attribute declarations are stored in a table
@@ -64,12 +68,13 @@
 
 #define XML_MIN_ATTRIBUTE_TABLE	32
 
-typedef struct xmlAttributeTable {
+typedef struct _xmlAttributeTable xmlAttributeTable;
+typedef xmlAttributeTable *xmlAttributeTablePtr;
+struct _xmlAttributeTable {
     int nb_attributes;		/* number of attributes stored */
     int max_attributes;		/* maximum number of attributes */
     xmlAttributePtr *table;	/* the table of attributes */
-} xmlAttributeTable;
-typedef xmlAttributeTable *xmlAttributeTablePtr;
+};
 
 /*
  * ALl IDs attributes are stored in a table
@@ -78,12 +83,13 @@
 
 #define XML_MIN_ID_TABLE	32
 
-typedef struct xmlIDTable {
+typedef struct _xmlIDTable xmlIDTable;
+typedef xmlIDTable *xmlIDTablePtr;
+struct _xmlIDTable {
     int nb_ids;			/* number of ids stored */
     int max_ids;		/* maximum number of ids */
     xmlIDPtr *table;		/* the table of ids */
-} xmlIDTable;
-typedef xmlIDTable *xmlIDTablePtr;
+};
 
 /*
  * ALl Refs attributes are stored in a table
@@ -92,12 +98,13 @@
 
 #define XML_MIN_REF_TABLE	32
 
-typedef struct xmlRefTable {
+typedef struct _xmlRefTable xmlRefTable;
+typedef xmlRefTable *xmlRefTablePtr;
+struct _xmlRefTable {
     int nb_refs;			/* number of refs stored */
     int max_refs;		/* maximum number of refs */
     xmlRefPtr *table;		/* the table of refs */
-} xmlRefTable;
-typedef xmlRefTable *xmlRefTablePtr;
+};
 
 /* Notation */
 xmlNotationPtr	    xmlAddNotationDecl	(xmlValidCtxtPtr ctxt,
@@ -158,6 +165,7 @@
 int		xmlIsID		(xmlDocPtr doc,
 				 xmlNodePtr elem,
 				 xmlAttrPtr attr);
+int		xmlRemoveID	(xmlDocPtr doc, xmlAttrPtr attr);
 
 /* IDREFs */
 xmlRefPtr	xmlAddRef	(xmlValidCtxtPtr ctxt,
@@ -169,6 +177,7 @@
 int		xmlIsRef	(xmlDocPtr doc,
 				 xmlNodePtr elem,
 				 xmlAttrPtr attr);
+int		xmlRemoveRef	(xmlDocPtr doc, xmlAttrPtr attr);
 
 /**
  * The public function calls related to validity checking
diff --git a/include/libxml/xlink.h b/include/libxml/xlink.h
index 1533148..0bcceeb 100644
--- a/include/libxml/xlink.h
+++ b/include/libxml/xlink.h
@@ -148,12 +148,13 @@
  * There is no default xlink callbacks, if one want to get link
  * recognition activated, those call backs must be provided before parsing.
  */
-typedef struct xlinkHandler {
+typedef struct _xlinkHandler xlinkHandler;
+typedef xlinkHandler *xlinkHandlerPtr;
+struct _xlinkHandler {
     xlinkSimpleLinkFunk simple;
     xlinkExtendedLinkFunk extended;
     xlinkExtendedLinkSetFunk set;
-} xlinkHandler;
-typedef xlinkHandler *xlinkHandlerPtr;
+};
 
 /**
  * the default detection routine, can be overriden, they call the default
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index bf43de2..48bbcbb 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -18,7 +18,9 @@
 extern "C" {
 #endif
 
-typedef struct xmlParserInputBuffer {
+typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
+typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
+struct _xmlParserInputBuffer {
     /* Inputs */
     FILE          *file;    /* Input on file handler */
     void*        gzfile;    /* Input on a compressed stream */
@@ -29,9 +31,8 @@
     
     xmlBufferPtr buffer;    /* Local buffer encoded in  UTF-8 */
 
-} xmlParserInputBuffer;
+};
 
-typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
 
 /*
  * Interfaces
diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
index 84c8305..c0222e6 100644
--- a/include/libxml/xpath.h
+++ b/include/libxml/xpath.h
@@ -18,16 +18,21 @@
 extern "C" {
 #endif
 
-typedef struct xmlXPathParserContext *xmlXPathParserContextPtr;
+typedef struct _xmlXPathContext xmlXPathContext;
+typedef xmlXPathContext *xmlXPathContextPtr;
+typedef struct _xmlXPathParserContext xmlXPathParserContext;
+typedef xmlXPathParserContext *xmlXPathParserContextPtr;
 
 /*
  * A node-set (an unordered collection of nodes without duplicates) 
  */
-typedef struct xmlNodeSet {
+typedef struct _xmlNodeSet xmlNodeSet;
+typedef xmlNodeSet *xmlNodeSetPtr;
+struct _xmlNodeSet {
     int nodeNr;			/* # of node in the set */
     int nodeMax;		/* allocated space */
     xmlNodePtr *nodeTab;	/* array of nodes in no particular order */
-} xmlNodeSet, *xmlNodeSetPtr;
+};
 
 /*
  * An expression is evaluated to yield an object, which
@@ -45,14 +50,16 @@
 #define XPATH_STRING	4
 #define XPATH_USERS	5
 
-typedef struct xmlXPathObject {
+typedef struct _xmlXPathObject xmlXPathObject;
+typedef xmlXPathObject *xmlXPathObjectPtr;
+struct _xmlXPathObject {
     int type;
     xmlNodeSetPtr nodesetval;
     int boolval;
     double floatval;
     xmlChar *stringval;
     void *user;
-} xmlXPathObject, *xmlXPathObjectPtr;
+};
 
 /*
  * A conversion function is associated to a type and used to cast
@@ -64,19 +71,23 @@
  * Extra type: a name and a conversion function.
  */
 
-typedef struct xmlXPathType {
+typedef struct _xmlXPathType xmlXPathType;
+typedef xmlXPathType *xmlXPathTypePtr;
+struct _xmlXPathType {
     const xmlChar         *name;		/* the type name */
     xmlXPathConvertFunc func;		/* the conversion function */
-} xmlXPathType, *xmlXPathTypePtr;
+};
 
 /*
  * Extra variable: a name and a value.
  */
 
-typedef struct xmlXPathVariable {
+typedef struct _xmlXPathVariable xmlXPathVariable;
+typedef xmlXPathVariable *xmlXPathVariablePtr;
+struct _xmlXPathVariable {
     const xmlChar       *name;		/* the variable name */
     xmlXPathObjectPtr value;		/* the value */
-} xmlXPathVariable, *xmlXPathVariablePtr;
+};
 
 /*
  * an evaluation function, the parameters are on the context stack
@@ -88,10 +99,12 @@
  * Extra function: a name and a evaluation function.
  */
 
-typedef struct xmlXPathFunct {
+typedef struct _xmlXPathFunct xmlXPathFunct;
+typedef xmlXPathFunct *xmlXPathFuncPtr;
+struct _xmlXPathFunct {
     const xmlChar      *name;		/* the function name */
     xmlXPathEvalFunc func;		/* the evaluation function */
-} xmlXPathFunc, *xmlXPathFuncPtr;
+};
 
 /*
  * An axis traversal function. To traverse an axis, the engine calls
@@ -106,10 +119,12 @@
  * Extra axis: a name and an axis function.
  */
 
-typedef struct xmlXPathAxis {
+typedef struct _xmlXPathAxis xmlXPathAxis;
+typedef xmlXPathAxis *xmlXPathAxisPtr;
+struct _xmlXPathAxis {
     const xmlChar      *name;		/* the axis name */
     xmlXPathAxisFunc func;		/* the search function */
-} xmlXPathAxis, *xmlXPathAxisPtr;
+};
 
 /* 
  * Expression evaluation occurs with respect to a context.
@@ -121,7 +136,7 @@
  *    - the set of namespace declarations in scope for the expression 
  */
 
-typedef struct xmlXPathContext {
+struct _xmlXPathContext {
     xmlDocPtr doc;			/* The current document */
     xmlNodePtr node;			/* The current node */
     xmlNodeSetPtr nodelist;		/* The current node list */
@@ -146,13 +161,13 @@
     xmlNsPtr *namespaces;		/* The namespaces lookup */
     int nsNr;				/* the current Namespace index */
     void *user;				/* user defined extra info */
-} xmlXPathContext, *xmlXPathContextPtr;
+};
 
 /*
  * An XPath parser context, it contains pure parsing informations,
  * an xmlXPathContext, and the stack of objects.
  */
-typedef struct xmlXPathParserContext {
+struct _xmlXPathParserContext {
     const xmlChar *cur;			/* the current char being parsed */
     const xmlChar *base;			/* the full expression */
 
@@ -163,7 +178,7 @@
     int                 valueNr;	/* number of values stacked */
     int                valueMax;	/* max number of values stacked */
     xmlXPathObjectPtr *valueTab;	/* stack of values */
-} xmlXPathParserContext;
+};
 
 /*
  * An XPath function