mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-11 05:17:37 +03:00
preparing for a 2.4.3 release even if it may not be ready yet redirected
* Makefile.am configure.in include/libxml/xmlwin32version.h: preparing for a 2.4.3 release even if it may not be ready yet * catalog.c parser.c xmlIO.c include/libxml/catalog.h: redirected all file parsing lookup to go through the entity resolver, add to add an API to bypass it (needed to load catalogs themselves), some cleanup on the catalog code too. * nanoftp.c: small cleanup * doc/catalog.html: small update Daniel
This commit is contained in:
parent
bc2ddbe7c3
commit
9f7b84bb07
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
Thu Aug 23 17:26:58 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* Makefile.am configure.in include/libxml/xmlwin32version.h:
|
||||
preparing for a 2.4.3 release even if it may not be ready yet
|
||||
* catalog.c parser.c xmlIO.c include/libxml/catalog.h: redirected
|
||||
all file parsing lookup to go through the entity resolver, add
|
||||
to add an API to bypass it (needed to load catalogs themselves),
|
||||
some cleanup on the catalog code too.
|
||||
* nanoftp.c: small cleanup
|
||||
* doc/catalog.html: small update
|
||||
|
||||
Thu Aug 23 12:22:26 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* catalog.c: fixed bugi #59406 in SGML catalog parsing reported by
|
||||
|
@ -509,7 +509,8 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml.spec \
|
||||
example/Makefile.am example/gjobread.c example/gjobs.xml \
|
||||
$(man_MANS) libxml-2.0.pc.in \
|
||||
vms/build_libxml.com vms/config.vms \
|
||||
strio.c strio.h trio.c trio.h triop.h libxml.h
|
||||
trionan.c trionan.h strio.c strio.h trio.c trio.h \
|
||||
triop.h triodef.h libxml.h
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libxml-2.0.pc
|
||||
|
83
catalog.c
83
catalog.c
@ -58,6 +58,7 @@
|
||||
typedef enum {
|
||||
XML_CATA_NONE = 0,
|
||||
XML_CATA_CATALOG,
|
||||
XML_CATA_BROKEN_CATALOG,
|
||||
XML_CATA_NEXT_CATALOG,
|
||||
XML_CATA_PUBLIC,
|
||||
XML_CATA_SYSTEM,
|
||||
@ -311,6 +312,71 @@ xmlCatalogUnWrapURN(const xmlChar *urn) {
|
||||
return(xmlStrdup(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParseCatalogFile:
|
||||
* @filename: the filename
|
||||
*
|
||||
* parse an XML file and build a tree. It's like xmlParseFile()
|
||||
* except it bypass all catalog lookups.
|
||||
*
|
||||
* Returns the resulting document tree or NULL in case of error
|
||||
*/
|
||||
|
||||
xmlDocPtr
|
||||
xmlParseCatalogFile(const char *filename) {
|
||||
xmlDocPtr ret;
|
||||
xmlParserCtxtPtr ctxt;
|
||||
char *directory = NULL;
|
||||
xmlParserInputPtr inputStream;
|
||||
xmlParserInputBufferPtr buf;
|
||||
|
||||
ctxt = xmlNewParserCtxt();
|
||||
if (ctxt == NULL) {
|
||||
if (xmlDefaultSAXHandler.error != NULL) {
|
||||
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
|
||||
if (buf == NULL) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputStream = xmlNewInputStream(ctxt);
|
||||
if (inputStream == NULL) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputStream->filename = xmlMemStrdup(filename);
|
||||
inputStream->buf = buf;
|
||||
inputStream->base = inputStream->buf->buffer->content;
|
||||
inputStream->cur = inputStream->buf->buffer->content;
|
||||
inputStream->end =
|
||||
&inputStream->buf->buffer->content[inputStream->buf->buffer->use];
|
||||
|
||||
inputPush(ctxt, inputStream);
|
||||
if ((ctxt->directory == NULL) && (directory == NULL))
|
||||
directory = xmlParserGetDirectory(filename);
|
||||
if ((ctxt->directory == NULL) && (directory != NULL))
|
||||
ctxt->directory = directory;
|
||||
|
||||
xmlParseDocument(ctxt);
|
||||
|
||||
if (ctxt->wellFormed)
|
||||
ret = ctxt->myDoc;
|
||||
else {
|
||||
ret = NULL;
|
||||
xmlFreeDoc(ctxt->myDoc);
|
||||
ctxt->myDoc = NULL;
|
||||
}
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* The XML Catalog parser *
|
||||
@ -585,7 +651,7 @@ xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename) {
|
||||
if (filename == NULL)
|
||||
return(NULL);
|
||||
|
||||
doc = xmlParseFile((const char *) filename);
|
||||
doc = xmlParseCatalogFile((const char *) filename);
|
||||
if (doc == NULL) {
|
||||
if (xmlDebugCatalogs)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
@ -659,8 +725,10 @@ xmlFetchXMLCatalogFile(xmlCatalogEntryPtr catal) {
|
||||
* Fetch and parse
|
||||
*/
|
||||
children = xmlParseXMLCatalogFile(catal->prefer, catal->value);
|
||||
if (children == NULL)
|
||||
if (children == NULL) {
|
||||
catal->type = XML_CATA_BROKEN_CATALOG;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Where a real test and set would be needed !
|
||||
@ -718,12 +786,13 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd");
|
||||
cur = catal;
|
||||
while (cur != NULL) {
|
||||
switch (cur->type) {
|
||||
case XML_CATA_BROKEN_CATALOG:
|
||||
case XML_CATA_CATALOG:
|
||||
if (cur == catal) {
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case XML_CATA_NEXT_CATALOG:
|
||||
node = xmlNewDocNode(doc, ns, BAD_CAST "nextCatalog", NULL);
|
||||
xmlSetProp(node, BAD_CAST "catalog", cur->value);
|
||||
@ -832,7 +901,9 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type,
|
||||
xmlCatalogEntryPtr cur;
|
||||
xmlCatalogEntryType typ;
|
||||
|
||||
if ((catal == NULL) || (catal->type != XML_CATA_CATALOG))
|
||||
if ((catal == NULL) ||
|
||||
((catal->type != XML_CATA_CATALOG) &&
|
||||
(catal->type != XML_CATA_BROKEN_CATALOG)))
|
||||
return(-1);
|
||||
typ = xmlGetXMLCatalogEntryType(type);
|
||||
if (typ == XML_CATA_NONE) {
|
||||
@ -888,7 +959,9 @@ xmlDelXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *value) {
|
||||
xmlCatalogEntryPtr cur, prev, tmp;
|
||||
int ret = 0;
|
||||
|
||||
if ((catal == NULL) || (catal->type != XML_CATA_CATALOG))
|
||||
if ((catal == NULL) ||
|
||||
((catal->type != XML_CATA_CATALOG) &&
|
||||
(catal->type != XML_CATA_BROKEN_CATALOG)))
|
||||
return(-1);
|
||||
if (value == NULL)
|
||||
return(-1);
|
||||
|
@ -91,9 +91,6 @@
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
|
@ -6,7 +6,7 @@ AC_CANONICAL_HOST
|
||||
|
||||
LIBXML_MAJOR_VERSION=2
|
||||
LIBXML_MINOR_VERSION=4
|
||||
LIBXML_MICRO_VERSION=2
|
||||
LIBXML_MICRO_VERSION=3
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
|
||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||
|
||||
|
@ -18,7 +18,7 @@ href="http://xmlsoft.org/catalog.html">http://xmlsoft.org/catalog.html</a></p>
|
||||
<p>Mailing-list archive: <a
|
||||
href="http://mail.gnome.org/archives/xml/">http://mail.gnome.org/archives/xml/</a></p>
|
||||
|
||||
<p>Version: $Revision: 1.1 $</p>
|
||||
<p>Version: $Revision: 1.2 $</p>
|
||||
|
||||
<p>Table of Content:</p>
|
||||
<ol>
|
||||
@ -92,8 +92,7 @@ concrete example, suppose you are authoring a DocBook document, this one
|
||||
starts with the following DOCTYPE definition:</p>
|
||||
<pre><?xml version='1.0'?>
|
||||
<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
|
||||
"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
|
||||
</pre>
|
||||
"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd"></pre>
|
||||
|
||||
<p>When validating the document with libxml, the catalog will be
|
||||
automatically consulted to lookup the public identifier "-//Norman Walsh//DTD
|
||||
@ -349,6 +348,10 @@ catalog state, those routines are primarily designed for xmlcatalog, I'm not
|
||||
sure that exposing more complex interfaces (like navigation ones) would be
|
||||
really useful.</p>
|
||||
|
||||
<p>The xmlParseCatalogFile() is a function used to load XML Catalog files,
|
||||
it's similar as xmlParseFile() except it bypass all catalog lookups, it's
|
||||
provided because this functionality may be useful for client tools.</p>
|
||||
|
||||
<h3>threaded environments:</h3>
|
||||
|
||||
<p>Since the catalog tree is built progressively, some care has been taken to
|
||||
@ -385,6 +388,6 @@ me:</p>
|
||||
|
||||
<p><a href="mailto:daniel@veillard.com">Daniel Veillard</a></p>
|
||||
|
||||
<p>$Id: catalog.html,v 1.1 2001/08/22 23:44:08 veillard Exp $</p>
|
||||
<p>$Id: catalog.html,v 1.2 2001/08/23 00:52:23 veillard Exp $</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -68,6 +68,7 @@ int xmlCatalogAdd (const xmlChar *type,
|
||||
const xmlChar *orig,
|
||||
const xmlChar *replace);
|
||||
int xmlCatalogRemove (const xmlChar *value);
|
||||
xmlDocPtr xmlParseCatalogFile (const char *filename);
|
||||
|
||||
/*
|
||||
* Strictly minimal interfaces for per-document catalogs used
|
||||
|
@ -27,21 +27,21 @@ extern void xmlCheckVersion(int version);
|
||||
*
|
||||
* the version string like "1.2.3"
|
||||
*/
|
||||
#define LIBXML_DOTTED_VERSION "2.4.2"
|
||||
#define LIBXML_DOTTED_VERSION "2.4.3"
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 1002003
|
||||
*/
|
||||
#define LIBXML_VERSION 20402
|
||||
#define LIBXML_VERSION 20403
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "1002003"
|
||||
*/
|
||||
#define LIBXML_VERSION_STRING "20402"
|
||||
#define LIBXML_VERSION_STRING "20403"
|
||||
|
||||
/**
|
||||
* LIBXML_TEST_VERSION:
|
||||
@ -49,7 +49,7 @@ extern void xmlCheckVersion(int version);
|
||||
* Macro to check that the libxml version in use is compatible with
|
||||
* the version the software has been compiled against
|
||||
*/
|
||||
#define LIBXML_TEST_VERSION xmlCheckVersion(20402);
|
||||
#define LIBXML_TEST_VERSION xmlCheckVersion(20403);
|
||||
|
||||
/**
|
||||
* WITH_TRIO:
|
||||
|
@ -1220,7 +1220,6 @@ xmlNanoFTPGetConnection(void *ctx) {
|
||||
struct sockaddr_in dataAddr;
|
||||
SOCKLEN_T dataAddrLen;
|
||||
|
||||
retry:
|
||||
ctxt->dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (ctxt->dataFd < 0) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
|
15
parser.c
15
parser.c
@ -9674,14 +9674,8 @@ xmlCreateFileParserCtxt(const char *filename)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlParserInputPtr inputStream;
|
||||
xmlParserInputBufferPtr buf;
|
||||
char *directory = NULL;
|
||||
|
||||
buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
|
||||
if (buf == NULL) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ctxt = xmlNewParserCtxt();
|
||||
if (ctxt == NULL) {
|
||||
if (xmlDefaultSAXHandler.error != NULL) {
|
||||
@ -9690,19 +9684,12 @@ xmlCreateFileParserCtxt(const char *filename)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputStream = xmlNewInputStream(ctxt);
|
||||
inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
|
||||
if (inputStream == NULL) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputStream->filename = xmlMemStrdup(filename);
|
||||
inputStream->buf = buf;
|
||||
inputStream->base = inputStream->buf->buffer->content;
|
||||
inputStream->cur = inputStream->buf->buffer->content;
|
||||
inputStream->end =
|
||||
&inputStream->buf->buffer->content[inputStream->buf->buffer->use];
|
||||
|
||||
inputPush(ctxt, inputStream);
|
||||
if ((ctxt->directory == NULL) && (directory == NULL))
|
||||
directory = xmlParserGetDirectory(filename);
|
||||
|
13
xmlIO.c
13
xmlIO.c
@ -1595,6 +1595,9 @@ xmlParserInputBufferCreateFilename
|
||||
|
||||
if (URI == NULL) return(NULL);
|
||||
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Try to find one of the input accept method accepting taht scheme
|
||||
* Go in reverse to give precedence to user defined handlers.
|
||||
@ -2373,7 +2376,9 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
xmlParserInputPtr ret = NULL;
|
||||
xmlChar *resource = NULL;
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
#ifdef HAVE_STAT
|
||||
struct stat info;
|
||||
#endif
|
||||
xmlCatalogAllow pref;
|
||||
#endif
|
||||
|
||||
@ -2413,7 +2418,7 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
(const xmlChar *)URL);
|
||||
}
|
||||
if ((resource == NULL) && (URL != NULL))
|
||||
resource = xmlStrdup(URL);
|
||||
resource = xmlStrdup((const xmlChar *) URL);
|
||||
|
||||
/*
|
||||
* TODO: do an URI lookup on the reference
|
||||
@ -2431,8 +2436,8 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource);
|
||||
}
|
||||
if ((tmp == NULL) &&
|
||||
(pref == XML_CATA_ALLOW_ALL) ||
|
||||
(pref == XML_CATA_ALLOW_GLOBAL)) {
|
||||
((pref == XML_CATA_ALLOW_ALL) ||
|
||||
(pref == XML_CATA_ALLOW_GLOBAL))) {
|
||||
tmp = xmlCatalogResolveURI(resource);
|
||||
}
|
||||
|
||||
@ -2501,7 +2506,7 @@ xmlGetExternalEntityLoader(void) {
|
||||
/**
|
||||
* xmlLoadExternalEntity:
|
||||
* @URL: the URL for the entity to load
|
||||
* @ID: the System ID for the entity to load
|
||||
* @ID: the Public ID for the entity to load
|
||||
* @ctxt: the context in which the entity is called or NULL
|
||||
*
|
||||
* Load an external entity, note that the use of this function for
|
||||
|
Loading…
Reference in New Issue
Block a user