1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

fixed namespace bug in push mode reported by Rob Richards added it to the

* parser.c: fixed namespace bug in push mode reported by
  Rob Richards
* test/ns6 result//ns6*: added it to the regression tests
* xmlmodule.c testModule.c include/libxml/xmlmodule.h:
  added an extra option argument to module opening and defined
  a couple of flags to the API.
Daniel
This commit is contained in:
Daniel Veillard 2005-01-04 21:50:05 +00:00
parent be076e9b06
commit 48df9613ba
20 changed files with 128 additions and 22 deletions

View File

@ -1,3 +1,12 @@
Tue Jan 4 22:47:22 CET 2005 Daniel Veillard <daniel@veillard.com>
* parser.c: fixed namespace bug in push mode reported by
Rob Richards
* test/ns6 result//ns6*: added it to the regression tests
* xmlmodule.c testModule.c include/libxml/xmlmodule.h:
added an extra option argument to module opening and defined
a couple of flags to the API.
Tue Jan 4 21:16:05 CET 2005 Daniel Veillard <daniel@veillard.com>
* xmlmodule.c include/libxml/xmlmodule.h: applied patch from

View File

@ -76,6 +76,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-HTMLtree.html#HTML_PI_NODE">HTML_PI_NODE</a><br />
<a href="html/libxml-HTMLtree.html#HTML_PRESERVE_NODE">HTML_PRESERVE_NODE</a><br />
<a href="html/libxml-HTMLtree.html#HTML_TEXT_NODE">HTML_TEXT_NODE</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveDoc">xmlSaveDoc</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveTree">xmlSaveTree</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderNextSibling">xmlTextReaderNextSibling</a><br />

View File

@ -234,6 +234,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-uri.html#xmlURIUnescapeString">xmlURIUnescapeString</a><br />
</dd><dt>options</dt><dd><a href="html/libxml-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a><br />
<a href="html/libxml-parser.html#xmlCtxtUseOptions">xmlCtxtUseOptions</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveToFd">xmlSaveToFd</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveToFilename">xmlSaveToFilename</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveToIO">xmlSaveToIO</a><br />

View File

@ -237,6 +237,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>xmlLocationSetPtr</dt><dd><a href="html/libxml-xpointer.html#xmlXPtrFreeLocationSet">xmlXPtrFreeLocationSet</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrLocationSetCreate">xmlXPtrLocationSetCreate</a><br />
</dd><dt>xmlLockLibrary</dt><dd><a href="html/libxml-threads.html#xmlLockLibrary">xmlLockLibrary</a><br />
</dd><dt>xmlModuleOption</dt><dd><a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
</dd><dt>xmlMutexLock</dt><dd><a href="html/libxml-threads.html#xmlMutexLock">xmlMutexLock</a><br />
</dd><dt>xmlMutexUnlock</dt><dd><a href="html/libxml-threads.html#xmlMutexUnlock">xmlMutexUnlock</a><br />
</dd><dt>xmlNanoFTPGet</dt><dd><a href="html/libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a><br />

View File

@ -55,6 +55,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parserInternals.html#xmlDecodeEntities">xmlDecodeEntities</a><br />
<a href="html/libxml-entities.html#xmlEncodeEntities">xmlEncodeEntities</a><br />
<a href="html/libxml-parser.html#xmlLoadExternalEntity">xmlLoadExternalEntity</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
<a href="html/libxml-parserInternals.html#xmlNamespaceParseNCName">xmlNamespaceParseNCName</a><br />
<a href="html/libxml-parserInternals.html#xmlNamespaceParseNSDef">xmlNamespaceParseNSDef</a><br />
<a href="html/libxml-parserInternals.html#xmlNamespaceParseQName">xmlNamespaceParseQName</a><br />

View File

@ -2433,10 +2433,13 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a><br />
<a href="html/libxml-xmlmemory.html#xmlReallocLoc">xmlReallocLoc</a><br />
<a href="html/libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a><br />
</p><h2><a name="xmlmodule" id="xmlmodule">Module xmlmodule</a>:</h2><p><a href="html/libxml-xmlmodule.html#xmlModule">xmlModule</a><br />
</p><h2><a name="xmlmodule" id="xmlmodule">Module xmlmodule</a>:</h2><p><a href="html/libxml-xmlmodule.html#XML_MODULE_LAZY">XML_MODULE_LAZY</a><br />
<a href="html/libxml-xmlmodule.html#XML_MODULE_LOCAL">XML_MODULE_LOCAL</a><br />
<a href="html/libxml-xmlmodule.html#xmlModule">xmlModule</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleClose">xmlModuleClose</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleFree">xmlModuleFree</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOption">xmlModuleOption</a><br />
<a href="html/libxml-xmlmodule.html#xmlModulePtr">xmlModulePtr</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleSymbol">xmlModuleSymbol</a><br />
</p><h2><a name="xmlreader" id="xmlreader">Module xmlreader</a>:</h2><p><a href="html/libxml-xmlreader.html#XML_PARSER_DEFAULTATTRS">XML_PARSER_DEFAULTATTRS</a><br />

