1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

Changed the new xmlRead/xmlCtxtRead APIs to have an extra base URL

* parser.c xmllint.c doc/libxml2-api.xml include/libxml/parser.h:
  Changed the new xmlRead/xmlCtxtRead APIs to have an extra
  base URL parameter when not loading from a file or URL.
Daniel
This commit is contained in:
Daniel Veillard
2003-09-25 21:05:58 +00:00
parent 092643b52d
commit 60942def6a
6 changed files with 66 additions and 28 deletions

View File

@ -1,3 +1,9 @@
Thu Sep 25 23:03:23 CEST 2003 Daniel Veillard <daniel@veillard.com>
* parser.c xmllint.c doc/libxml2-api.xml include/libxml/parser.h:
Changed the new xmlRead/xmlCtxtRead APIs to have an extra
base URL parameter when not loading from a file or URL.
Thu Sep 25 16:23:58 CEST 2003 Daniel Veillard <daniel@veillard.com> Thu Sep 25 16:23:58 CEST 2003 Daniel Veillard <daniel@veillard.com>
* configure.in: preparing a beta3 solving the ABI problems * configure.in: preparing a beta3 solving the ABI problems

View File

@ -5746,6 +5746,7 @@ actually an xmlCharEncoding'/>
<return type='xmlDocPtr' info='the resulting document tree'/> <return type='xmlDocPtr' info='the resulting document tree'/>
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/> <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
<arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/> <arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -5754,6 +5755,7 @@ actually an xmlCharEncoding'/>
<return type='xmlDocPtr' info='the resulting document tree'/> <return type='xmlDocPtr' info='the resulting document tree'/>
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/> <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
<arg name='fd' type='int' info='an open file descriptor'/> <arg name='fd' type='int' info='an open file descriptor'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -5772,6 +5774,7 @@ actually an xmlCharEncoding'/>
<arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/> <arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
<arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/> <arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/>
<arg name='ioctx' type='void *' info='an I/O handler'/> <arg name='ioctx' type='void *' info='an I/O handler'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -5781,6 +5784,7 @@ actually an xmlCharEncoding'/>
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/> <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
<arg name='buffer' type='const char *' info='a pointer to a char array'/> <arg name='buffer' type='const char *' info='a pointer to a char array'/>
<arg name='size' type='int' info='the size of the array'/> <arg name='size' type='int' info='the size of the array'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -6554,9 +6558,9 @@ actually an xmlCharEncoding'/>
<info>Find the userdata specified by the QNames tuple</info> <info>Find the userdata specified by the QNames tuple</info>
<return type='void *' info='the pointer to the userdata'/> <return type='void *' info='the pointer to the userdata'/>
<arg name='table' type='xmlHashTablePtr' info='the hash table'/> <arg name='table' type='xmlHashTablePtr' info='the hash table'/>
<arg name='prefix' type='const xmlChar *' info='the second prefix of the userdata'/> <arg name='prefix' type='const xmlChar *' info='the prefix of the userdata'/>
<arg name='name' type='const xmlChar *' info='the name of the userdata'/> <arg name='name' type='const xmlChar *' info='the name of the userdata'/>
<arg name='prefix2' type='const xmlChar *' info=''/> <arg name='prefix2' type='const xmlChar *' info='the second prefix of the userdata'/>
<arg name='name2' type='const xmlChar *' info='a second name of the userdata'/> <arg name='name2' type='const xmlChar *' info='a second name of the userdata'/>
</function> </function>
<function name='xmlHashQLookup3' file='hash'> <function name='xmlHashQLookup3' file='hash'>
@ -8402,6 +8406,7 @@ actually an xmlCharEncoding'/>
<info>parse an XML in-memory document and build a tree.</info> <info>parse an XML in-memory document and build a tree.</info>
<return type='xmlDocPtr' info='the resulting document tree'/> <return type='xmlDocPtr' info='the resulting document tree'/>
<arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/> <arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -8409,6 +8414,7 @@ actually an xmlCharEncoding'/>
<info>parse an XML from a file descriptor and build a tree.</info> <info>parse an XML from a file descriptor and build a tree.</info>
<return type='xmlDocPtr' info='the resulting document tree'/> <return type='xmlDocPtr' info='the resulting document tree'/>
<arg name='fd' type='int' info='an open file descriptor'/> <arg name='fd' type='int' info='an open file descriptor'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -8425,6 +8431,7 @@ actually an xmlCharEncoding'/>
<arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/> <arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
<arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/> <arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/>
<arg name='ioctx' type='void *' info='an I/O handler'/> <arg name='ioctx' type='void *' info='an I/O handler'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>
@ -8433,6 +8440,7 @@ actually an xmlCharEncoding'/>
<return type='xmlDocPtr' info='the resulting document tree'/> <return type='xmlDocPtr' info='the resulting document tree'/>
<arg name='buffer' type='const char *' info='a pointer to a char array'/> <arg name='buffer' type='const char *' info='a pointer to a char array'/>
<arg name='size' type='int' info='the size of the array'/> <arg name='size' type='int' info='the size of the array'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/> <arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/> <arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function> </function>

