Commit 4773df2a authored by Daniel Veillard's avatar Daniel Veillard

added io1.c an example ox xmlIO usage and io1.res test result, fixed a

* doc/examples/*: added io1.c an example ox xmlIO usage and io1.res
  test result, fixed a awful lot of memory leaks showing up in
  testWriter.c, changed the examples and the Makefiles to test
  memory leaks.
* xmlwriter.c: fixed a memory leak
* Makefile.am: run the doc/examples regression tests as part of
  make tests
* xpath.c include/libxml/xpath.h: added xmlXPathCtxtCompile() to
  compile an XPath expression within a context, currently the goal
  is to be able to reuse the XSLT stylesheet dictionnary, but this
  opens the door to others possible optimizations.
* dict.c include/libxml/dict.h: added xmlDictCreateSub() which allows
  to build a new dictionnary based on another read-only dictionnary.
  This is needed for XSLT to keep the stylesheet dictionnary read-only
  while being able to reuse the strings for the transformation
  dictionnary.
* xinclude.c: fixed a dictionnar reference counting problem occuring
  when document parsing failed.
* testSAX.c: adding option --repeat for timing 100times the parsing
* doc/* : rebuilt all the docs
Daniel
parent e9f0811a
Fri Jan 23 14:03:21 CET 2004 Daniel Veillard <daniel@veillard.com>
* doc/examples/*: added io1.c an example ox xmlIO usage and io1.res
test result, fixed a awful lot of memory leaks showing up in
testWriter.c, changed the examples and the Makefiles to test
memory leaks.
* xmlwriter.c: fixed a memory leak
* Makefile.am: run the doc/examples regression tests as part of
make tests
* xpath.c include/libxml/xpath.h: added xmlXPathCtxtCompile() to
compile an XPath expression within a context, currently the goal
is to be able to reuse the XSLT stylesheet dictionnary, but this
opens the door to others possible optimizations.
* dict.c include/libxml/dict.h: added xmlDictCreateSub() which allows
to build a new dictionnary based on another read-only dictionnary.
This is needed for XSLT to keep the stylesheet dictionnary read-only
while being able to reuse the strings for the transformation
dictionnary.
* xinclude.c: fixed a dictionnar reference counting problem occuring
when document parsing failed.
* testSAX.c: adding option --repeat for timing 100times the parsing
* doc/* : rebuilt all the docs
Thu Jan 22 14:17:05 2004 Aleksey Sanin <aleksey@aleksey.com>
* xmlmemory.c: make xmlReallocLoc() accept NULL pointer
......
......@@ -124,6 +124,7 @@ testall : tests SVGtests SAXtests
tests: XMLtests XMLenttests NStests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@
@(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; $(MAKE) tests ; fi)
@(cd doc/examples ; $(MAKE) tests)
valgrind:
@echo '## Running the regression tests under Valgrind'
......
......@@ -65,6 +65,8 @@ struct _xmlDict {
int size;
int nbElems;
xmlDictStringsPtr strings;
struct _xmlDict *subdict;
};
/*
......@@ -181,11 +183,12 @@ found_pool:
* Calculate the hash key
*/
static unsigned long
xmlDictComputeKey(xmlDictPtr dict, const xmlChar *name, int namelen) {
xmlDictComputeKey(const xmlChar *name, int namelen) {
unsigned long value = 0L;
if (name == NULL) return(0);
value += 30 * (*name);
value = *name;
value <<= 5;
if (namelen > 10) {
value += name[namelen - 1];
namelen = 10;
......@@ -200,10 +203,9 @@ xmlDictComputeKey(xmlDictPtr dict, const xmlChar *name, int namelen) {
case 4: value += name[3];
case 3: value += name[2];
case 2: value += name[1];
case 1: value += name[0];
default: break;
}
return (value % dict->size);
return(value);
}
/*
......@@ -211,14 +213,13 @@ xmlDictComputeKey(xmlDictPtr dict, const xmlChar *name, int namelen) {
* Calculate the hash key
*/
static unsigned long
xmlDictComputeQKey(xmlDictPtr dict, const xmlChar *prefix,
const xmlChar *name, int len)
xmlDictComputeQKey(const xmlChar *prefix, const xmlChar *name, int len)
{
unsigned long value = 0L;
int plen;
if (prefix == NULL)
return(xmlDictComputeKey(dict, name, len));
return(xmlDictComputeKey(name, len));
plen = xmlStrlen(prefix);
if (plen == 0)
......@@ -263,7 +264,7 @@ xmlDictComputeQKey(xmlDictPtr dict, const xmlChar *prefix,
case 1: value += name[0];
default: break;
}
return (value % dict->size);
return(value);
}
/**
......@@ -271,7 +272,7 @@ xmlDictComputeQKey(xmlDictPtr dict, const xmlChar *prefix,
*
* Create a new dictionary
*
* Returns the newly created object, or NULL if an error occured.
* Returns the newly created dictionnary, or NULL if an error occured.
*/
xmlDictPtr
xmlDictCreate(void) {
......@@ -285,6 +286,7 @@ xmlDictCreate(void) {
dict->nbElems = 0;
dict->dict = xmlMalloc(MIN_DICT_SIZE * sizeof(xmlDictEntry));
dict->strings = NULL;
dict->subdict = NULL;
if (dict->dict) {
memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
return(dict);
......@@ -294,6 +296,28 @@ xmlDictCreate(void) {
return(NULL);
}
/**
* xmlDictCreateSub:
* @sub: an existing dictionnary
*
* Create a new dictionary, inheriting strings from the read-only
* dictionnary @sub. On lookup, strings are first searched in the
* new dictionnary, then in @sub, and if not found are created in the
* new dictionnary.
*
* Returns the newly created dictionnary, or NULL if an error occured.
*/
xmlDictPtr
xmlDictCreateSub(xmlDictPtr sub) {
xmlDictPtr dict = xmlDictCreate();
if ((dict != NULL) && (sub != NULL)) {
dict->subdict = sub;
xmlDictReference(dict->subdict);
}
return(dict);
}
/**
* xmlDictReference:
* @dict: the dictionnary
......@@ -357,7 +381,7 @@ xmlDictGrow(xmlDictPtr dict, int size) {
for (i = 0; i < oldsize; i++) {
if (olddict[i].valid == 0)
continue;
key = xmlDictComputeKey(dict, olddict[i].name, olddict[i].len);
key = xmlDictComputeKey(olddict[i].name, olddict[i].len) % dict->size;
memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry));
dict->dict[key].next = NULL;
#ifdef DEBUG_GROW
......@@ -374,7 +398,7 @@ xmlDictGrow(xmlDictPtr dict, int size) {
* put back the entry in the new dict
*/
key = xmlDictComputeKey(dict, iter->name, iter->len);
key = xmlDictComputeKey(iter->name, iter->len) % dict->size;
if (dict->dict[key].valid == 0) {
memcpy(&(dict->dict[key]), iter, sizeof(xmlDictEntry));
dict->dict[key].next = NULL;
......@@ -425,6 +449,10 @@ xmlDictFree(xmlDictPtr dict) {
dict->ref_counter--;
if (dict->ref_counter > 0) return;
if (dict->subdict != NULL) {
xmlDictFree(dict->subdict);
}
if (dict->dict) {
for(i = 0; ((i < dict->size) && (dict->nbElems > 0)); i++) {
iter = &(dict->dict[i]);
......@@ -464,7 +492,7 @@ xmlDictFree(xmlDictPtr dict) {
*/
const xmlChar *
xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
unsigned long key, nbi = 0;
unsigned long key, okey, nbi = 0;
xmlDictEntryPtr entry;
xmlDictEntryPtr insert;
const xmlChar *ret;
......@@ -478,7 +506,8 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
/*
* Check for duplicate and insertion location.
*/
key = xmlDictComputeKey(dict, name, len);
okey = xmlDictComputeKey(name, len);
key = okey % dict->size;
if (dict->dict[key].valid == 0) {
insert = NULL;
} else {
......@@ -486,8 +515,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
insert = insert->next) {
#ifdef __GNUC__
if (insert->len == len) {
register int tmp = memcmp(insert->name, name, len);
if (!tmp)
if (!memcmp(insert->name, name, len))
return(insert->name);
}
#else
......@@ -499,8 +527,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
}
#ifdef __GNUC__
if (insert->len == len) {
register int tmp = memcmp(insert->name, name, len);
if (!tmp)
if (!memcmp(insert->name, name, len))
return(insert->name);
}
#else
......@@ -510,6 +537,39 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
#endif
}
if (dict->subdict) {
key = okey % dict->subdict->size;
if (dict->subdict->dict[key].valid != 0) {
xmlDictEntryPtr tmp;
for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL;
tmp = tmp->next) {
#ifdef __GNUC__
if (tmp->len == len) {
if (!memcmp(tmp->name, name, len))
return(tmp->name);
}
#else
if ((tmp->len == len) &&
(!xmlStrncmp(tmp->name, name, len)))
return(tmp->name);
#endif
nbi++;
}
#ifdef __GNUC__
if (tmp->len == len) {
if (!memcmp(tmp->name, name, len))
return(tmp->name);
}
#else
if ((tmp->len == len) &&
(!xmlStrncmp(tmp->name, name, len)))
return(tmp->name);
#endif
}
key = okey % dict->size;
}
ret = xmlDictAddString(dict, name, len);
if (ret == NULL)
return(NULL);
......@@ -551,7 +611,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
*/
const xmlChar *
xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
unsigned long key, nbi = 0;
unsigned long okey, key, nbi = 0;
xmlDictEntryPtr entry;
xmlDictEntryPtr insert;
const xmlChar *ret;
......@@ -567,7 +627,8 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
/*
* Check for duplicate and insertion location.
*/
key = xmlDictComputeQKey(dict, prefix, name, len);
okey = xmlDictComputeQKey(prefix, name, len);
key = okey % dict->size;
if (dict->dict[key].valid == 0) {
insert = NULL;
} else {
......@@ -583,6 +644,24 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
return(insert->name);
}
if (dict->subdict) {
key = okey % dict->subdict->size;
if (dict->subdict->dict[key].valid != 0) {
xmlDictEntryPtr tmp;
for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL;
tmp = tmp->next) {
if ((tmp->len == len) &&
(xmlStrQEqual(prefix, name, tmp->name)))
return(tmp->name);
nbi++;
}
if ((tmp->len == len) &&
(xmlStrQEqual(prefix, name, tmp->name)))
return(tmp->name);
}
key = okey % dict->size;
}
ret = xmlDictAddQString(dict, prefix, name, len);
if (ret == NULL)
return(NULL);
......@@ -633,6 +712,8 @@ xmlDictOwns(xmlDictPtr dict, const xmlChar *str) {
return(1);
pool = pool->next;
}
if (dict->subdict)
return(xmlDictOwns(dict->subdict, str));
return(0);
}
......@@ -649,6 +730,8 @@ int
xmlDictSize(xmlDictPtr dict) {
if (dict == NULL)
return(-1);
if (dict->subdict)
return(dict->nbElems + dict->subdict->nbElems);
return(dict->nbElems);
}
......
......@@ -335,8 +335,12 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>dict</dt><dd><a href="html/libxml-tree.html#_xmlDoc">_xmlDoc</a><br />
</dd><dt>dictionary</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
<a href="html/libxml-dict.html#xmlDictCreate">xmlDictCreate</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-dict.html#xmlDictReference">xmlDictReference</a><br />
</dd><dt>dictionnary</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
<a href="html/libxml-xpath.html#_xmlXPathContext">_xmlXPathContext</a><br />
<a href="html/libxml-dict.html#xmlDictCreate">xmlDictCreate</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-dict.html#xmlDictFree">xmlDictFree</a><br />
<a href="html/libxml-dict.html#xmlDictLookup">xmlDictLookup</a><br />
<a href="html/libxml-dict.html#xmlDictOwns">xmlDictOwns</a><br />
......
......@@ -289,6 +289,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parserInternals.html#xmlEntityReferenceFunc">xmlEntityReferenceFunc</a><br />
<a href="html/libxml-tree.html#xmlNodeGetSpacePreserve">xmlNodeGetSpacePreserve</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNextAttribute">xmlXPathNextAttribute</a><br />
</dd><dt>inheriting</dt><dd><a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
</dd><dt>inherits</dt><dd><a href="html/libxml-tree.html#xmlNewChild">xmlNewChild</a><br />
<a href="html/libxml-tree.html#xmlNewTextChild">xmlNewTextChild</a><br />
</dd><dt>initial</dt><dd><a href="html/libxml-tree.html#_xmlDoc">_xmlDoc</a><br />
......
......@@ -53,6 +53,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parserInternals.html#xmlParseMarkupDecl">xmlParseMarkupDecl</a><br />
</dd><dt>occured</dt><dd><a href="html/libxml-xmlerror.html#xmlCtxtGetLastError">xmlCtxtGetLastError</a><br />
<a href="html/libxml-dict.html#xmlDictCreate">xmlDictCreate</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-xmlerror.html#xmlGetLastError">xmlGetLastError</a><br />
<a href="html/libxml-hash.html#xmlHashCreate">xmlHashCreate</a><br />
<a href="html/libxml-list.html#xmlListRemoveFirst">xmlListRemoveFirst</a><br />
......
......@@ -106,6 +106,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-threads.html#xmlUnlockLibrary">xmlUnlockLibrary</a><br />
</dd><dt>reached</dt><dd><a href="html/libxml-xmlregexp.html#xmlRegExecPushString">xmlRegExecPushString</a><br />
<a href="html/libxml-xmlregexp.html#xmlRegExecPushString2">xmlRegExecPushString2</a><br />
</dd><dt>read-only</dt><dd><a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
</dd><dt>readable</dt><dd><a href="html/libxml-xmlstring.html#xmlStrEqual">xmlStrEqual</a><br />
</dd><dt>reader</dt><dd><a href="html/libxml-parser.html#xmlCtxtReadFd">xmlCtxtReadFd</a><br />
<a href="html/libxml-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a><br />
......
......@@ -136,6 +136,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlstring.html#xmlStrcasestr">xmlStrcasestr</a><br />
<a href="html/libxml-xmlstring.html#xmlStrchr">xmlStrchr</a><br />
<a href="html/libxml-xmlstring.html#xmlStrstr">xmlStrstr</a><br />
</dd><dt>searched</dt><dd><a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
</dd><dt>section</dt><dd><a href="html/libxml-HTMLtree.html#HTML_PRESERVE_NODE">HTML_PRESERVE_NODE</a><br />
<a href="html/libxml-uri.html#xmlBuildURI">xmlBuildURI</a><br />
<a href="html/libxml-catalog.html#xmlCatalogSetDefaultPrefer">xmlCatalogSetDefaultPrefer</a><br />
......@@ -603,6 +604,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathStringLengthFunction">xmlXPathStringLengthFunction</a><br />
</dd><dt>stringi</dt><dd><a href="html/libxml-xpathInternals.html#xmlXPathSubstringAfterFunction">xmlXPathSubstringAfterFunction</a><br />
</dd><dt>strings</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-parser.html#xmlGetFeaturesList">xmlGetFeaturesList</a><br />
<a href="html/libxml-pattern.html#xmlPatterncompile">xmlPatterncompile</a><br />
<a href="html/libxml-xmlregexp.html#xmlRegexpCompile">xmlRegexpCompile</a><br />
......
......@@ -243,6 +243,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</p><h2>Type xmlDeregisterNodeFunc:</h2><p><a href="html/libxml-globals.html#xmlDeregisterNodeDefault">xmlDeregisterNodeDefault</a><br />
<a href="html/libxml-globals.html#xmlThrDefDeregisterNodeDefault">xmlThrDefDeregisterNodeDefault</a><br />
</p><h2>Type xmlDictPtr:</h2><p><a href="html/libxml-dict.html#xmlDictCreate">xmlDictCreate</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
</p><h2>Type xmlDocPtr:</h2><p><a href="html/libxml-tree.html#xmlCopyDoc">xmlCopyDoc</a><br />
<a href="html/libxml-parser.html#xmlCtxtReadDoc">xmlCtxtReadDoc</a><br />
<a href="html/libxml-parser.html#xmlCtxtReadFd">xmlCtxtReadFd</a><br />
......@@ -470,6 +471,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</p><h2>Type xmlValidCtxtPtr:</h2><p><a href="html/libxml-valid.html#xmlNewValidCtxt">xmlNewValidCtxt</a><br />
</p><h2>Type xmlXIncludeCtxtPtr:</h2><p><a href="html/libxml-xinclude.html#xmlXIncludeNewContext">xmlXIncludeNewContext</a><br />
</p><h2>Type xmlXPathCompExprPtr:</h2><p><a href="html/libxml-xpath.html#xmlXPathCompile">xmlXPathCompile</a><br />
<a href="html/libxml-xpath.html#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a><br />
</p><h2>Type xmlXPathContextPtr:</h2><p><a href="html/libxml-xpath.html#xmlXPathNewContext">xmlXPathNewContext</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrNewContext">xmlXPtrNewContext</a><br />
</p><h2>Type xmlXPathFunction:</h2><p><a href="html/libxml-xpathInternals.html#xmlXPathFuncLookupFunc">xmlXPathFuncLookupFunc</a><br />
......
......@@ -320,6 +320,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-debugXML.html#xmlShellWrite">xmlShellWrite</a><br />
</p><h2><a name="dict" id="dict">Module dict</a>:</h2><p><a href="html/libxml-dict.html#xmlDict">xmlDict</a><br />
<a href="html/libxml-dict.html#xmlDictCreate">xmlDictCreate</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-dict.html#xmlDictFree">xmlDictFree</a><br />
<a href="html/libxml-dict.html#xmlDictLookup">xmlDictLookup</a><br />
<a href="html/libxml-dict.html#xmlDictOwns">xmlDictOwns</a><br />
......@@ -2635,6 +2636,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathConvertFunc">xmlXPathConvertFunc</a><br />
<a href="html/libxml-xpath.html#xmlXPathConvertNumber">xmlXPathConvertNumber</a><br />
<a href="html/libxml-xpath.html#xmlXPathConvertString">xmlXPathConvertString</a><br />
<a href="html/libxml-xpath.html#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a><br />
<a href="html/libxml-xpath.html#xmlXPathError">xmlXPathError</a><br />
<a href="html/libxml-xpath.html#xmlXPathEval">xmlXPathEval</a><br />
<a href="html/libxml-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a><br />
......
......@@ -443,6 +443,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathCastStringToBoolean">xmlXPathCastStringToBoolean</a><br />
<a href="html/libxml-xpath.html#xmlXPathCastStringToNumber">xmlXPathCastStringToNumber</a><br />
<a href="html/libxml-xpath.html#xmlXPathCompile">xmlXPathCompile</a><br />
<a href="html/libxml-xpath.html#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a><br />
<a href="html/libxml-xpath.html#xmlXPathEval">xmlXPathEval</a><br />
<a href="html/libxml-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathFuncLookupFunc">xmlXPathFuncLookupFunc</a><br />
......@@ -997,7 +998,8 @@ A:link, A:visited, A:active { text-decoration: underline }
</p><h2>Type xmlDeregisterNodeFunc:</h2><p><a href="html/libxml-globals.html#xmlDeregisterNodeDefault">xmlDeregisterNodeDefault</a><br />
<a href="html/libxml-globals.html#xmlThrDefDeregisterNodeDefault">xmlThrDefDeregisterNodeDefault</a><br />
</p><h2>Type xmlDict *:</h2><p><a href="html/libxml-pattern.html#xmlPatterncompile">xmlPatterncompile</a><br />
</p><h2>Type xmlDictPtr:</h2><p><a href="html/libxml-dict.html#xmlDictFree">xmlDictFree</a><br />
</p><h2>Type xmlDictPtr:</h2><p><a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-dict.html#xmlDictFree">xmlDictFree</a><br />
<a href="html/libxml-dict.html#xmlDictLookup">xmlDictLookup</a><br />
<a href="html/libxml-dict.html#xmlDictOwns">xmlDictOwns</a><br />
<a href="html/libxml-dict.html#xmlDictQLookup">xmlDictQLookup</a><br />
......@@ -1921,6 +1923,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathDebugDumpCompExpr">xmlXPathDebugDumpCompExpr</a><br />
<a href="html/libxml-xpath.html#xmlXPathFreeCompExpr">xmlXPathFreeCompExpr</a><br />
</p><h2>Type xmlXPathContextPtr:</h2><p><a href="html/libxml-xpath.html#xmlXPathCompiledEval">xmlXPathCompiledEval</a><br />
<a href="html/libxml-xpath.html#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a><br />
<a href="html/libxml-xpath.html#xmlXPathEval">xmlXPathEval</a><br />
<a href="html/libxml-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a><br />
<a href="html/libxml-xpath.html#xmlXPathEvalPredicate">xmlXPathEvalPredicate</a><br />
......
......@@ -1402,6 +1402,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-encoding.html#xmlDetectCharEncoding">xmlDetectCharEncoding</a><br />
<a href="html/libxml-dict.html#xmlDict">xmlDict</a><br />
<a href="html/libxml-dict.html#xmlDictCreate">xmlDictCreate</a><br />
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-dict.html#xmlDictFree">xmlDictFree</a><br />
<a href="html/libxml-dict.html#xmlDictLookup">xmlDictLookup</a><br />
<a href="html/libxml-dict.html#xmlDictOwns">xmlDictOwns</a><br />
......@@ -2654,6 +2655,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathConvertNumber">xmlXPathConvertNumber</a><br />
<a href="html/libxml-xpath.html#xmlXPathConvertString">xmlXPathConvertString</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathCountFunction">xmlXPathCountFunction</a><br />
<a href="html/libxml-xpath.html#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathDebugDumpCompExpr">xmlXPathDebugDumpCompExpr</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathDebugDumpObject">xmlXPathDebugDumpObject</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathDifference">xmlXPathDifference</a><br />
......
......@@ -10,3 +10,4 @@ testWriter
reader1
reader2
reader3
io1
......@@ -19,9 +19,9 @@ install-data-local:
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(TARGET_DIR)
EXTRA_DIST=examples.xsl index.py test1.xml examples.xml test2.xml writer.xml test3.xml reader1.res reader3.res tree1.res tree2.res
EXTRA_DIST=examples.xsl index.py test1.xml examples.xml test2.xml writer.xml test3.xml reader1.res reader3.res tree1.res tree2.res io1.res
noinst_PROGRAMS=xpath1 parse1 parse2 tree1 tree2 testWriter reader1 reader2 reader3
noinst_PROGRAMS=xpath1 parse1 parse2 tree1 tree2 testWriter reader1 reader2 reader3 io1
xpath1_SOURCES=xpath1.c
xpath1_LDFLAGS=
......@@ -68,14 +68,30 @@ reader3_LDFLAGS=
reader3_DEPENDENCIES= $(DEPS)
reader3_LDADD= @RDL_LIBS@ $(LDADDS)
io1_SOURCES=io1.c
io1_LDFLAGS=
io1_DEPENDENCIES= $(DEPS)
io1_LDADD= @RDL_LIBS@ $(LDADDS)
tests: $(noinst_PROGRAMS)
@(echo > .memdump)
@(parse1 test1.xml)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(parse2 test2.xml)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
@(io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
......@@ -13,25 +13,27 @@
<include>&lt;libxml/tree.h&gt;</include>
</includes>
<uses>
<typedef line='80' file='xpath' name='xmlXPathObjectPtr'/>
<enum line='221' file='tree' name='XML_ELEMENT_NODE'/>
<function line='109' file='xpath' name='xmlXPathEvalExpression'/>
<function line='178' file='xpathInternals' name='xmlXPathRegisterNs'/>
<function line='121' file='xpath' name='xmlXPathFreeObject'/>
<typedef line='78' file='tree' name='xmlDocPtr'/>
<typedef line='210' file='tree' name='xmlNsPtr'/>
<function line='93' file='xpath' name='xmlXPathNewContext'/>
<enum line='225' file='tree' name='XML_ELEMENT_NODE'/>
<typedef line='84' file='xpath' name='xmlXPathObjectPtr'/>
<function line='50' file='xmlmemory' name='xmlMemoryDump'/>
<function line='113' file='xpath' name='xmlXPathEvalExpression'/>
<function line='182' file='xpathInternals' name='xmlXPathRegisterNs'/>
<function line='125' file='xpath' name='xmlXPathFreeObject'/>
<typedef line='82' file='tree' name='xmlDocPtr'/>
<typedef line='214' file='tree' name='xmlNsPtr'/>
<function line='97' file='xpath' name='xmlXPathNewContext'/>
<typedef line='202' file='tree' name='xmlNodePtr'/>
<function line='45' file='parser' name='xmlCleanupParser'/>
<macro line='39' file='xmlversion' name='LIBXML_TEST_VERSION'/>
<typedef line='79' file='xpath' name='xmlXPathContextPtr'/>
<function line='122' file='xpath' name='xmlXPathFreeContext'/>
<typedef line='83' file='xpath' name='xmlXPathContextPtr'/>
<function line='126' file='xpath' name='xmlXPathFreeContext'/>
<function line='35' file='parser' name='xmlInitParser'/>
<function line='148' file='parser' name='xmlStrdup'/>
<function line='123' file='tree' name='xmlFreeDoc'/>
<function line='172' file='parser' name='xmlStrchr'/>
<typedef line='198' file='tree' name='xmlNodePtr'/>
<function line='86' file='parser' name='xmlParseFile'/>
<enum line='209' file='tree' name='XML_NAMESPACE_DECL'/>
<function line='152' file='xmlstring' name='xmlStrdup'/>
<function line='127' file='tree' name='xmlFreeDoc'/>
<function line='176' file='xmlstring' name='xmlStrchr'/>
<variable line='189' file='globals' name='xmlFree'/>
<function line='90' file='parser' name='xmlParseFile'/>
<enum line='213' file='tree' name='XML_NAMESPACE_DECL'/>
</uses>
</example>
<example filename='parse1.c'>
......@@ -49,9 +51,10 @@
<uses>
<function line='50' file='parser' name='xmlCleanupParser'/>
<macro line='45' file='xmlversion' name='LIBXML_TEST_VERSION'/>
<typedef line='24' file='tree' name='xmlDocPtr'/>
<function line='31' file='tree' name='xmlFreeDoc'/>
<function line='26' file='parser' name='xmlReadFile'/>
<typedef line='24' file='tree' name='xmlDocPtr'/>
<function line='54' file='xmlmemory' name='xmlMemoryDump'/>
</uses>
</example>
<example filename='parse2.c'>
......@@ -76,6 +79,7 @@
<function line='35' file='parser' name='xmlCtxtReadFile'/>
<function line='44' file='tree' name='xmlFreeDoc'/>
<typedef line='26' file='tree' name='xmlDocPtr'/>
<function line='70' file='xmlmemory' name='xmlMemoryDump'/>
</uses>
</example>
<example filename='tree1.c'>
......@@ -113,6 +117,7 @@
</includes>
<uses>
<function line='73' file='tree' name='xmlNewText'/>
<function line='108' file='xmlmemory' name='xmlMemoryDump'/>
<function line='94' file='tree' name='xmlSaveFormatFileEnc'/>
<function line='76' file='tree' name='xmlAddChild'/>
<function line='39' file='tree' name='xmlDocSetRootElement'/>
......@@ -139,36 +144,39 @@
<include>&lt;libxml/xmlwriter.h&gt;</include>
</includes>
<uses>
<function line='1075' file='xmlwriter' name='xmlTextWriterEndElement'/>
<function line='880' file='xmlwriter' name='xmlTextWriterStartDocument'/>
<function line='1085' file='xmlwriter' name='xmlTextWriterEndDocument'/>
<function line='925' file='xmlwriter' name='xmlTextWriterWriteFormatComment'/>
<function line='890' file='xmlwriter' name='xmlTextWriterWriteComment'/>
<variable line='1147' file='globals' name='xmlRealloc'/>
<function line='1037' file='xmlwriter' name='xmlTextWriterWriteFormatElement'/>
<function line='1120' file='encoding' name='xmlFindCharEncodingHandler'/>
<typedef line='1115' file='encoding' name='xmlCharEncodingHandlerPtr'/>
<function line='871' file='xmlwriter' name='xmlNewTextWriterTree'/>
<function line='58' file='xmlwriter' name='xmlNewTextWriterFilename'/>
<function line='1095' file='tree' name='xmlFreeDoc'/>
<typedef line='848' file='tree' name='xmlNodePtr'/>
<typedef line='847' file='tree' name='xmlDocPtr'/>
<typedef line='320' file='tree' name='xmlBufferPtr'/>
<function line='603' file='xmlwriter' name='xmlNewTextWriterDoc'/>
<function line='861' file='tree' name='xmlNewDocNode'/>
<function line='1093' file='tree' name='xmlSaveFileEnc'/>
<macro line='852' file='parser' name='XML_DEFAULT_VERSION'/>
<function line='333' file='xmlwriter' name='xmlNewTextWriterMemory'/>
<variable line='1144' file='globals' name='xmlFree'/>
<function line='868' file='tree' name='xmlDocSetRootElement'/>
<function line='1091' file='xmlwriter' name='xmlFreeTextWriter'/>
<function line='1060' file='xmlwriter' name='xmlTextWriterStartElement'/>
<variable line='1130' file='globals' name='xmlMalloc'/>
<function line='325' file='tree' name='xmlBufferCreate'/>
<typedef line='846' file='xmlwriter' name='xmlTextWriterPtr'/>
<function line='1067' file='xmlwriter' name='xmlTextWriterWriteElement'/>
<function line='916' file='xmlwriter' name='xmlTextWriterWriteAttribute'/>
<function line='852' file='tree' name='xmlNewDoc'/>
<function line='1090' file='xmlwriter' name='xmlTextWriterEndElement'/>
<function line='895' file='xmlwriter' name='xmlTextWriterStartDocument'/>
<function line='1100' file='xmlwriter' name='xmlTextWriterEndDocument'/>
<function line='940' file='xmlwriter' name='xmlTextWriterWriteFormatComment'/>
<function line='905' file='xmlwriter' name='xmlTextWriterWriteComment'/>
<function line='52' file='parser' name='xmlCleanupParser'/>
<variable line='1145' file='globals' name='xmlMalloc'/>
<function line='1052' file='xmlwriter' name='xmlTextWriterWriteFormatElement'/>
<function line='1135' file='encoding' name='xmlFindCharEncodingHandler'/>
<typedef line='1130' file='encoding' name='xmlCharEncodingHandlerPtr'/>
<function line='886' file='xmlwriter' name='xmlNewTextWriterTree'/>
<function line='73' file='xmlwriter' name='xmlNewTextWriterFilename'/>
<function line='1110' file='tree' name='xmlFreeDoc'/>
<typedef line='863' file='tree' name='xmlNodePtr'/>
<typedef line='862' file='tree' name='xmlDocPtr'/>
<typedef line='335' file='tree' name='xmlBufferPtr'/>
<function line='618' file='xmlwriter' name='xmlNewTextWriterDoc'/>
<function line='876' file='tree' name='xmlNewDocNode'/>
<function line='1108' file='tree' name='xmlSaveFileEnc'/>
<function line='56' file='xmlmemory' name='xmlMemoryDump'/>
<macro line='867' file='parser' name='XML_DEFAULT_VERSION'/>
<function line='348' file='xmlwriter' name='xmlNewTextWriterMemory'/>
<variable line='1159' file='globals' name='xmlFree'/>
<function line='883' file='tree' name='xmlDocSetRootElement'/>
<function line='1106' file='xmlwriter' name='xmlFreeTextWriter'/>
<function line='1075' file='xmlwriter' name='xmlTextWriterStartElement'/>
<macro line='38' file='xmlversion' name='LIBXML_TEST_VERSION'/>
<function line='340' file='tree' name='xmlBufferCreate'/>
<typedef line='861' file='xmlwriter' name='xmlTextWriterPtr'/>
<function line='1082' file='xmlwriter' name='xmlTextWriterWriteElement'/>
<function line='931' file='xmlwriter' name='xmlTextWriterWriteAttribute'/>
<variable line='1162' file='globals' name='xmlRealloc'/>
<function line='867' file='tree' name='xmlNewDoc'/>
</uses>
</example>
<example filename='reader1.c'>
......@@ -183,14 +191,13 @@
<include>&lt;libxml/xmlreader.h&gt;</include>
</includes>
<uses>
<function line='40' file='parser' name='xmlStrlen'/>
<function line='90' file='parser' name='xmlCleanupParser'/>
<function line='40' file='xmlstring' name='xmlStrlen'/>
<function line='33' file='xmlreader' name='xmlTextReaderNodeType'/>
<typedef line='55' file='xmlreader' name='xmlTextReaderPtr'/>
<function line='94' file='xmlmemory' name='xmlMemoryDump'/>
<function line='29' file='xmlreader' name='xmlTextReaderConstValue'/>
<function line='32' file='xmlreader' name='xmlTextReaderDepth'/>
<function line='65' file='xmlreader' name='xmlFreeTextReader'/>
<macro line='85' file='xmlversion' name='LIBXML_TEST_VERSION'/>
<function line='25' file='xmlreader' name='xmlTextReaderConstName'/>
<function line='36' file='xmlreader' name='xmlTextReaderHasValue'/>
<function line='63' file='xmlreader' name='xmlTextReaderRead'/>
......@@ -210,7 +217,7 @@
<include>&lt;libxml/xmlreader.h&gt;</include>
</includes>
<uses>
<function line='41' file='parser' name='xmlStrlen'/>
<function line='41' file='xmlstring' name='xmlStrlen'/>
<function line='34' file='xmlreader' name='xmlTextReaderNodeType'/>
<typedef line='56' file='xmlreader' name='xmlTextReaderPtr'/>
<function line='30' file='xmlreader' name='xmlTextReaderConstValue'/>
......@@ -249,6 +256,28 @@
<typedef line='72' file='tree' name='xmlDocPtr'/>
</uses>
</example>
<example filename='io1.c'>
<synopsis>Example of custom Input/Output</synopsis>
<purpose>Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way.</purpose>
<usage>io1</usage>
<test>io1 &gt; io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp</test>
<author>Daniel Veillard</author>
<copy>see Copyright for the status of this software. </copy>
<section>InputOutput</section>
<includes>
<include>&lt;libxml/parser.h&gt;</include>
<include>&lt;libxml/xinclude.h&gt;</include>
<include>&lt;libxml/tree.h&gt;</include>
<include>&lt;libxml/xmlIO.h&gt;</include>
</includes>