mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
- added a nano FTP module
- removed SNAP from RPM - updated the status in doc
This commit is contained in:
parent
e3d88efb8d
commit
da07c34a75
@ -1,3 +1,11 @@
|
||||
Wed Jan 26 16:52:50 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* nanoftp.[ch] parser.c xmlIO.[ch]: added a Nano FTP implementation
|
||||
* debugXML.c : fixed a bug in the cat command
|
||||
* valid.c: fixing some small probs
|
||||
* libxml.spec.in: get rid of the SNAP suffix
|
||||
* doc/xml.html: updated the status
|
||||
|
||||
Mon Jan 24 14:31:09 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* xml-config.in: xml-config --version to just return the
|
||||
|
10
doc/xml.html
10
doc/xml.html
@ -146,6 +146,14 @@ for really accurate description</h3>
|
||||
<ul>
|
||||
<li>working on HTML and XML links recognition layers, get in touch with me
|
||||
if you want to test those.</li>
|
||||
<li>there is some kind of roadmap to libxml-2.0: fix I18N, and <a
|
||||
href="http://rpmfind.net/tools/gdome/messages/0039.html">change structures
|
||||
to accomodate DOM</a></li>
|
||||
<li>added a nanoFTP transport module</li>
|
||||
</ul>
|
||||
|
||||
<h3>1.8.5: Jan 21 2000</h3>
|
||||
<ul>
|
||||
<li>adding APIs to parse a well balanced chunk of XML (production <a
|
||||
href="http://www.w3.org/TR/REC-xml#NT-content">[43] content</a> of the XML
|
||||
spec)</li>
|
||||
@ -996,6 +1004,6 @@ base under gnome-xml/example</p>
|
||||
|
||||
<p><a href="mailto:Daniel.Veillard@w3.org">Daniel Veillard</a></p>
|
||||
|
||||
<p>$Id: xml.html,v 1.21 2000/01/14 14:45:21 veillard Exp $</p>
|
||||
<p>$Id: xml.html,v 1.22 2000/01/18 18:01:01 veillard Exp $</p>
|
||||
</body>
|
||||
</html>
|
||||
|
36
include/libxml/nanoftp.h
Normal file
36
include/libxml/nanoftp.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* nanohttp.c: minimalist FTP implementation to fetch external subsets.
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Daniel.Veillard@w3.org
|
||||
*/
|
||||
|
||||
#ifndef __NANO_FTP_H__
|
||||
#define __NANO_FTP_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*ftpListCallback) (void *userData,
|
||||
const char *filename, const char* attrib,
|
||||
const char *owner, const char *group,
|
||||
unsigned long size, int links, int year,
|
||||
const char *month, int day, int minute);
|
||||
typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
|
||||
|
||||
|
||||
void * xmlNanoFTPConnectTo (const char *hostname, int port);
|
||||
int xmlNanoFTPClose (void *ctx);
|
||||
void * xmlNanoFTPOpen (const char *URL);
|
||||
int xmlNanoFTPFetch (const char *URL,
|
||||
const char *filename);
|
||||
int xmlNanoFTPRead (void *ctx,
|
||||
void *dest,
|
||||
int len);
|
||||
int xmlNanoFTPGet (void *ctxt, ftpDataCallback callback,
|
||||
void *userData, const char *filename);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __NANO_FTP_H__ */
|
@ -25,12 +25,12 @@ struct _xmlParserInputBuffer {
|
||||
FILE *file; /* Input on file handler */
|
||||
void* gzfile; /* Input on a compressed stream */
|
||||
int fd; /* Input on a file descriptor */
|
||||
void *netIO; /* Input from a network stream */
|
||||
void *httpIO; /* Input from an HTTP stream */
|
||||
void *ftpIO; /* Input from an FTP stream */
|
||||
|
||||
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
|
||||
|
||||
xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
# Note that this is NOT a relocatable package
|
||||
%define ver @VERSION@
|
||||
%define RELEASE SNAP
|
||||
%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
|
||||
%define prefix /usr
|
||||
|
||||
Summary: libXML library
|
||||
Name: libxml
|
||||
Version: %ver
|
||||
Release: %rel
|
||||
Release: 1
|
||||
Copyright: LGPL
|
||||
Group: X11/Libraries
|
||||
Source: ftp://ftp.gnome.org/pub/GNOME/sources/libxml/libxml-%{ver}.tar.gz
|
||||
|
36
nanoftp.h
Normal file
36
nanoftp.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* nanohttp.c: minimalist FTP implementation to fetch external subsets.
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Daniel.Veillard@w3.org
|
||||
*/
|
||||
|
||||
#ifndef __NANO_FTP_H__
|
||||
#define __NANO_FTP_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*ftpListCallback) (void *userData,
|
||||
const char *filename, const char* attrib,
|
||||
const char *owner, const char *group,
|
||||
unsigned long size, int links, int year,
|
||||
const char *month, int day, int minute);
|
||||
typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
|
||||
|
||||
|
||||
void * xmlNanoFTPConnectTo (const char *hostname, int port);
|
||||
int xmlNanoFTPClose (void *ctx);
|
||||
void * xmlNanoFTPOpen (const char *URL);
|
||||
int xmlNanoFTPFetch (const char *URL,
|
||||
const char *filename);
|
||||
int xmlNanoFTPRead (void *ctx,
|
||||
void *dest,
|
||||
int len);
|
||||
int xmlNanoFTPGet (void *ctxt, ftpDataCallback callback,
|
||||
void *userData, const char *filename);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __NANO_FTP_H__ */
|
22
parser.c
22
parser.c
@ -176,7 +176,8 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
|
||||
|
||||
return(0);
|
||||
}
|
||||
if ((in->buf->netIO != NULL) || (in->buf->file != NULL) ||
|
||||
if ((in->buf->httpIO != NULL) || (in->buf->ftpIO != NULL) ||
|
||||
(in->buf->file != NULL) ||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
(in->buf->gzfile != NULL) ||
|
||||
#endif
|
||||
@ -5978,11 +5979,22 @@ xmlParseEndTag(xmlParserCtxtPtr ctxt) {
|
||||
* start-tag.
|
||||
*
|
||||
*/
|
||||
if (xmlStrcmp(name, ctxt->name)) {
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"Opening and ending tag mismatch: %s and %s\n", ctxt->name, name);
|
||||
if ((name == NULL) || (ctxt->name == NULL) ||
|
||||
(xmlStrcmp(name, ctxt->name))) {
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
|
||||
if ((name != NULL) && (ctxt->name != NULL)) {
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"Opening and ending tag mismatch: %s and %s\n",
|
||||
ctxt->name, name);
|
||||
} else if (ctxt->name != NULL) {
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"Ending tag eror for: %s\n", ctxt->name);
|
||||
} else {
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"Ending tag error: internal error ???\n");
|
||||
}
|
||||
|
||||
}
|
||||
ctxt->errNo = XML_ERR_TAG_NAME_MISMATCH;
|
||||
ctxt->wellFormed = 0;
|
||||
}
|
||||
|
17
valid.c
17
valid.c
@ -2602,9 +2602,9 @@ xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child,
|
||||
}
|
||||
switch (cont->type) {
|
||||
case XML_ELEMENT_CONTENT_PCDATA:
|
||||
/* Internal error !!! */
|
||||
fprintf(stderr, "Internal: MIXED struct bad\n");
|
||||
return(-1);
|
||||
if (*child == NULL) return(0);
|
||||
if ((*child)->type == XML_TEXT_NODE) return(1);
|
||||
return(0);
|
||||
case XML_ELEMENT_CONTENT_ELEMENT:
|
||||
if (*child == NULL) return(0);
|
||||
ret = (!xmlStrcmp((*child)->name, cont->name));
|
||||
@ -3049,10 +3049,13 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
|
||||
return(0);
|
||||
}
|
||||
if (xmlStrcmp(doc->intSubset->name, root->name)) {
|
||||
VERROR(ctxt->userData,
|
||||
"Not valid: root and DtD name do not match '%s' and '%s'\n",
|
||||
root->name, doc->intSubset->name);
|
||||
return(0);
|
||||
if ((xmlStrcmp(doc->intSubset->name, BAD_CAST "HTML")) ||
|
||||
(xmlStrcmp(root->name, BAD_CAST "html"))) {
|
||||
VERROR(ctxt->userData,
|
||||
"Not valid: root and DtD name do not match '%s' and '%s'\n",
|
||||
root->name, doc->intSubset->name);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
37
xmlIO.c
37
xmlIO.c
@ -39,6 +39,7 @@
|
||||
#include "parserInternals.h"
|
||||
#include "xmlIO.h"
|
||||
#include "nanohttp.h"
|
||||
#include "nanoftp.h"
|
||||
|
||||
/* #define DEBUG_INPUT */
|
||||
/* #define VERBOSE_FAILURE */
|
||||
@ -76,7 +77,8 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) {
|
||||
ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;
|
||||
ret->encoder = xmlGetCharEncodingHandler(enc);
|
||||
ret->fd = -1;
|
||||
ret->netIO = NULL;
|
||||
ret->httpIO = NULL;
|
||||
ret->ftpIO = NULL;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
@ -97,8 +99,10 @@ xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) {
|
||||
if (in->gzfile != NULL)
|
||||
gzclose(in->gzfile);
|
||||
#endif
|
||||
if (in->netIO != NULL)
|
||||
xmlNanoHTTPClose(in->netIO);
|
||||
if (in->httpIO != NULL)
|
||||
xmlNanoHTTPClose(in->httpIO);
|
||||
if (in->ftpIO != NULL)
|
||||
xmlNanoFTPClose(in->ftpIO);
|
||||
if (in->fd >= 0)
|
||||
close(in->fd);
|
||||
memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer));
|
||||
@ -125,16 +129,26 @@ xmlParserInputBufferCreateFilename(const char *filename, xmlCharEncoding enc) {
|
||||
#else
|
||||
int input = -1;
|
||||
#endif
|
||||
void *netIO = NULL;
|
||||
void *httpIO = NULL;
|
||||
void *ftpIO = NULL;
|
||||
|
||||
if (filename == NULL) return(NULL);
|
||||
|
||||
if (!strncmp(filename, "http://", 7)) {
|
||||
netIO = xmlNanoHTTPOpen(filename, NULL);
|
||||
if (netIO == NULL) {
|
||||
httpIO = xmlNanoHTTPOpen(filename, NULL);
|
||||
if (httpIO == NULL) {
|
||||
#ifdef VERBOSE_FAILURE
|
||||
fprintf (stderr, "Cannot read URL %s\n", filename);
|
||||
perror ("xmlNanoHTTPOpen failed");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
} else if (!strncmp(filename, "ftp://", 6)) {
|
||||
ftpIO = xmlNanoFTPOpen(filename);
|
||||
if (ftpIO == NULL) {
|
||||
#ifdef VERBOSE_FAILURE
|
||||
fprintf (stderr, "Cannot read URL %s\n", filename);
|
||||
perror ("xmlNanoFTPOpen failed");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
@ -201,7 +215,8 @@ xmlParserInputBufferCreateFilename(const char *filename, xmlCharEncoding enc) {
|
||||
#else
|
||||
ret->fd = input;
|
||||
#endif
|
||||
ret->netIO = netIO;
|
||||
ret->httpIO = httpIO;
|
||||
ret->ftpIO = ftpIO;
|
||||
}
|
||||
xmlParserInputBufferRead(ret, 4);
|
||||
|
||||
@ -339,8 +354,10 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
|
||||
fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n");
|
||||
return(-1);
|
||||
}
|
||||
if (in->netIO != NULL) {
|
||||
res = xmlNanoHTTPRead(in->netIO, &buffer[0], len);
|
||||
if (in->httpIO != NULL) {
|
||||
res = xmlNanoHTTPRead(in->httpIO, &buffer[0], len);
|
||||
} else if (in->ftpIO != NULL) {
|
||||
res = xmlNanoFTPRead(in->ftpIO, &buffer[0], len);
|
||||
} else if (in->file != NULL) {
|
||||
res = fread(&buffer[0], 1, len, in->file);
|
||||
#ifdef HAVE_ZLIB_H
|
||||
@ -405,7 +422,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
|
||||
int
|
||||
xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) {
|
||||
/* xmlBufferEmpty(in->buffer); */
|
||||
if ((in->netIO != NULL) || (in->file != NULL) ||
|
||||
if ((in->httpIO != NULL) || (in->ftpIO != NULL) || (in->file != NULL) ||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
(in->gzfile != NULL) ||
|
||||
#endif
|
||||
|
4
xmlIO.h
4
xmlIO.h
@ -25,12 +25,12 @@ struct _xmlParserInputBuffer {
|
||||
FILE *file; /* Input on file handler */
|
||||
void* gzfile; /* Input on a compressed stream */
|
||||
int fd; /* Input on a file descriptor */
|
||||
void *netIO; /* Input from a network stream */
|
||||
void *httpIO; /* Input from an HTTP stream */
|
||||
void *ftpIO; /* Input from an FTP stream */
|
||||
|
||||
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
|
||||
|
||||
xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user