View File

@ -1055,30 +1055,35 @@ XMLPUBFUN int XMLCALL
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlReadDoc (const xmlChar *cur, xmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlReadFile (const char *filename, xmlReadFile (const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlReadMemory (const char *buffer, xmlReadMemory (const char *buffer,
int size, int size,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlReadFd (int fd, xmlReadFd (int fd,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlReadIO (xmlInputReadCallback ioread, xmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose, xmlInputCloseCallback ioclose,
void *ioctx, void *ioctx,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur, const xmlChar *cur,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
@ -1090,11 +1095,13 @@ XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer, const char *buffer,
int size, int size,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlCtxtReadFd (xmlParserCtxtPtr ctxt, xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd, int fd,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
@ -1102,6 +1109,7 @@ XMLPUBFUN xmlDocPtr XMLCALL
xmlInputReadCallback ioread, xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose, xmlInputCloseCallback ioclose,
void *ioctx, void *ioctx,
const char *URL,
const char *encoding, const char *encoding,
int options); int options);

View File

@ -12102,6 +12102,7 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
/** /**
* xmlDoRead: * xmlDoRead:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* @reuse: keep the context for reuse * @reuse: keep the context for reuse
@ -12111,7 +12112,8 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
* Returns the resulting document tree or NULL * Returns the resulting document tree or NULL
*/ */
static xmlDocPtr static xmlDocPtr
xmlDoRead(xmlParserCtxtPtr ctxt, const char *encoding, int options, int reuse) xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding,
int options, int reuse)
{ {
xmlDocPtr ret; xmlDocPtr ret;
@ -12123,6 +12125,9 @@ xmlDoRead(xmlParserCtxtPtr ctxt, const char *encoding, int options, int reuse)
if (hdlr != NULL) if (hdlr != NULL)
xmlSwitchToEncoding(ctxt, hdlr); xmlSwitchToEncoding(ctxt, hdlr);
} }
if ((URL != NULL) && (ctxt->input != NULL) &&
(ctxt->input->filename == NULL))
ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL);
xmlParseDocument(ctxt); xmlParseDocument(ctxt);
if ((ctxt->wellFormed) || ctxt->recovery) if ((ctxt->wellFormed) || ctxt->recovery)
ret = ctxt->myDoc; ret = ctxt->myDoc;
@ -12154,6 +12159,7 @@ xmlDoRead(xmlParserCtxtPtr ctxt, const char *encoding, int options, int reuse)
/** /**
* xmlReadDoc: * xmlReadDoc:
* @cur: a pointer to a zero terminated string * @cur: a pointer to a zero terminated string
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12162,7 +12168,7 @@ xmlDoRead(xmlParserCtxtPtr ctxt, const char *encoding, int options, int reuse)
* Returns the resulting document tree * Returns the resulting document tree
*/ */
xmlDocPtr xmlDocPtr
xmlReadDoc(const xmlChar * cur, const char *encoding, int options) xmlReadDoc(const xmlChar * cur, const char *URL, const char *encoding, int options)
{ {
xmlParserCtxtPtr ctxt; xmlParserCtxtPtr ctxt;
@ -12172,7 +12178,7 @@ xmlReadDoc(const xmlChar * cur, const char *encoding, int options)
ctxt = xmlCreateDocParserCtxt(cur); ctxt = xmlCreateDocParserCtxt(cur);
if (ctxt == NULL) if (ctxt == NULL)
return (NULL); return (NULL);
return (xmlDoRead(ctxt, encoding, options, 0)); return (xmlDoRead(ctxt, URL, encoding, options, 0));
} }
/** /**
@ -12193,13 +12199,14 @@ xmlReadFile(const char *filename, const char *encoding, int options)
ctxt = xmlCreateFileParserCtxt(filename); ctxt = xmlCreateFileParserCtxt(filename);
if (ctxt == NULL) if (ctxt == NULL)
return (NULL); return (NULL);
return (xmlDoRead(ctxt, encoding, options, 0)); return (xmlDoRead(ctxt, NULL, encoding, options, 0));
} }
/** /**
* xmlReadMemory: * xmlReadMemory:
* @buffer: a pointer to a char array * @buffer: a pointer to a char array
* @size: the size of the array * @size: the size of the array
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12208,19 +12215,20 @@ xmlReadFile(const char *filename, const char *encoding, int options)
* Returns the resulting document tree * Returns the resulting document tree
*/ */
xmlDocPtr xmlDocPtr
xmlReadMemory(const char *buffer, int size, const char *encoding, int options) xmlReadMemory(const char *buffer, int size, const char *URL, const char *encoding, int options)
{ {
xmlParserCtxtPtr ctxt; xmlParserCtxtPtr ctxt;
ctxt = xmlCreateMemoryParserCtxt(buffer, size); ctxt = xmlCreateMemoryParserCtxt(buffer, size);
if (ctxt == NULL) if (ctxt == NULL)
return (NULL); return (NULL);
return (xmlDoRead(ctxt, encoding, options, 0)); return (xmlDoRead(ctxt, URL, encoding, options, 0));
} }
/** /**
* xmlReadFd: * xmlReadFd:
* @fd: an open file descriptor * @fd: an open file descriptor
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12229,7 +12237,7 @@ xmlReadMemory(const char *buffer, int size, const char *encoding, int options)
* Returns the resulting document tree * Returns the resulting document tree
*/ */
xmlDocPtr xmlDocPtr
xmlReadFd(int fd, const char *encoding, int options) xmlReadFd(int fd, const char *URL, const char *encoding, int options)
{ {
xmlParserCtxtPtr ctxt; xmlParserCtxtPtr ctxt;
xmlParserInputBufferPtr input; xmlParserInputBufferPtr input;
@ -12253,7 +12261,7 @@ xmlReadFd(int fd, const char *encoding, int options)
return (NULL); return (NULL);
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 0)); return (xmlDoRead(ctxt, URL, encoding, options, 0));
} }
/** /**
@ -12261,6 +12269,7 @@ xmlReadFd(int fd, const char *encoding, int options)
* @ioread: an I/O read function * @ioread: an I/O read function
* @ioclose: an I/O close function * @ioclose: an I/O close function
* @ioctx: an I/O handler * @ioctx: an I/O handler
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12270,7 +12279,7 @@ xmlReadFd(int fd, const char *encoding, int options)
*/ */
xmlDocPtr xmlDocPtr
xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
void *ioctx, const char *encoding, int options) void *ioctx, const char *URL, const char *encoding, int options)
{ {
xmlParserCtxtPtr ctxt; xmlParserCtxtPtr ctxt;
xmlParserInputBufferPtr input; xmlParserInputBufferPtr input;
@ -12295,13 +12304,14 @@ xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
return (NULL); return (NULL);
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 0)); return (xmlDoRead(ctxt, URL, encoding, options, 0));
} }
/** /**
* xmlCtxtReadDoc: * xmlCtxtReadDoc:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* @cur: a pointer to a zero terminated string * @cur: a pointer to a zero terminated string
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12312,7 +12322,7 @@ xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
*/ */
xmlDocPtr xmlDocPtr
xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur, xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur,
const char *encoding, int options) const char *URL, const char *encoding, int options)
{ {
xmlParserInputPtr stream; xmlParserInputPtr stream;
@ -12328,7 +12338,7 @@ xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur,
return (NULL); return (NULL);
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 1)); return (xmlDoRead(ctxt, URL, encoding, options, 1));
} }
/** /**
@ -12361,7 +12371,7 @@ xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename,
return (NULL); return (NULL);
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 1)); return (xmlDoRead(ctxt, NULL, encoding, options, 1));
} }
/** /**
@ -12369,6 +12379,7 @@ xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename,
* @ctxt: an XML parser context * @ctxt: an XML parser context
* @buffer: a pointer to a char array * @buffer: a pointer to a char array
* @size: the size of the array * @size: the size of the array
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12379,7 +12390,7 @@ xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename,
*/ */
xmlDocPtr xmlDocPtr
xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size, xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size,
const char *encoding, int options) const char *URL, const char *encoding, int options)
{ {
xmlParserInputBufferPtr input; xmlParserInputBufferPtr input;
xmlParserInputPtr stream; xmlParserInputPtr stream;
@ -12403,13 +12414,14 @@ xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size,
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 1)); return (xmlDoRead(ctxt, URL, encoding, options, 1));
} }
/** /**
* xmlCtxtReadFd: * xmlCtxtReadFd:
* @ctxt: an XML parser context * @ctxt: an XML parser context
* @fd: an open file descriptor * @fd: an open file descriptor
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12419,8 +12431,8 @@ xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size,
* Returns the resulting document tree * Returns the resulting document tree
*/ */
xmlDocPtr xmlDocPtr
xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, const char *encoding, xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd,
int options) const char *URL, const char *encoding, int options)
{ {
xmlParserInputBufferPtr input; xmlParserInputBufferPtr input;
xmlParserInputPtr stream; xmlParserInputPtr stream;
@ -12442,7 +12454,7 @@ xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, const char *encoding,
return (NULL); return (NULL);
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 1)); return (xmlDoRead(ctxt, URL, encoding, options, 1));
} }
/** /**
@ -12451,6 +12463,7 @@ xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, const char *encoding,
* @ioread: an I/O read function * @ioread: an I/O read function
* @ioclose: an I/O close function * @ioclose: an I/O close function
* @ioctx: an I/O handler * @ioctx: an I/O handler
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL * @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s) * @options: a combination of xmlParserOption(s)
* *
@ -12462,6 +12475,7 @@ xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, const char *encoding,
xmlDocPtr xmlDocPtr
xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose, void *ioctx, xmlInputCloseCallback ioclose, void *ioctx,
const char *URL,
const char *encoding, int options) const char *encoding, int options)
{ {
xmlParserInputBufferPtr input; xmlParserInputBufferPtr input;
@ -12484,5 +12498,5 @@ xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
return (NULL); return (NULL);
} }
inputPush(ctxt, stream); inputPush(ctxt, stream);
return (xmlDoRead(ctxt, encoding, options, 1)); return (xmlDoRead(ctxt, URL, encoding, options, 1));
} }

View File

@ -673,6 +673,7 @@ xmlDictFree
xmlDictLookup xmlDictLookup
xmlDictOwns xmlDictOwns
xmlDictQLookup xmlDictQLookup
xmlDictReference
xmlDictSize xmlDictSize
xmlDocCopyNode xmlDocCopyNode
xmlDocDump xmlDocDump

View File

@ -806,7 +806,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
} }
} else if (testIO) { } else if (testIO) {
if ((filename[0] == '-') && (filename[1] == 0)) { if ((filename[0] == '-') && (filename[1] == 0)) {
doc = xmlReadFd(0, NULL, options); doc = xmlReadFd(0, NULL, NULL, options);
} else { } else {
FILE *f; FILE *f;
@ -815,12 +815,12 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (rectxt == NULL) if (rectxt == NULL)
doc = xmlReadIO((xmlInputReadCallback) myRead, doc = xmlReadIO((xmlInputReadCallback) myRead,
(xmlInputCloseCallback) myClose, f, (xmlInputCloseCallback) myClose, f,
NULL, options); filename, NULL, options);
else else
doc = xmlCtxtReadIO(rectxt, doc = xmlCtxtReadIO(rectxt,
(xmlInputReadCallback) myRead, (xmlInputReadCallback) myRead,
(xmlInputCloseCallback) myClose, f, (xmlInputCloseCallback) myClose, f,
NULL, options); filename, NULL, options);
} else } else
doc = NULL; doc = NULL;
} }
@ -858,10 +858,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
return; return;
if (rectxt == NULL) if (rectxt == NULL)
doc = xmlReadMemory((char *) base, info.st_size, NULL, options); doc = xmlReadMemory((char *) base, info.st_size,
filename, NULL, options);
else else
doc = xmlCtxtReadMemory(rectxt, doc = xmlCtxtReadMemory(rectxt, (char *) base, info.st_size,
(char *) base, info.st_size, NULL, options); filename, NULL, options);
munmap((char *) base, info.st_size); munmap((char *) base, info.st_size);
#endif #endif