View File

@ -498,6 +498,8 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-tree.html#XML_LOCAL_NAMESPACE">XML_LOCAL_NAMESPACE</a><br />
<a href="html/libxml-parserInternals.html#XML_MAX_NAMELEN">XML_MAX_NAMELEN</a><br />
<a href="html/libxml-xmlerror.html#XML_MODULE_CLOSE">XML_MODULE_CLOSE</a><br />
<a href="html/libxml-xmlmodule.html#XML_MODULE_LAZY">XML_MODULE_LAZY</a><br />
<a href="html/libxml-xmlmodule.html#XML_MODULE_LOCAL">XML_MODULE_LOCAL</a><br />
<a href="html/libxml-xmlerror.html#XML_MODULE_OPEN">XML_MODULE_OPEN</a><br />
<a href="html/libxml-tree.html#XML_NAMESPACE_DECL">XML_NAMESPACE_DECL</a><br />
<a href="html/libxml-tree.html#XML_NOTATION_NODE">XML_NOTATION_NODE</a><br />
@ -2050,6 +2052,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlmodule.html#xmlModuleClose">xmlModuleClose</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleFree">xmlModuleFree</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOption">xmlModuleOption</a><br />
<a href="html/libxml-xmlmodule.html#xmlModulePtr">xmlModulePtr</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleSymbol">xmlModuleSymbol</a><br />
<a href="html/libxml-threads.html#xmlMutex">xmlMutex</a><br />

File diff suppressed because one or more lines are too long

View File

@ -2598,8 +2598,11 @@
<summary>dynamic module loading</summary>
<description>basic API for dynamic module loading, used by libexslt added in 2.6.17 </description>
<author>Joel W. Reed </author>
<exports symbol='XML_MODULE_LAZY' type='enum'/>
<exports symbol='XML_MODULE_LOCAL' type='enum'/>
<exports symbol='xmlModule' type='typedef'/>
<exports symbol='xmlModulePtr' type='typedef'/>
<exports symbol='xmlModuleOption' type='typedef'/>
<exports symbol='xmlModuleFree' type='function'/>
<exports symbol='xmlModuleSymbol' type='function'/>
<exports symbol='xmlModuleOpen' type='function'/>
@ -4616,6 +4619,8 @@
<enum name='XML_IO_UNKNOWN' file='xmlerror' value='1500' type='xmlParserErrors'/>
<enum name='XML_IO_WRITE' file='xmlerror' value='1546' type='xmlParserErrors' info='1546'/>
<enum name='XML_MODULE_CLOSE' file='xmlerror' value='4901' type='xmlParserErrors' info='4901'/>
<enum name='XML_MODULE_LAZY' file='xmlmodule' value='1' type='xmlModuleOption' info='lazy binding'/>
<enum name='XML_MODULE_LOCAL' file='xmlmodule' value='2' type='xmlModuleOption' info=' local binding'/>
<enum name='XML_MODULE_OPEN' file='xmlerror' value='4900' type='xmlParserErrors' info='4900'/>
<enum name='XML_NAMESPACE_DECL' file='tree' value='18' type='xmlElementType'/>
<enum name='XML_NOTATION_NODE' file='tree' value='12' type='xmlElementType'/>
@ -5662,6 +5667,7 @@ actually an xmlCharEncoding'/>
</struct>
<typedef name='xmlLocationSetPtr' file='xpointer' type='xmlLocationSet *'/>
<struct name='xmlModule' file='xmlmodule' type='struct _xmlModule'/>
<typedef name='xmlModuleOption' file='xmlmodule' type='enum'/>
<typedef name='xmlModulePtr' file='xmlmodule' type='xmlModule *'/>
<struct name='xmlMutex' file='threads' type='struct _xmlMutex'/>
<typedef name='xmlMutexPtr' file='threads' type='xmlMutex *'/>
@ -10070,9 +10076,10 @@ actually an xmlCharEncoding'/>
</function>
<function name='xmlModuleOpen' file='xmlmodule'>
<cond>defined(LIBXML_MODULES_ENABLED)</cond>
<info>Opens a module/shared library given its name or path</info>
<info>Opens a module/shared library given its name or path TODO: options are not yet implemented.</info>
<return type='xmlModulePtr' info='a handle for the module or NULL in case of error'/>
<arg name='name' type='const char *' info='the module name'/>
<arg name='options' type='int' info='a set of xmlModuleOption'/>
</function>
<function name='xmlModuleSymbol' file='xmlmodule'>
<cond>defined(LIBXML_MODULES_ENABLED)</cond>

