mirror of
https://github.com/darlinghq/darling-libxml2.git
synced 2024-12-02 17:26:24 +00:00
fixed some wording make sure doc/examples is packaged fixed the really
* Copyright: fixed some wording * libxml.spec.in: make sure doc/examples is packaged * include/libxml/tree.h valid.c xmlreader.c: fixed the really annoying problem about xmlRemoveID and xmlReader streaming. Thing looks fixed now, add to add a doc reference to the xmlID structure though... Daniel
This commit is contained in:
parent
485fa4baac
commit
8d7b5c7ecd
12
ChangeLog
12
ChangeLog
@ -1,7 +1,15 @@
|
||||
Sat Nov 15 19:20:32 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* Copyright: fixed some wording
|
||||
* libxml.spec.in: make sure doc/examples is packaged
|
||||
* include/libxml/tree.h valid.c xmlreader.c: fixed the really
|
||||
annoying problem about xmlRemoveID and xmlReader streaming.
|
||||
Thing looks fixed now, add to add a doc reference to the
|
||||
xmlID structure though...
|
||||
|
||||
Sat Nov 15 09:53:36 MST 2003 John Fleck <jfleck@inkstain.net>
|
||||
|
||||
* doc/docdescr.doc
|
||||
added description of man page building
|
||||
* doc/docdescr.doc: added description of man page building
|
||||
|
||||
Sat Nov 15 19:08:22 HKT 2003 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
Except where otherwise noted in the source code (trio files, hash.c and list.c)
|
||||
covered by a similar licence but with different Copyright notices:
|
||||
Except where otherwise noted in the source code (e.g. the files hash.c,
|
||||
list.c and the trio files, which are covered by a similar licence but
|
||||
with different Copyright notices) all the files are:
|
||||
|
||||
Copyright (C) 1998-2002 Daniel Veillard. All Rights Reserved.
|
||||
Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -182,21 +182,22 @@ pnode=pxmlDoc->children->children;</pre>
|
||||
<p>Check the previous points 1/ and 2/ raised before, and please send
|
||||
patches.</p>
|
||||
</li>
|
||||
<li><em>Where can I get more examples and information than privoded on the
|
||||
<li><em>Where can I get more examples and information than provided on the
|
||||
web page?</em>
|
||||
<p>Ideally a libxml2 book would be nice. I have no such plan ... But you
|
||||
can:</p>
|
||||
<ul><li>check more deeply the <a href="html/libxml-lib.html">existing
|
||||
generated doc</a></li>
|
||||
<li>look for examples of use for libxml2 function using the Gnome code.
|
||||
<li>have a look at <a href="examples/index.html">the set of examples</a>.
|
||||
</li><li>look for examples of use for libxml2 function using the Gnome code.
|
||||
For example the following will query the full Gnome CVS base for the
|
||||
use of the <strong>xmlAddChild()</strong> function:
|
||||
<p><a href="http://cvs.gnome.org/lxr/search?string=xmlAddChild">http://cvs.gnome.org/lxr/search?string=xmlAddChild</a></p>
|
||||
<p>This may be slow, a large hardware donation to the gnome project
|
||||
could cure this :-)</p>
|
||||
</li>
|
||||
<li><a href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=gnome-xml">Browse
|
||||
the libxml2 source</a> , I try to write code as clean and documented
|
||||
<li><a href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=gnome-xml">Browse the libxml2 source</a> , I try to write code as clean and
|
||||
documented
|
||||
as possible, so looking at it may be helpful. In particular the code
|
||||
of xmllint.c and of the various testXXX.c test programs should
|
||||
provide good examples of how to do things with the library.</li>
|
||||
|
@ -1,4 +1,8 @@
|
||||
# Beware this is autogenerated by config.py
|
||||
HTML_DIR=$(datadir)/doc
|
||||
DOC_MODULE=libxml2-$(VERSION)
|
||||
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)/examples
|
||||
|
||||
INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
|
||||
DEPS = $(top_builddir)/libxml2.la
|
||||
LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@
|
||||
@ -11,6 +15,10 @@ examples.xml: index.py *.c
|
||||
index.html: examples.xml examples.xsl
|
||||
-@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html)
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
|
||||
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.out $(DESTDIR)$(TARGET_DIR)
|
||||
|
||||
EXTRA_DIST=examples.xsl index.py test1.xml examples.xml test2.xml tree1.out
|
||||
|
||||
noinst_PROGRAMS=xpath1 parse1 parse2 tree1
|
||||
|
@ -219,6 +219,10 @@ def dump_Makefile():
|
||||
for file in glob.glob('*.out'):
|
||||
extras.append(file)
|
||||
Makefile="""# Beware this is autogenerated by config.py
|
||||
HTML_DIR=$(datadir)/doc
|
||||
DOC_MODULE=libxml2-$(VERSION)
|
||||
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)/examples
|
||||
|
||||
INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
|
||||
DEPS = $(top_builddir)/libxml2.la
|
||||
LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@
|
||||
@ -231,6 +235,10 @@ examples.xml: index.py *.c
|
||||
index.html: examples.xml examples.xsl
|
||||
-@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html)
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
|
||||
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.out $(DESTDIR)$(TARGET_DIR)
|
||||
|
||||
"""
|
||||
EXTRA_DIST=""
|
||||
for extra in extras:
|
||||
|
Binary file not shown.
1164
doc/libxml2-api.xml
1164
doc/libxml2-api.xml
File diff suppressed because it is too large
Load Diff
@ -379,13 +379,14 @@ pnode=pxmlDoc->children->children;</pre>
|
||||
<p>Check the previous points 1/ and 2/ raised before, and please send
|
||||
patches.</p>
|
||||
</li>
|
||||
<li><em>Where can I get more examples and information than privoded on the
|
||||
<li><em>Where can I get more examples and information than provided on the
|
||||
web page?</em>
|
||||
<p>Ideally a libxml2 book would be nice. I have no such plan ... But you
|
||||
can:</p>
|
||||
<ul>
|
||||
<li>check more deeply the <a href="html/libxml-lib.html">existing
|
||||
generated doc</a></li>
|
||||
<li>have a look at <a href="examples/index.html">the set of examples</a>.
|
||||
<li>look for examples of use for libxml2 function using the Gnome code.
|
||||
For example the following will query the full Gnome CVS base for the
|
||||
use of the <strong>xmlAddChild()</strong> function:
|
||||
@ -395,8 +396,8 @@ pnode=pxmlDoc->children->children;</pre>
|
||||
could cure this :-)</p>
|
||||
</li>
|
||||
<li><a
|
||||
href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=gnome-xml">Browse
|
||||
the libxml2 source</a> , I try to write code as clean and documented
|
||||
href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=gnome-xml">Browse the libxml2 source</a> , I try to write code as clean and
|
||||
documented
|
||||
as possible, so looking at it may be helpful. In particular the code
|
||||
of xmllint.c and of the various testXXX.c test programs should
|
||||
provide good examples of how to do things with the library.</li>
|
||||
|
@ -390,6 +390,7 @@ struct _xmlID {
|
||||
xmlAttrPtr attr; /* The attribute holding it */
|
||||
const xmlChar *name; /* The attribute if attr is not available */
|
||||
int lineno; /* The line number if attr is not available */
|
||||
struct _xmlDoc *doc; /* The document holding the ID */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -96,6 +96,7 @@ rm -fr %{buildroot}
|
||||
%doc AUTHORS ChangeLog NEWS README Copyright TODO
|
||||
%doc doc/*.html doc/html doc/*.gif doc/*.png
|
||||
%doc doc/tutorial doc/libxml2-api.xml
|
||||
%doc doc/examples
|
||||
|
||||
%{_libdir}/lib*.so
|
||||
%{_libdir}/*a
|
||||
|
35
valid.c
35
valid.c
@ -2358,6 +2358,18 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
|
||||
* IDs *
|
||||
* *
|
||||
************************************************************************/
|
||||
/**
|
||||
* DICT_FREE:
|
||||
* @str: a string
|
||||
*
|
||||
* Free a string if it is not owned by the "dict" dictionnary in the
|
||||
* current scope
|
||||
*/
|
||||
#define DICT_FREE(str) \
|
||||
if ((str) && ((!dict) || \
|
||||
(xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
|
||||
xmlFree((char *)(str));
|
||||
|
||||
/**
|
||||
* xmlCreateIDTable:
|
||||
*
|
||||
@ -2379,14 +2391,21 @@ xmlCreateIDTable(void) {
|
||||
*/
|
||||
static void
|
||||
xmlFreeID(xmlIDPtr id) {
|
||||
xmlDictPtr dict = NULL;
|
||||
|
||||
if (id == NULL) return;
|
||||
|
||||
if (id->doc != NULL)
|
||||
dict = id->doc->dict;
|
||||
|
||||
if (id->value != NULL)
|
||||
xmlFree((xmlChar *) id->value);
|
||||
DICT_FREE(id->value)
|
||||
if (id->name != NULL)
|
||||
xmlFree((xmlChar *) id->name);
|
||||
DICT_FREE(id->name)
|
||||
xmlFree(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlAddID:
|
||||
* @ctxt: the validation context
|
||||
@ -2436,11 +2455,15 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
|
||||
* fill the structure.
|
||||
*/
|
||||
ret->value = xmlStrdup(value);
|
||||
ret->doc = doc;
|
||||
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
|
||||
/*
|
||||
* Operating in streaming mode, attr is gonna disapear
|
||||
*/
|
||||
ret->name = xmlStrdup(attr->name);
|
||||
if (doc->dict != NULL)
|
||||
ret->name = xmlDictLookup(doc->dict, attr->name, -1);
|
||||
else
|
||||
ret->name = xmlStrdup(attr->name);
|
||||
ret->attr = NULL;
|
||||
} else {
|
||||
ret->attr = attr;
|
||||
@ -2546,8 +2569,8 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) {
|
||||
*/
|
||||
int
|
||||
xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
|
||||
xmlAttrPtr cur;
|
||||
xmlIDTablePtr table;
|
||||
xmlIDPtr id;
|
||||
xmlChar *ID;
|
||||
|
||||
if (doc == NULL) return(-1);
|
||||
@ -2561,8 +2584,8 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
|
||||
ID = xmlNodeListGetString(doc, attr->children, 1);
|
||||
if (ID == NULL)
|
||||
return(-1);
|
||||
cur = xmlHashLookup(table, ID);
|
||||
if (cur != attr) {
|
||||
id = xmlHashLookup(table, ID);
|
||||
if (id == NULL || id->attr != attr) {
|
||||
xmlFree(ID);
|
||||
return(-1);
|
||||
}
|
||||
|
71
xmlreader.c
71
xmlreader.c
@ -183,6 +183,62 @@ static int xmlTextReaderNextTree(xmlTextReaderPtr reader);
|
||||
static void xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur);
|
||||
static void xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur);
|
||||
|
||||
/**
|
||||
* xmlFreeID:
|
||||
* @not: A id
|
||||
*
|
||||
* Deallocate the memory used by an id definition
|
||||
*/
|
||||
static void
|
||||
xmlFreeID(xmlIDPtr id) {
|
||||
xmlDictPtr dict = NULL;
|
||||
|
||||
if (id == NULL) return;
|
||||
|
||||
if (id->doc != NULL)
|
||||
dict = id->doc->dict;
|
||||
|
||||
if (id->value != NULL)
|
||||
DICT_FREE(id->value)
|
||||
xmlFree(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderRemoveID:
|
||||
* @doc: the document
|
||||
* @attr: the attribute
|
||||
*
|
||||
* Remove the given attribute from the ID table maintained internally.
|
||||
*
|
||||
* Returns -1 if the lookup failed and 0 otherwise
|
||||
*/
|
||||
static int
|
||||
xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
|
||||
xmlIDTablePtr table;
|
||||
xmlIDPtr id;
|
||||
xmlChar *ID;
|
||||
|
||||
if (doc == NULL) return(-1);
|
||||
if (attr == NULL) return(-1);
|
||||
table = (xmlIDTablePtr) doc->ids;
|
||||
if (table == NULL)
|
||||
return(-1);
|
||||
|
||||
if (attr == NULL)
|
||||
return(-1);
|
||||
ID = xmlNodeListGetString(doc, attr->children, 1);
|
||||
if (ID == NULL)
|
||||
return(-1);
|
||||
id = xmlHashLookup(table, ID);
|
||||
xmlFree(ID);
|
||||
if (id == NULL || id->attr != attr) {
|
||||
return(-1);
|
||||
}
|
||||
id->name = attr->name;
|
||||
id->attr = NULL;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderFreeProp:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -202,7 +258,7 @@ xmlTextReaderFreeProp(xmlTextReaderPtr reader, xmlAttrPtr cur) {
|
||||
((cur->parent->doc->intSubset != NULL) ||
|
||||
(cur->parent->doc->extSubset != NULL))) {
|
||||
if (xmlIsID(cur->parent->doc, cur->parent, cur))
|
||||
xmlRemoveID(cur->parent->doc, cur);
|
||||
xmlTextReaderRemoveID(cur->parent->doc, cur);
|
||||
}
|
||||
if (cur->children != NULL)
|
||||
xmlTextReaderFreeNodeList(reader, cur->children);
|
||||
@ -376,6 +432,17 @@ xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderFreeIDTable:
|
||||
* @table: An id table
|
||||
*
|
||||
* Deallocate the memory used by an ID hash table.
|
||||
*/
|
||||
void
|
||||
xmlTextReaderFreeIDTable(xmlIDTablePtr table) {
|
||||
xmlHashFree(table, (xmlHashDeallocator) xmlFreeID);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderFreeDoc:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -392,7 +459,7 @@ xmlTextReaderFreeDoc(xmlTextReaderPtr reader, xmlDocPtr cur) {
|
||||
/*
|
||||
* Do this before freeing the children list to avoid ID lookups
|
||||
*/
|
||||
if (cur->ids != NULL) xmlFreeIDTable((xmlIDTablePtr) cur->ids);
|
||||
if (cur->ids != NULL) xmlTextReaderFreeIDTable((xmlIDTablePtr) cur->ids);
|
||||
cur->ids = NULL;
|
||||
if (cur->refs != NULL) xmlFreeRefTable((xmlRefTablePtr) cur->refs);
|
||||
cur->refs = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user