mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +03:00
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
This commit is contained in:
parent
e9f0811a2f
commit
4773df2a58
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
||||
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'
|
||||
|
121
dict.c
121
dict.c
@ -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><libxml/tree.h></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><libxml/xmlwriter.h></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><libxml/xmlreader.h></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><libxml/xmlreader.h></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 > 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><libxml/parser.h></include>
|
||||
<include><libxml/xinclude.h></include>
|
||||
<include><libxml/tree.h></include>
|
||||
<include><libxml/xmlIO.h></include>
|
||||
</includes>
|
||||
<uses>
|
||||
<function line='139' file='tree' name='xmlDocDump'/>
|
||||
<function line='132' file='xinclude' name='xmlXIncludeProcess'/>
|
||||
<function line='116' file='xmlIO' name='xmlRegisterInputCallbacks'/>
|
||||
<function line='123' file='parser' name='xmlReadMemory'/>
|
||||
<typedef line='104' file='tree' name='xmlDocPtr'/>
|
||||
</uses>
|
||||
</example>
|
||||
<symbols>
|
||||
<symbol name='LIBXML_TEST_VERSION'>
|
||||
<ref filename='xpath1.c'/>
|
||||
@ -256,7 +285,7 @@
|
||||
<ref filename='parse2.c'/>
|
||||
<ref filename='tree1.c'/>
|
||||
<ref filename='tree2.c'/>
|
||||
<ref filename='reader1.c'/>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='XML_DEFAULT_VERSION'>
|
||||
<ref filename='testWriter.c'/>
|
||||
@ -296,7 +325,7 @@
|
||||
<ref filename='parse2.c'/>
|
||||
<ref filename='tree1.c'/>
|
||||
<ref filename='tree2.c'/>
|
||||
<ref filename='reader1.c'/>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlCreateIntSubset'>
|
||||
<ref filename='tree2.c'/>
|
||||
@ -306,6 +335,7 @@
|
||||
</symbol>
|
||||
<symbol name='xmlDocDump'>
|
||||
<ref filename='reader3.c'/>
|
||||
<ref filename='io1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlDocGetRootElement'>
|
||||
<ref filename='tree1.c'/>
|
||||
@ -316,6 +346,7 @@
|
||||
<ref filename='parse2.c'/>
|
||||
<ref filename='testWriter.c'/>
|
||||
<ref filename='reader3.c'/>
|
||||
<ref filename='io1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlDocSetRootElement'>
|
||||
<ref filename='tree2.c'/>
|
||||
@ -325,6 +356,7 @@
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlFree'>
|
||||
<ref filename='xpath1.c'/>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlFreeDoc'>
|
||||
@ -352,6 +384,14 @@
|
||||
<symbol name='xmlMalloc'>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlMemoryDump'>
|
||||
<ref filename='xpath1.c'/>
|
||||
<ref filename='parse1.c'/>
|
||||
<ref filename='parse2.c'/>
|
||||
<ref filename='tree2.c'/>
|
||||
<ref filename='testWriter.c'/>
|
||||
<ref filename='reader1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlNewChild'>
|
||||
<ref filename='tree2.c'/>
|
||||
</symbol>
|
||||
@ -403,6 +443,9 @@
|
||||
<symbol name='xmlReadFile'>
|
||||
<ref filename='parse1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlReadMemory'>
|
||||
<ref filename='io1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlReaderForFile'>
|
||||
<ref filename='reader1.c'/>
|
||||
<ref filename='reader2.c'/>
|
||||
@ -411,6 +454,9 @@
|
||||
<symbol name='xmlRealloc'>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlRegisterInputCallbacks'>
|
||||
<ref filename='io1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlSaveFileEnc'>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
@ -500,6 +546,9 @@
|
||||
<symbol name='xmlTextWriterWriteFormatElement'>
|
||||
<ref filename='testWriter.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlXIncludeProcess'>
|
||||
<ref filename='io1.c'/>
|
||||
</symbol>
|
||||
<symbol name='xmlXPathContextPtr'>
|
||||
<ref filename='xpath1.c'/>
|
||||
</symbol>
|
||||
@ -523,6 +572,9 @@
|
||||
</symbol>
|
||||
</symbols>
|
||||
<sections>
|
||||
<section name='InputOutput'>
|
||||
<example filename='io1.c'/>
|
||||
</section>
|
||||
<section name='Parsing'>
|
||||
<example filename='parse1.c'/>
|
||||
<example filename='parse2.c'/>
|
||||
|
File diff suppressed because one or more lines are too long
@ -252,8 +252,10 @@ install-data-local:
|
||||
Makefile = Makefile + "%s_SOURCES=%s.c\n%s_LDFLAGS=\n%s_DEPENDENCIES= $(DEPS)\n%s_LDADD= @RDL_LIBS@ $(LDADDS)\n\n" % (example, example, example,
|
||||
example, example)
|
||||
Makefile = Makefile + "tests: $(noinst_PROGRAMS)\n"
|
||||
Makefile = Makefile + "\t@(echo > .memdump)\n"
|
||||
for test in tests:
|
||||
Makefile = Makefile + "\t@(%s)\n" % (test)
|
||||
Makefile = Makefile + '\t@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)\n'
|
||||
Makefile = Makefile + "\n\n"
|
||||
try:
|
||||
old = open("Makefile.am", "r").read()
|
||||
|
154
doc/examples/io1.c
Normal file
154
doc/examples/io1.c
Normal file
@ -0,0 +1,154 @@
|
||||
/**
|
||||
* section: InputOutput
|
||||
* synopsis: Example of custom Input/Output
|
||||
* 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.
|
||||
* usage: io1
|
||||
* test: io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp
|
||||
* author: Daniel Veillard
|
||||
* copy: see Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xinclude.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
|
||||
static const char *result = "<list><people>a</people><people>b</people></list>";
|
||||
static const char *cur = NULL;
|
||||
static int rlen;
|
||||
|
||||
/**
|
||||
* sqlMatch:
|
||||
* @URI: an URI to test
|
||||
*
|
||||
* Check for an sql: query
|
||||
*
|
||||
* Returns 1 if yes and 0 if another Input module should be used
|
||||
*/
|
||||
static int
|
||||
sqlMatch(const char * URI) {
|
||||
if ((URI != NULL) && (!strncmp(URI, "sql:", 4)))
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sqlOpen:
|
||||
* @URI: an URI to test
|
||||
*
|
||||
* Return a pointer to the sql: query handler, in this example simply
|
||||
* the current pointer...
|
||||
*
|
||||
* Returns an Input context or NULL in case or error
|
||||
*/
|
||||
static void *
|
||||
sqlOpen(const char * URI) {
|
||||
if ((URI == NULL) || (strncmp(URI, "sql:", 4)))
|
||||
return(NULL);
|
||||
cur = result;
|
||||
rlen = strlen(result);
|
||||
return((void *) cur);
|
||||
}
|
||||
|
||||
/**
|
||||
* sqlClose:
|
||||
* @context: the read context
|
||||
*
|
||||
* Close the sql: query handler
|
||||
*
|
||||
* Returns 0 or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
sqlClose(void * context) {
|
||||
if (context == NULL) return(-1);
|
||||
cur = NULL;
|
||||
rlen = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sqlRead:
|
||||
* @context: the read context
|
||||
* @buffer: where to store data
|
||||
* @len: number of bytes to read
|
||||
*
|
||||
* Implement an sql: query read.
|
||||
*
|
||||
* Returns the number of bytes read or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
sqlRead(void * context, char * buffer, int len) {
|
||||
const char *ptr = (const char *) context;
|
||||
|
||||
if ((context == NULL) || (buffer == NULL) || (len < 0))
|
||||
return(-1);
|
||||
|
||||
if (len > rlen) len = rlen;
|
||||
memcpy(buffer, ptr, len);
|
||||
rlen -= len;
|
||||
return(len);
|
||||
}
|
||||
|
||||
const char *include = "<?xml version='1.0'?>\n\
|
||||
<document xmlns:xi=\"http://www.w3.org/2003/XInclude\">\n\
|
||||
<p>List of people:</p>\n\
|
||||
<xi:include href=\"sql:select_name_from_people\"/>\n\
|
||||
</document>\n";
|
||||
|
||||
int main(void) {
|
||||
xmlDocPtr doc;
|
||||
|
||||
/*
|
||||
* this initialize the library and check potential ABI mismatches
|
||||
* between the version it was compiled for and the actual shared
|
||||
* library used.
|
||||
*/
|
||||
LIBXML_TEST_VERSION
|
||||
|
||||
/*
|
||||
* register the new I/O handlers
|
||||
*/
|
||||
if (xmlRegisterInputCallbacks(sqlMatch, sqlOpen, sqlRead, sqlClose) < 0) {
|
||||
fprintf(stderr, "failed to register SQL handler\n");
|
||||
exit(1);
|
||||
}
|
||||
/*
|
||||
* parse include into a document
|
||||
*/
|
||||
doc = xmlReadMemory(include, strlen(include), "include.xml", NULL, 0);
|
||||
if (doc == NULL) {
|
||||
fprintf(stderr, "failed to parse the including file\n");
|
||||
exit(1);
|
||||
}
|
||||
/*
|
||||
* apply the XInclude process, this should trigger the I/O just
|
||||
* registered.
|
||||
*/
|
||||
if (xmlXIncludeProcess(doc) <= 0) {
|
||||
fprintf(stderr, "XInclude processing failed\n");
|
||||
exit(1);
|
||||
}
|
||||
/*
|
||||
* save the output for checking to stdout
|
||||
*/
|
||||
xmlDocDump(stdout, doc);
|
||||
/*
|
||||
* Free the document
|
||||
*/
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
/*
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
5
doc/examples/io1.res
Normal file
5
doc/examples/io1.res
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<document xmlns:xi="http://www.w3.org/2003/XInclude">
|
||||
<p>List of people:</p>
|
||||
<list><people>a</people><people>b</people></list>
|
||||
</document>
|
@ -48,5 +48,9 @@ int main(int argc, char **argv) {
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
@ -64,5 +64,9 @@ int main(int argc, char **argv) {
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
@ -88,5 +88,9 @@ int main(int argc, char **argv) {
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
@ -103,5 +103,9 @@ int main(int argc, char **argv) {
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
@ -100,5 +100,9 @@ int main(int argc, char **argv) {
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
@ -27,6 +27,13 @@ xmlChar *ConvertInput(const char *in, const char *encoding);
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
/*
|
||||
* this initialize the library and check potential ABI mismatches
|
||||
* between the version it was compiled for and the actual shared
|
||||
* library used.
|
||||
*/
|
||||
LIBXML_TEST_VERSION
|
||||
|
||||
/* first, the file version */
|
||||
testXmlwriterFilename("writer1.res");
|
||||
|
||||
@ -39,6 +46,14 @@ main(void)
|
||||
/* next, the tree version */
|
||||
testXmlwriterTree("writer4.res");
|
||||
|
||||
/*
|
||||
* Cleanup function for the XML library.
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -53,6 +68,7 @@ testXmlwriterFilename(const char *uri)
|
||||
{
|
||||
int rc;
|
||||
xmlTextWriterPtr writer;
|
||||
xmlChar *tmp;
|
||||
|
||||
/* Create a new XmlWriter for uri, with no compression. */
|
||||
writer = xmlNewTextWriterFilename(uri, 0);
|
||||
@ -84,15 +100,15 @@ testXmlwriterFilename(const char *uri)
|
||||
* Please observe, that the input to the xmlTextWriter functions
|
||||
* HAS to be in UTF-8, even if the output XML is encoded
|
||||
* in iso-8859-1 */
|
||||
rc = xmlTextWriterWriteComment(writer,
|
||||
ConvertInput
|
||||
("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING));
|
||||
tmp = ConvertInput("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING);
|
||||
rc = xmlTextWriterWriteComment(writer, tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterFilename: Error at xmlTextWriterWriteComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "ORDER" as child of EXAMPLE. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
|
||||
@ -121,15 +137,16 @@ testXmlwriterFilename(const char *uri)
|
||||
}
|
||||
|
||||
/* Write a comment as child of ORDER */
|
||||
tmp = ConvertInput("<äöü>", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteFormatComment(writer,
|
||||
"This is another comment with special chars: %s",
|
||||
ConvertInput("<äöü>",
|
||||
MY_ENCODING));
|
||||
"This is another comment with special chars: %s",
|
||||
tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterFilename: Error at xmlTextWriterWriteFormatComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "HEADER" as child of ORDER. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
|
||||
@ -158,22 +175,24 @@ testXmlwriterFilename(const char *uri)
|
||||
}
|
||||
|
||||
/* Write an element named "NAME_1" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1",
|
||||
ConvertInput("Müller", MY_ENCODING));
|
||||
tmp = ConvertInput("Müller", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Write an element named "NAME_2" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2",
|
||||
ConvertInput("Jörg", MY_ENCODING));
|
||||
tmp = ConvertInput("Jörg", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Close the element named HEADER. */
|
||||
rc = xmlTextWriterEndElement(writer);
|
||||
@ -318,6 +337,7 @@ testXmlwriterMemory(const char *file)
|
||||
int rc;
|
||||
xmlTextWriterPtr writer;
|
||||
xmlBufferPtr buf;
|
||||
xmlChar *tmp;
|
||||
FILE *fp;
|
||||
|
||||
/* Create a new XML buffer, to which the XML document will be
|
||||
@ -359,15 +379,15 @@ testXmlwriterMemory(const char *file)
|
||||
* Please observe, that the input to the xmlTextWriter functions
|
||||
* HAS to be in UTF-8, even if the output XML is encoded
|
||||
* in iso-8859-1 */
|
||||
rc = xmlTextWriterWriteComment(writer,
|
||||
ConvertInput
|
||||
("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING));
|
||||
tmp = ConvertInput("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING);
|
||||
rc = xmlTextWriterWriteComment(writer, tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterMemory: Error at xmlTextWriterWriteComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "ORDER" as child of EXAMPLE. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
|
||||
@ -396,15 +416,16 @@ testXmlwriterMemory(const char *file)
|
||||
}
|
||||
|
||||
/* Write a comment as child of ORDER */
|
||||
tmp = ConvertInput("<äöü>", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteFormatComment(writer,
|
||||
"This is another comment with special chars: %s",
|
||||
ConvertInput("<äöü>",
|
||||
MY_ENCODING));
|
||||
"This is another comment with special chars: %s",
|
||||
tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterMemory: Error at xmlTextWriterWriteFormatComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "HEADER" as child of ORDER. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
|
||||
@ -433,22 +454,25 @@ testXmlwriterMemory(const char *file)
|
||||
}
|
||||
|
||||
/* Write an element named "NAME_1" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1",
|
||||
ConvertInput("Müller", MY_ENCODING));
|
||||
tmp = ConvertInput("Müller", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Write an element named "NAME_2" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2",
|
||||
ConvertInput("Jörg", MY_ENCODING));
|
||||
tmp = ConvertInput("Jörg", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
|
||||
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Close the element named HEADER. */
|
||||
rc = xmlTextWriterEndElement(writer);
|
||||
@ -583,6 +607,8 @@ testXmlwriterMemory(const char *file)
|
||||
fprintf(fp, "%s", (const char *) buf->content);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
xmlBufferFree(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -596,6 +622,7 @@ testXmlwriterDoc(const char *file)
|
||||
{
|
||||
int rc;
|
||||
xmlTextWriterPtr writer;
|
||||
xmlChar *tmp;
|
||||
xmlDocPtr doc;
|
||||
|
||||
|
||||
@ -627,14 +654,14 @@ testXmlwriterDoc(const char *file)
|
||||
* Please observe, that the input to the xmlTextWriter functions
|
||||
* HAS to be in UTF-8, even if the output XML is encoded
|
||||
* in iso-8859-1 */
|
||||
rc = xmlTextWriterWriteComment(writer,
|
||||
ConvertInput
|
||||
("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING));
|
||||
tmp = ConvertInput("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING);
|
||||
rc = xmlTextWriterWriteComment(writer, tmp);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterDoc: Error at xmlTextWriterWriteComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "ORDER" as child of EXAMPLE. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
|
||||
@ -660,15 +687,16 @@ testXmlwriterDoc(const char *file)
|
||||
}
|
||||
|
||||
/* Write a comment as child of ORDER */
|
||||
tmp = ConvertInput("<äöü>", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteFormatComment(writer,
|
||||
"This is another comment with special chars: %s",
|
||||
ConvertInput("<äöü>",
|
||||
MY_ENCODING));
|
||||
"This is another comment with special chars: %s",
|
||||
tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterDoc: Error at xmlTextWriterWriteFormatComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "HEADER" as child of ORDER. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
|
||||
@ -696,20 +724,22 @@ testXmlwriterDoc(const char *file)
|
||||
}
|
||||
|
||||
/* Write an element named "NAME_1" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1",
|
||||
ConvertInput("Müller", MY_ENCODING));
|
||||
tmp = ConvertInput("Müller", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Write an element named "NAME_2" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2",
|
||||
ConvertInput("Jörg", MY_ENCODING));
|
||||
tmp = ConvertInput("Jörg", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Close the element named HEADER. */
|
||||
rc = xmlTextWriterEndElement(writer);
|
||||
@ -846,6 +876,7 @@ testXmlwriterTree(const char *file)
|
||||
xmlTextWriterPtr writer;
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr node;
|
||||
xmlChar *tmp;
|
||||
|
||||
/* Create a new XML DOM tree, to which the XML document will be
|
||||
* written */
|
||||
@ -887,14 +918,14 @@ testXmlwriterTree(const char *file)
|
||||
* Please observe, that the input to the xmlTextWriter functions
|
||||
* HAS to be in UTF-8, even if the output XML is encoded
|
||||
* in iso-8859-1 */
|
||||
rc = xmlTextWriterWriteComment(writer,
|
||||
ConvertInput
|
||||
("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING));
|
||||
tmp = ConvertInput("This is a comment with special chars: <äöü>",
|
||||
MY_ENCODING);
|
||||
rc = xmlTextWriterWriteComment(writer, tmp);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterTree: Error at xmlTextWriterWriteComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "ORDER" as child of EXAMPLE. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
|
||||
@ -922,15 +953,16 @@ testXmlwriterTree(const char *file)
|
||||
}
|
||||
|
||||
/* Write a comment as child of ORDER */
|
||||
tmp = ConvertInput("<äöü>", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteFormatComment(writer,
|
||||
"This is another comment with special chars: %s",
|
||||
ConvertInput("<äöü>",
|
||||
MY_ENCODING));
|
||||
"This is another comment with special chars: %s",
|
||||
tmp);
|
||||
if (rc < 0) {
|
||||
printf
|
||||
("testXmlwriterTree: Error at xmlTextWriterWriteFormatComment\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Start an element named "HEADER" as child of ORDER. */
|
||||
rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
|
||||
@ -958,20 +990,22 @@ testXmlwriterTree(const char *file)
|
||||
}
|
||||
|
||||
/* Write an element named "NAME_1" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1",
|
||||
ConvertInput("Müller", MY_ENCODING));
|
||||
tmp = ConvertInput("Müller", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Write an element named "NAME_2" as child of HEADER. */
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2",
|
||||
ConvertInput("Jörg", MY_ENCODING));
|
||||
tmp = ConvertInput("Jörg", MY_ENCODING);
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
|
||||
return;
|
||||
}
|
||||
if (tmp != NULL) xmlFree(tmp);
|
||||
|
||||
/* Close the element named HEADER. */
|
||||
rc = xmlTextWriterEndElement(writer);
|
||||
|
@ -102,5 +102,9 @@ main(int argc, char **argv)
|
||||
*/
|
||||
xmlCleanupParser();
|
||||
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ main(int argc, char **argv) {
|
||||
/* Shutdown libxml */
|
||||
xmlCleanupParser();
|
||||
|
||||
/*
|
||||
* this is to debug memory for regression tests
|
||||
*/
|
||||
xmlMemoryDump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ A:link, A:visited, A:active { text-decoration: underline }
|
||||
The content of this structure is not made public by the API.
|
||||
</pre><pre class="programlisting">Typedef <a href="libxml-dict.html#xmlDict">xmlDict</a> * <a name="xmlDictPtr" id="xmlDictPtr">xmlDictPtr</a>
|
||||
</pre><pre class="programlisting"><a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> <a href="#xmlDictCreate">xmlDictCreate</a> (void)</pre>
|
||||
<pre class="programlisting"><a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> <a href="#xmlDictCreateSub">xmlDictCreateSub</a> (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> sub)</pre>
|
||||
<pre class="programlisting">void <a href="#xmlDictFree">xmlDictFree</a> (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict)</pre>
|
||||
<pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlDictLookup">xmlDictLookup</a> (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> int len)</pre>
|
||||
<pre class="programlisting">int <a href="#xmlDictOwns">xmlDictOwns</a> (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str)</pre>
|
||||
@ -25,7 +26,9 @@ The content of this structure is not made public by the API.
|
||||
The content of this structure is not made public by the API.
|
||||
}</pre><h3><a name="xmlDictCreate" id="xmlDictCreate"></a>Function: xmlDictCreate</h3><pre class="programlisting"><a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> xmlDictCreate (void)<br />
|
||||
</pre><p>Create a new dictionary</p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created object, or NULL if an error occured.</td></tr></tbody></table></div><h3><a name="xmlDictFree" id="xmlDictFree"></a>Function: xmlDictFree</h3><pre class="programlisting">void xmlDictFree (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br />
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created dictionnary, or NULL if an error occured.</td></tr></tbody></table></div><h3><a name="xmlDictCreateSub" id="xmlDictCreateSub"></a>Function: xmlDictCreateSub</h3><pre class="programlisting"><a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> xmlDictCreateSub (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> sub)<br />
|
||||
</pre><p>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.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>sub</tt></i>:</span></td><td>an existing dictionnary</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created dictionnary, or NULL if an error occured.</td></tr></tbody></table></div><h3><a name="xmlDictFree" id="xmlDictFree"></a>Function: xmlDictFree</h3><pre class="programlisting">void xmlDictFree (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br />
|
||||
</pre><p>Free the hash @dict and its contents. The userdata is deallocated with @f if provided.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr></tbody></table></div><h3><a name="xmlDictLookup" id="xmlDictLookup"></a>Function: xmlDictLookup</h3><pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlDictLookup (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> int len)<br />
|
||||
</pre><p>Add the @name to the hash @dict if not present.</p>
|
||||
|
@ -57,6 +57,7 @@ int <a href="#xmlXPathConvertFunc">xmlXPathConvertFunc</a> (<a href="libxml-xpa
|
||||
</pre>
|
||||
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathConvertNumber">xmlXPathConvertNumber</a> (<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)</pre>
|
||||
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathConvertString">xmlXPathConvertString</a> (<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)</pre>
|
||||
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> <a href="#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a> (<a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str)</pre>
|
||||
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathEval">xmlXPathEval</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)</pre>
|
||||
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathEvalExpression">xmlXPathEvalExpression</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt)</pre>
|
||||
<pre class="programlisting">Function type: <a href="#xmlXPathEvalFunc">xmlXPathEvalFunc</a>
|
||||
@ -127,7 +128,8 @@ The content of this structure is not made public by the API.
|
||||
void * userData : user specific data block
|
||||
<a href="libxml-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> error : the callback in case of errors
|
||||
<a href="libxml-xmlerror.html#xmlError">xmlError</a> lastError : the last error
|
||||
<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> debugNode : the source node XSLT
|
||||
<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> debugNode : the source node XSLT dictionnary
|
||||
<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict : dictionnary if any
|
||||
}</pre><h3>Enum <a name="xmlXPathError" id="xmlXPathError">xmlXPathError</a></h3><pre class="programlisting">Enum xmlXPathError {
|
||||
<a name="XPATH_EXPRESSION_OK" id="XPATH_EXPRESSION_OK">XPATH_EXPRESSION_OK</a> = 0
|
||||
<a name="XPATH_NUMBER_ERROR" id="XPATH_NUMBER_ERROR">XPATH_NUMBER_ERROR</a> = 1
|
||||
@ -241,7 +243,9 @@ int xmlXPathConvertFunc (<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPath
|
||||
</pre><p>Converts an existing object to its number() equivalent</p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new object, the old one is freed (or the operation is done directly on @val)</td></tr></tbody></table></div><h3><a name="xmlXPathConvertString" id="xmlXPathConvertString"></a>Function: xmlXPathConvertString</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathConvertString (<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br />
|
||||
</pre><p>Converts an existing object to its string() equivalent</p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new object, the old one is freed (or the operation is done directly on @val)</td></tr></tbody></table></div><h3><a name="xmlXPathEval" id="xmlXPathEval"></a>Function: xmlXPathEval</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathEval (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br />
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new object, the old one is freed (or the operation is done directly on @val)</td></tr></tbody></table></div><h3><a name="xmlXPathCtxtCompile" id="xmlXPathCtxtCompile"></a>Function: xmlXPathCtxtCompile</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> xmlXPathCtxtCompile (<a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str)<br />
|
||||
</pre><p></p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><h3><a name="xmlXPathEval" id="xmlXPathEval"></a>Function: xmlXPathEval</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathEval (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br />
|
||||
</pre><p>Evaluate the XPath Location Path in the given context.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div><h3><a name="xmlXPathEvalExpression" id="xmlXPathEvalExpression"></a>Function: xmlXPathEvalExpression</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathEvalExpression (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt)<br />
|
||||
</pre><p>Evaluate the XPath expression in the given context.</p>
|
||||
|
@ -367,8 +367,9 @@
|
||||
<exports symbol='xmlDictPtr' type='typedef'/>
|
||||
<exports symbol='xmlDictQLookup' type='function'/>
|
||||
<exports symbol='xmlDictReference' type='function'/>
|
||||
<exports symbol='xmlDictSize' type='function'/>
|
||||
<exports symbol='xmlDictCreateSub' type='function'/>
|
||||
<exports symbol='xmlDictCreate' type='function'/>
|
||||
<exports symbol='xmlDictSize' type='function'/>
|
||||
<exports symbol='xmlDictLookup' type='function'/>
|
||||
<exports symbol='xmlDictFree' type='function'/>
|
||||
<exports symbol='xmlDictOwns' type='function'/>
|
||||
@ -2852,6 +2853,7 @@
|
||||
<exports symbol='xmlXPathCmpNodes' type='function'/>
|
||||
<exports symbol='xmlXPathCastBooleanToNumber' type='function'/>
|
||||
<exports symbol='xmlXPathCastToString' type='function'/>
|
||||
<exports symbol='xmlXPathCtxtCompile' type='function'/>
|
||||
<exports symbol='xmlXPathCastStringToNumber' type='function'/>
|
||||
<exports symbol='xmlXPathAxisFunc' type='function'/>
|
||||
<exports symbol='xmlXPathCastToNumber' type='function'/>
|
||||
@ -5308,7 +5310,8 @@ actually an xmlCharEncoding'/>
|
||||
<field name='userData' type='void *' info=' user specific data block'/>
|
||||
<field name='error' type='xmlStructuredErrorFunc' info=' the callback in case of errors'/>
|
||||
<field name='lastError' type='xmlError' info=' the last error'/>
|
||||
<field name='debugNode' type='xmlNodePtr' info=' the source node XSLT'/>
|
||||
<field name='debugNode' type='xmlNodePtr' info=' the source node XSLT dictionnary'/>
|
||||
<field name='dict' type='xmlDictPtr' info=' dictionnary if any'/>
|
||||
</struct>
|
||||
<typedef name='xmlXPathContextPtr' file='xpath' type='xmlXPathContext *'/>
|
||||
<typedef name='xmlXPathError' file='xpath' type='enum'/>
|
||||
@ -7503,7 +7506,12 @@ actually an xmlCharEncoding'/>
|
||||
</function>
|
||||
<function name='xmlDictCreate' file='dict'>
|
||||
<info>Create a new dictionary</info>
|
||||
<return type='xmlDictPtr' info='the newly created object, or NULL if an error occured.'/>
|
||||
<return type='xmlDictPtr' info='the newly created dictionnary, or NULL if an error occured.'/>
|
||||
</function>
|
||||
<function name='xmlDictCreateSub' file='dict'>
|
||||
<info>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.</info>
|
||||
<return type='xmlDictPtr' info='the newly created dictionnary, or NULL if an error occured.'/>
|
||||
<arg name='sub' type='xmlDictPtr' info='an existing dictionnary'/>
|
||||
</function>
|
||||
<function name='xmlDictFree' file='dict'>
|
||||
<info>Free the hash @dict and its contents. The userdata is deallocated with @f if provided.</info>
|
||||
@ -13786,6 +13794,12 @@ actually an xmlCharEncoding'/>
|
||||
<arg name='ctxt' type='xmlXPathParserContextPtr' info='the XPath Parser context'/>
|
||||
<arg name='nargs' type='int' info='the number of arguments'/>
|
||||
</function>
|
||||
<function name='xmlXPathCtxtCompile' file='xpath'>
|
||||
<info></info>
|
||||
<return type='xmlXPathCompExprPtr' info=''/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info=''/>
|
||||
<arg name='str' type='const xmlChar *' info=''/>
|
||||
</function>
|
||||
<function name='xmlXPathDebugDumpCompExpr' file='xpathInternals'>
|
||||
<info>Dumps the tree of the compiled XPath expression.</info>
|
||||
<return type='void'/>
|
||||
|
@ -1396,6 +1396,7 @@
|
||||
<reference name='xmlDetectCharEncoding' href='html/libxml-encoding.html#xmlDetectCharEncoding'/>
|
||||
<reference name='xmlDict' href='html/libxml-dict.html#xmlDict'/>
|
||||
<reference name='xmlDictCreate' href='html/libxml-dict.html#xmlDictCreate'/>
|
||||
<reference name='xmlDictCreateSub' href='html/libxml-dict.html#xmlDictCreateSub'/>
|
||||
<reference name='xmlDictFree' href='html/libxml-dict.html#xmlDictFree'/>
|
||||
<reference name='xmlDictLookup' href='html/libxml-dict.html#xmlDictLookup'/>
|
||||
<reference name='xmlDictOwns' href='html/libxml-dict.html#xmlDictOwns'/>
|
||||
@ -2648,6 +2649,7 @@
|
||||
<reference name='xmlXPathConvertNumber' href='html/libxml-xpath.html#xmlXPathConvertNumber'/>
|
||||
<reference name='xmlXPathConvertString' href='html/libxml-xpath.html#xmlXPathConvertString'/>
|
||||
<reference name='xmlXPathCountFunction' href='html/libxml-xpathInternals.html#xmlXPathCountFunction'/>
|
||||
<reference name='xmlXPathCtxtCompile' href='html/libxml-xpath.html#xmlXPathCtxtCompile'/>
|
||||
<reference name='xmlXPathDebugDumpCompExpr' href='html/libxml-xpathInternals.html#xmlXPathDebugDumpCompExpr'/>
|
||||
<reference name='xmlXPathDebugDumpObject' href='html/libxml-xpathInternals.html#xmlXPathDebugDumpObject'/>
|
||||
<reference name='xmlXPathDifference' href='html/libxml-xpathInternals.html#xmlXPathDifference'/>
|
||||
@ -4288,6 +4290,7 @@
|
||||
<ref name='xmlDetectCharEncoding'/>
|
||||
<ref name='xmlDict'/>
|
||||
<ref name='xmlDictCreate'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlDictFree'/>
|
||||
<ref name='xmlDictLookup'/>
|
||||
<ref name='xmlDictOwns'/>
|
||||
@ -5540,6 +5543,7 @@
|
||||
<ref name='xmlXPathConvertNumber'/>
|
||||
<ref name='xmlXPathConvertString'/>
|
||||
<ref name='xmlXPathCountFunction'/>
|
||||
<ref name='xmlXPathCtxtCompile'/>
|
||||
<ref name='xmlXPathDebugDumpCompExpr'/>
|
||||
<ref name='xmlXPathDebugDumpObject'/>
|
||||
<ref name='xmlXPathDifference'/>
|
||||
@ -6026,6 +6030,7 @@
|
||||
</type>
|
||||
<type name='xmlDictPtr'>
|
||||
<ref name='xmlDictCreate'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
</type>
|
||||
<type name='xmlDocPtr'>
|
||||
<ref name='xmlCopyDoc'/>
|
||||
@ -6347,6 +6352,7 @@
|
||||
</type>
|
||||
<type name='xmlXPathCompExprPtr'>
|
||||
<ref name='xmlXPathCompile'/>
|
||||
<ref name='xmlXPathCtxtCompile'/>
|
||||
</type>
|
||||
<type name='xmlXPathContextPtr'>
|
||||
<ref name='xmlXPathNewContext'/>
|
||||
@ -6869,6 +6875,7 @@
|
||||
<ref name='xmlXPathCastStringToBoolean'/>
|
||||
<ref name='xmlXPathCastStringToNumber'/>
|
||||
<ref name='xmlXPathCompile'/>
|
||||
<ref name='xmlXPathCtxtCompile'/>
|
||||
<ref name='xmlXPathEval'/>
|
||||
<ref name='xmlXPathEvalExpression'/>
|
||||
<ref name='xmlXPathFuncLookupFunc'/>
|
||||
@ -7525,6 +7532,7 @@
|
||||
<ref name='xmlPatterncompile'/>
|
||||
</type>
|
||||
<type name='xmlDictPtr'>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlDictFree'/>
|
||||
<ref name='xmlDictLookup'/>
|
||||
<ref name='xmlDictOwns'/>
|
||||
@ -8653,6 +8661,7 @@
|
||||
</type>
|
||||
<type name='xmlXPathContextPtr'>
|
||||
<ref name='xmlXPathCompiledEval'/>
|
||||
<ref name='xmlXPathCtxtCompile'/>
|
||||
<ref name='xmlXPathEval'/>
|
||||
<ref name='xmlXPathEvalExpression'/>
|
||||
<ref name='xmlXPathEvalPredicate'/>
|
||||
@ -9118,6 +9127,7 @@
|
||||
<file name='dict'>
|
||||
<ref name='xmlDict'/>
|
||||
<ref name='xmlDictCreate'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlDictFree'/>
|
||||
<ref name='xmlDictLookup'/>
|
||||
<ref name='xmlDictOwns'/>
|
||||
@ -11497,6 +11507,7 @@
|
||||
<ref name='xmlXPathConvertFunc'/>
|
||||
<ref name='xmlXPathConvertNumber'/>
|
||||
<ref name='xmlXPathConvertString'/>
|
||||
<ref name='xmlXPathCtxtCompile'/>
|
||||
<ref name='xmlXPathError'/>
|
||||
<ref name='xmlXPathEval'/>
|
||||
<ref name='xmlXPathEvalExpression'/>
|
||||
@ -18245,10 +18256,14 @@
|
||||
<word name='dictionary'>
|
||||
<ref name='_xmlParserCtxt'/>
|
||||
<ref name='xmlDictCreate'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlDictReference'/>
|
||||
</word>
|
||||
<word name='dictionnary'>
|
||||
<ref name='_xmlParserCtxt'/>
|
||||
<ref name='_xmlXPathContext'/>
|
||||
<ref name='xmlDictCreate'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlDictFree'/>
|
||||
<ref name='xmlDictLookup'/>
|
||||
<ref name='xmlDictOwns'/>
|
||||
@ -20347,6 +20362,9 @@
|
||||
<ref name='xmlNodeGetSpacePreserve'/>
|
||||
<ref name='xmlXPathNextAttribute'/>
|
||||
</word>
|
||||
<word name='inheriting'>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
</word>
|
||||
<word name='inherits'>
|
||||
<ref name='xmlNewChild'/>
|
||||
<ref name='xmlNewTextChild'/>
|
||||
@ -21916,6 +21934,7 @@
|
||||
<word name='occured'>
|
||||
<ref name='xmlCtxtGetLastError'/>
|
||||
<ref name='xmlDictCreate'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlGetLastError'/>
|
||||
<ref name='xmlHashCreate'/>
|
||||
<ref name='xmlListRemoveFirst'/>
|
||||
@ -23072,6 +23091,9 @@
|
||||
<ref name='xmlRegExecPushString'/>
|
||||
<ref name='xmlRegExecPushString2'/>
|
||||
</word>
|
||||
<word name='read-only'>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
</word>
|
||||
<word name='readable'>
|
||||
<ref name='xmlStrEqual'/>
|
||||
</word>
|
||||
@ -23910,6 +23932,9 @@
|
||||
<ref name='xmlStrchr'/>
|
||||
<ref name='xmlStrstr'/>
|
||||
</word>
|
||||
<word name='searched'>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
</word>
|
||||
<word name='section'>
|
||||
<ref name='HTML_PRESERVE_NODE'/>
|
||||
<ref name='xmlBuildURI'/>
|
||||
@ -24608,6 +24633,7 @@
|
||||
</word>
|
||||
<word name='strings'>
|
||||
<ref name='_xmlParserCtxt'/>
|
||||
<ref name='xmlDictCreateSub'/>
|
||||
<ref name='xmlGetFeaturesList'/>
|
||||
<ref name='xmlPatterncompile'/>
|
||||
<ref name='xmlRegexpCompile'/>
|
||||
|
@ -29,6 +29,8 @@ typedef xmlDict *xmlDictPtr;
|
||||
*/
|
||||
XMLPUBFUN xmlDictPtr XMLCALL
|
||||
xmlDictCreate (void);
|
||||
XMLPUBFUN xmlDictPtr XMLCALL
|
||||
xmlDictCreateSub(xmlDictPtr sub);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlDictReference(xmlDictPtr dict);
|
||||
XMLPUBFUN void XMLCALL
|
||||
|
@ -267,6 +267,9 @@ struct _xmlXPathContext {
|
||||
xmlStructuredErrorFunc error; /* the callback in case of errors */
|
||||
xmlError lastError; /* the last error */
|
||||
xmlNodePtr debugNode; /* the source node XSLT */
|
||||
|
||||
/* dictionnary */
|
||||
xmlDictPtr dict; /* dictionnary if any */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -450,6 +453,9 @@ XMLPUBFUN int XMLCALL
|
||||
*/
|
||||
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
|
||||
xmlXPathCompile (const xmlChar *str);
|
||||
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
|
||||
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
|
||||
const xmlChar *str);
|
||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
||||
xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
|
||||
xmlXPathContextPtr ctx);
|
||||
|
18
testSAX.c
18
testSAX.c
@ -49,6 +49,7 @@ static int noent = 0;
|
||||
static int quiet = 0;
|
||||
static int nonull = 0;
|
||||
static int sax2 = 0;
|
||||
static int repeat = 0;
|
||||
static int callbacks = 0;
|
||||
|
||||
xmlSAXHandler emptySAXHandlerStruct = {
|
||||
@ -913,6 +914,17 @@ parseAndPrintFile(char *filename) {
|
||||
* Debug callback
|
||||
*/
|
||||
callbacks = 0;
|
||||
if (repeat) {
|
||||
int i;
|
||||
for (i = 0;i < 99;i++) {
|
||||
if (sax2)
|
||||
res = xmlSAXUserParseFile(debugSAX2Handler, NULL,
|
||||
filename);
|
||||
else
|
||||
res = xmlSAXUserParseFile(debugSAXHandler, NULL,
|
||||
filename);
|
||||
}
|
||||
}
|
||||
if (sax2)
|
||||
res = xmlSAXUserParseFile(debugSAX2Handler, NULL, filename);
|
||||
else
|
||||
@ -956,7 +968,11 @@ int main(int argc, char **argv) {
|
||||
else if ((!strcmp(argv[i], "-speed")) ||
|
||||
(!strcmp(argv[i], "--speed")))
|
||||
speed++;
|
||||
else if ((!strcmp(argv[i], "-noent")) ||
|
||||
else if ((!strcmp(argv[i], "-repeat")) ||
|
||||
(!strcmp(argv[i], "--repeat"))) {
|
||||
repeat++;
|
||||
quiet++;
|
||||
} else if ((!strcmp(argv[i], "-noent")) ||
|
||||
(!strcmp(argv[i], "--noent")))
|
||||
noent++;
|
||||
else if ((!strcmp(argv[i], "-quiet")) ||
|
||||
|
@ -454,7 +454,12 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
|
||||
}
|
||||
else {
|
||||
ret = NULL;
|
||||
xmlFreeDoc(pctxt->myDoc);
|
||||
if (pctxt->myDoc != NULL) {
|
||||
if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL) &&
|
||||
(pctxt->myDoc->dict == ctxt->doc->dict))
|
||||
xmlDictReference(ctxt->doc->dict);
|
||||
xmlFreeDoc(pctxt->myDoc);
|
||||
}
|
||||
pctxt->myDoc = NULL;
|
||||
}
|
||||
xmlFreeParserCtxt(pctxt);
|
||||
|
@ -379,6 +379,8 @@ xmlFreeTextWriter(xmlTextWriterPtr writer)
|
||||
if (writer->ctxt != NULL)
|
||||
xmlFreeParserCtxt(writer->ctxt);
|
||||
|
||||
if (writer->ichar != NULL)
|
||||
xmlFree(writer->ichar);
|
||||
xmlFree(writer);
|
||||
}
|
||||
|
||||
@ -4035,6 +4037,8 @@ xmlTextWriterSetIndentString (xmlTextWriterPtr writer, xmlChar *str)
|
||||
if (!str)
|
||||
return -1;
|
||||
|
||||
if (writer->ichar != NULL)
|
||||
xmlFree(writer->ichar);
|
||||
writer->ichar = xmlStrdup (str);
|
||||
|
||||
if (!writer->ichar)
|
||||
|
144
xpath.c
144
xpath.c
@ -420,6 +420,7 @@ struct _xmlXPathCompExpr {
|
||||
xmlXPathStepOp *steps; /* ops for computation of this expression */
|
||||
int last; /* index of last step in expression */
|
||||
xmlChar *expr; /* the expression being computed */
|
||||
xmlDictPtr dict; /* the dictionnary to use if any */
|
||||
#ifdef DEBUG_EVAL_COUNTS
|
||||
int nb;
|
||||
xmlChar *string;
|
||||
@ -480,16 +481,27 @@ xmlXPathFreeCompExpr(xmlXPathCompExprPtr comp)
|
||||
|
||||
if (comp == NULL)
|
||||
return;
|
||||
for (i = 0; i < comp->nbStep; i++) {
|
||||
op = &comp->steps[i];
|
||||
if (op->value4 != NULL) {
|
||||
if (op->op == XPATH_OP_VALUE)
|
||||
xmlXPathFreeObject(op->value4);
|
||||
else
|
||||
xmlFree(op->value4);
|
||||
}
|
||||
if (op->value5 != NULL)
|
||||
xmlFree(op->value5);
|
||||
if (comp->dict == NULL) {
|
||||
for (i = 0; i < comp->nbStep; i++) {
|
||||
op = &comp->steps[i];
|
||||
if (op->value4 != NULL) {
|
||||
if (op->op == XPATH_OP_VALUE)
|
||||
xmlXPathFreeObject(op->value4);
|
||||
else
|
||||
xmlFree(op->value4);
|
||||
}
|
||||
if (op->value5 != NULL)
|
||||
xmlFree(op->value5);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < comp->nbStep; i++) {
|
||||
op = &comp->steps[i];
|
||||
if (op->value4 != NULL) {
|
||||
if (op->op == XPATH_OP_VALUE)
|
||||
xmlXPathFreeObject(op->value4);
|
||||
}
|
||||
}
|
||||
xmlDictFree(comp->dict);
|
||||
}
|
||||
if (comp->steps != NULL) {
|
||||
xmlFree(comp->steps);
|
||||
@ -546,8 +558,25 @@ xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2,
|
||||
comp->steps[comp->nbStep].value = value;
|
||||
comp->steps[comp->nbStep].value2 = value2;
|
||||
comp->steps[comp->nbStep].value3 = value3;
|
||||
comp->steps[comp->nbStep].value4 = value4;
|
||||
comp->steps[comp->nbStep].value5 = value5;
|
||||
if ((comp->dict != NULL) &&
|
||||
((op == XPATH_OP_FUNCTION) || (op == XPATH_OP_VARIABLE) ||
|
||||
(op == XPATH_OP_COLLECT))) {
|
||||
if (value4 != NULL) {
|
||||
comp->steps[comp->nbStep].value4 =
|
||||
xmlDictLookup(comp->dict, value4, -1);
|
||||
xmlFree(value4);
|
||||
} else
|
||||
comp->steps[comp->nbStep].value4 = NULL;
|
||||
if (value5 != NULL) {
|
||||
comp->steps[comp->nbStep].value5 =
|
||||
xmlDictLookup(comp->dict, value5, -1);
|
||||
xmlFree(value5);
|
||||
} else
|
||||
comp->steps[comp->nbStep].value5 = NULL;
|
||||
} else {
|
||||
comp->steps[comp->nbStep].value4 = value4;
|
||||
comp->steps[comp->nbStep].value5 = value5;
|
||||
}
|
||||
comp->steps[comp->nbStep].cache = NULL;
|
||||
return(comp->nbStep++);
|
||||
}
|
||||
@ -3902,6 +3931,10 @@ xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) {
|
||||
xmlFree(ret);
|
||||
return(NULL);
|
||||
}
|
||||
if ((ctxt != NULL) && (ctxt->dict != NULL)) {
|
||||
ret->comp->dict = ctxt->dict;
|
||||
xmlDictReference(ret->comp->dict);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
@ -10879,6 +10912,56 @@ xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlXPathCtxtCompile:
|
||||
* @ctxt: an XPath context
|
||||
* @str: the XPath expression
|
||||
*
|
||||
* Compile an XPath expression
|
||||
*
|
||||
* Returns the xmlXPathCompExprPtr resulting from the compilation or NULL.
|
||||
* the caller has to free the object.
|
||||
*/
|
||||
xmlXPathCompExprPtr
|
||||
xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
|
||||
xmlXPathParserContextPtr pctxt;
|
||||
xmlXPathCompExprPtr comp;
|
||||
|
||||
xmlXPathInit();
|
||||
|
||||
pctxt = xmlXPathNewParserContext(str, ctxt);
|
||||
xmlXPathCompileExpr(pctxt);
|
||||
|
||||
if( pctxt->error != XPATH_EXPRESSION_OK )
|
||||
{
|
||||
xmlXPathFreeParserContext(pctxt);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (*pctxt->cur != 0) {
|
||||
/*
|
||||
* aleksey: in some cases this line prints *second* error message
|
||||
* (see bug #78858) and probably this should be fixed.
|
||||
* However, we are not sure that all error messages are printed
|
||||
* out in other places. It's not critical so we leave it as-is for now
|
||||
*/
|
||||
xmlXPatherror(pctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
|
||||
comp = NULL;
|
||||
} else {
|
||||
comp = pctxt->comp;
|
||||
pctxt->comp = NULL;
|
||||
}
|
||||
xmlXPathFreeParserContext(pctxt);
|
||||
if (comp != NULL) {
|
||||
comp->expr = xmlStrdup(str);
|
||||
#ifdef DEBUG_EVAL_COUNTS
|
||||
comp->string = xmlStrdup(str);
|
||||
comp->nb = 0;
|
||||
#endif
|
||||
}
|
||||
return(comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlXPathCompile:
|
||||
* @str: the XPath expression
|
||||
@ -10890,42 +10973,7 @@ xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
|
||||
*/
|
||||
xmlXPathCompExprPtr
|
||||
xmlXPathCompile(const xmlChar *str) {
|
||||
xmlXPathParserContextPtr ctxt;
|
||||
xmlXPathCompExprPtr comp;
|
||||
|
||||
xmlXPathInit();
|
||||
|
||||
ctxt = xmlXPathNewParserContext(str, NULL);
|
||||
xmlXPathCompileExpr(ctxt);
|
||||
|
||||
if( ctxt->error != XPATH_EXPRESSION_OK )
|
||||
{
|
||||
xmlXPathFreeParserContext(ctxt);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (*ctxt->cur != 0) {
|
||||
/*
|
||||
* aleksey: in some cases this line prints *second* error message
|
||||
* (see bug #78858) and probably this should be fixed.
|
||||
* However, we are not sure that all error messages are printed
|
||||
* out in other places. It's not critical so we leave it as-is for now
|
||||
*/
|
||||
xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
|
||||
comp = NULL;
|
||||
} else {
|
||||
comp = ctxt->comp;
|
||||
ctxt->comp = NULL;
|
||||
}
|
||||
xmlXPathFreeParserContext(ctxt);
|
||||
if (comp != NULL) {
|
||||
comp->expr = xmlStrdup(str);
|
||||
#ifdef DEBUG_EVAL_COUNTS
|
||||
comp->string = xmlStrdup(str);
|
||||
comp->nb = 0;
|
||||
#endif
|
||||
}
|
||||
return(comp);
|
||||
return(xmlXPathCtxtCompile(NULL, str));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user