View File

@ -492,6 +492,8 @@
<reference name='XML_LOCAL_NAMESPACE' href='html/libxml-tree.html#XML_LOCAL_NAMESPACE'/>
<reference name='XML_MAX_NAMELEN' href='html/libxml-parserInternals.html#XML_MAX_NAMELEN'/>
<reference name='XML_MODULE_CLOSE' href='html/libxml-xmlerror.html#XML_MODULE_CLOSE'/>
<reference name='XML_MODULE_LAZY' href='html/libxml-xmlmodule.html#XML_MODULE_LAZY'/>
<reference name='XML_MODULE_LOCAL' href='html/libxml-xmlmodule.html#XML_MODULE_LOCAL'/>
<reference name='XML_MODULE_OPEN' href='html/libxml-xmlerror.html#XML_MODULE_OPEN'/>
<reference name='XML_NAMESPACE_DECL' href='html/libxml-tree.html#XML_NAMESPACE_DECL'/>
<reference name='XML_NOTATION_NODE' href='html/libxml-tree.html#XML_NOTATION_NODE'/>
@ -2044,6 +2046,7 @@
<reference name='xmlModuleClose' href='html/libxml-xmlmodule.html#xmlModuleClose'/>
<reference name='xmlModuleFree' href='html/libxml-xmlmodule.html#xmlModuleFree'/>
<reference name='xmlModuleOpen' href='html/libxml-xmlmodule.html#xmlModuleOpen'/>
<reference name='xmlModuleOption' href='html/libxml-xmlmodule.html#xmlModuleOption'/>
<reference name='xmlModulePtr' href='html/libxml-xmlmodule.html#xmlModulePtr'/>
<reference name='xmlModuleSymbol' href='html/libxml-xmlmodule.html#xmlModuleSymbol'/>
<reference name='xmlMutex' href='html/libxml-threads.html#xmlMutex'/>
@ -3764,6 +3767,8 @@
<ref name='XML_LOCAL_NAMESPACE'/>
<ref name='XML_MAX_NAMELEN'/>
<ref name='XML_MODULE_CLOSE'/>
<ref name='XML_MODULE_LAZY'/>
<ref name='XML_MODULE_LOCAL'/>
<ref name='XML_MODULE_OPEN'/>
<ref name='XML_NAMESPACE_DECL'/>
<ref name='XML_NOTATION_NODE'/>
@ -5352,6 +5357,7 @@
<ref name='xmlModuleClose'/>
<ref name='xmlModuleFree'/>
<ref name='xmlModuleOpen'/>
<ref name='xmlModuleOption'/>
<ref name='xmlModulePtr'/>
<ref name='xmlModuleSymbol'/>
<ref name='xmlMutex'/>
@ -12261,10 +12267,13 @@
<ref name='xmlStrdupFunc'/>
</file>
<file name='xmlmodule'>
<ref name='XML_MODULE_LAZY'/>
<ref name='XML_MODULE_LOCAL'/>
<ref name='xmlModule'/>
<ref name='xmlModuleClose'/>
<ref name='xmlModuleFree'/>
<ref name='xmlModuleOpen'/>
<ref name='xmlModuleOption'/>
<ref name='xmlModulePtr'/>
<ref name='xmlModuleSymbol'/>
</file>
@ -16575,6 +16584,7 @@
<ref name='xmlDecodeEntities'/>
<ref name='xmlEncodeEntities'/>
<ref name='xmlLoadExternalEntity'/>
<ref name='xmlModuleOpen'/>
<ref name='xmlNamespaceParseNCName'/>
<ref name='xmlNamespaceParseNSDef'/>
<ref name='xmlNamespaceParseQName'/>
@ -21776,6 +21786,7 @@
<ref name='HTML_PI_NODE'/>
<ref name='HTML_PRESERVE_NODE'/>
<ref name='HTML_TEXT_NODE'/>
<ref name='xmlModuleOpen'/>
<ref name='xmlSaveDoc'/>
<ref name='xmlSaveTree'/>
<ref name='xmlTextReaderNextSibling'/>
@ -23941,6 +23952,7 @@
<word name='options'>
<ref name='htmlCtxtUseOptions'/>
<ref name='xmlCtxtUseOptions'/>
<ref name='xmlModuleOpen'/>
<ref name='xmlSaveToFd'/>
<ref name='xmlSaveToFilename'/>
<ref name='xmlSaveToIO'/>
@ -28437,6 +28449,9 @@
<word name='xmlLockLibrary'>
<ref name='xmlLockLibrary'/>
</word>
<word name='xmlModuleOption'>
<ref name='xmlModuleOpen'/>
</word>
<word name='xmlMutexLock'>
<ref name='xmlMutexLock'/>
</word>
@ -28953,6 +28968,7 @@
<ref name='xmlTextWriterStartDocument'/>
</word>
<word name='yet'>
<ref name='xmlModuleOpen'/>
<ref name='xmlPatterncompile'/>
<ref name='xmlSaveDoc'/>
<ref name='xmlSaveTree'/>

View File

@ -27,21 +27,26 @@ extern "C" {
typedef struct _xmlModule xmlModule;
typedef xmlModule *xmlModulePtr;
#ifdef __cplusplus
}
#endif
/**
* xmlModuleOption:
*
* enumeration of options that can be passed down to xmlModuleOpen()
*/
typedef enum {
XML_MODULE_LAZY = 1, /* lazy binding */
XML_MODULE_LOCAL= 2 /* local binding */
} xmlModuleOption;
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename,
int options);
XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename);
XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module,
const char* name,
void **result);
XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, const char* name, void **result);
XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module);
XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module);
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module);
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module);
#ifdef __cplusplus
}

View File

@ -9256,6 +9256,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
(!ctxt->disableSAX))
ctxt->sax->endElementNs(ctxt->userData, name,
prefix, URI);
if (ctxt->nsNr - nsNr > 0)
nsPop(ctxt, ctxt->nsNr - nsNr);
#ifdef LIBXML_SAX1_ENABLED
} else {
if ((ctxt->sax != NULL) &&

5
result/noent/ns6 Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<root>
<foo xmlns="http://abc"/>
<bar/>
</root>

5
result/ns6 Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<root>
<foo xmlns="http://abc"/>
<bar/>
</root>

10
result/ns6.rde Normal file
View File

@ -0,0 +1,10 @@
0 1 root 0 0
1 14 #text 0 1
1 1 foo 1 0
1 14 #text 0 1
1 1 bar 1 0
1 14 #text 0 1
0 15 root 0 0

10
result/ns6.rdr Normal file
View File

@ -0,0 +1,10 @@
0 1 root 0 0
1 14 #text 0 1
1 1 foo 1 0
1 14 #text 0 1
1 1 bar 1 0
1 14 #text 0 1
0 15 root 0 0

15
result/ns6.sax Normal file
View File

@ -0,0 +1,15 @@
SAX.setDocumentLocator()
SAX.startDocument()
SAX.startElement(root)
SAX.characters(
, 3)
SAX.startElement(foo, xmlns='http://abc')
SAX.endElement(foo)
SAX.characters(
, 3)
SAX.startElement(bar)
SAX.endElement(bar)
SAX.characters(
, 1)
SAX.endElement(root)
SAX.endDocument()

4
test/ns6 Normal file
View File

@ -0,0 +1,4 @@
<root>
<foo xmlns="http://abc" />
<bar />
</root>

View File

@ -27,7 +27,7 @@
#define MODULE_PATH ".libs"
#endif
typedef int (*hello_world_t)();
typedef int (*hello_world_t)(void);
int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlChar filename[PATH_MAX];
@ -35,11 +35,12 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
hello_world_t hello_world = NULL;
/* build the module filename, and confirm the module exists */
xmlStrPrintf(filename, sizeof(filename), "%s/testdso%s",
xmlStrPrintf(filename, sizeof(filename),
(const xmlChar*) "%s/testdso%s",
(const xmlChar*)MODULE_PATH,
(const xmlChar*)LIBXML_MODULE_EXTENSION);
module = xmlModuleOpen((const char*)filename);
module = xmlModuleOpen((const char*)filename, 0);
if (module)
{
if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) {

View File

@ -58,13 +58,15 @@ xmlModuleErrMemory(xmlModulePtr module, const char *extra)
/**
* xmlModuleOpen:
* @name: the module name
* @options: a set of xmlModuleOption
*
* Opens a module/shared library given its name or path
* TODO: options are not yet implemented.
*
* Returns a handle for the module or NULL in case of error
*/
xmlModulePtr
xmlModuleOpen(const char *name)
xmlModuleOpen(const char *name, int options ATTRIBUTE_UNUSED)
{
xmlModulePtr module;