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

added --nonet option fixing #112803 by adding --nonet when calling

* xmllint.c doc/xmllint.xml: added --nonet option
* doc/Makefile.am: fixing #112803 by adding --nonet when calling
  xsltproc or xmllint
* doc/xmllint.xml doc/xmllint.1: also added --schema doc and
  rebuilt
* HTMLparser.c: cleaned up the HTML parser context build when
  using an URL
Daniel
This commit is contained in:
Daniel Veillard 2003-05-13 22:14:13 +00:00
parent d437d32825
commit e8b09e40f7
6 changed files with 60 additions and 25 deletions

View File

@ -1,3 +1,13 @@
Tue May 13 18:10:38 EDT 2003 Daniel Veillard <daniel@veillard.com>
* xmllint.c doc/xmllint.xml: added --nonet option
* doc/Makefile.am: fixing #112803 by adding --nonet when calling
xsltproc or xmllint
* doc/xmllint.xml doc/xmllint.1: also added --schema doc and
rebuilt
* HTMLparser.c: cleaned up the HTML parser context build when
using an URL
Tue May 13 16:35:04 EDT 2003 Daniel Veillard <daniel@veillard.com>
* libxml.spec.in: added a comment about bug #112902

View File

@ -5348,6 +5348,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
htmlParserCtxtPtr ctxt;
htmlParserInputPtr inputStream;
xmlParserInputBufferPtr buf;
char *canonicFilename;
/* htmlCharEncoding enc; */
xmlChar *content, *content_line = (xmlChar *) "charset=";
@ -5361,27 +5362,23 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
}
memset(ctxt, 0, sizeof(htmlParserCtxt));
htmlInitParserCtxt(ctxt);
inputStream = (htmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput));
if (inputStream == NULL) {
xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
xmlFree(ctxt);
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
if (canonicFilename == NULL) {
if (xmlDefaultSAXHandler.error != NULL) {
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
}
return(NULL);
}
inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt);
xmlFree(canonicFilename);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
}
memset(inputStream, 0, sizeof(htmlParserInput));
inputStream->filename = (char *)
xmlCanonicPath((xmlChar *)filename);
inputStream->line = 1;
inputStream->col = 1;
inputStream->buf = buf;
inputStream->directory = NULL;
inputStream->base = inputStream->buf->buffer->content;
inputStream->cur = inputStream->buf->buffer->content;
inputStream->free = NULL;
inputPush(ctxt, inputStream);
/* set encoding */
if (encoding) {
content = xmlMallocAtomic (xmlStrlen(content_line) + strlen(encoding) + 1);

View File

@ -33,27 +33,27 @@ web: $(PAGES) $(APIPAGES)
$(PAGES): xml.html site.xsl
-@(if [ -x $(bindir)/xsltproc ] ; then \
$(bindir)/xsltproc --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/xml.html > index.html ; fi );
$(bindir)/xsltproc --nonet --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/xml.html > index.html ; fi );
-@(if [ -x $(bindir)/xmllint ] ; then \
$(bindir)/xmllint --valid --noout $(PAGES) ; fi );
$(bindir)/xmllint --nonet --valid --noout $(PAGES) ; fi );
$(top_srcdir)/NEWS: $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html
-@(if [ -x $(bindir)/xsltproc ] ; then \
$(bindir)/xsltproc $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html > $(top_srcdir)/NEWS ; fi );
$(bindir)/xsltproc --nonet $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html > $(top_srcdir)/NEWS ; fi );
libxml2.xsa: $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html
-@(if [ -x $(bindir)/xsltproc ] ; then \
$(bindir)/xsltproc $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html > libxml2.xsa ; fi );
$(bindir)/xsltproc --nonet $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html > libxml2.xsa ; fi );
$(APIPAGES): libxml2-refs.xml site.xsl api.xsl
-@(if [ -x $(bindir)/xsltproc ] ; then \
$(bindir)/xsltproc --html $(top_srcdir)/doc/api.xsl $(top_srcdir)/doc/xml.html ; fi );
$(bindir)/xsltproc --nonet --html $(top_srcdir)/doc/api.xsl $(top_srcdir)/doc/xml.html ; fi );
xmllint.1: xmllint.xml
-@(xsltproc xmllint.xml)
-@(xsltproc --nonet xmllint.xml)
xmlcatalog.1: xmlcatalog_man.xml
-@(xsltproc xmlcatalog_man.xml)
-@(xsltproc --nonet xmlcatalog_man.xml)
scan:
-gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h"

View File

@ -31,7 +31,8 @@ xmllint \- command line XML tool
| \fB--noblanks\fR | \fB--format\fR | \fB--testIO\fR | \fB--encode \fIencoding\fR\fR
| \fB--catalogs\fR | \fB--nocatalogs\fR | \fB--auto\fR | \fB--xinclude\fR
| \fB--loaddtd\fR | \fB--dtdattr\fR | \fB--dropdtd\fR | \fB--stream\fR
| \fB--chkregister\fR | \fB--relaxng\fR] [\fBxmlfile\fR]
| \fB--chkregister\fR | \fB--relaxng\fR | \fB--schema\fR | \fB--nonet\fR]
[\fBxmlfile\fR]
.fi
.SH "INTRODUCTION"
@ -188,6 +189,14 @@ Turn on node registration. Useful for developeres testing libxml2 node tracking
\fB--relaxng\fR \fIschema\fR
Use RelaxNG file named \fIschema\fR for validation.
.TP
\fB--schema\fR \fIschema\fR
Use a W3C XML Schema file named \fIschema\fR for validation.
.TP
\fB--nonet\fR
Do not use the Internet to fetch DTD's or entities.
.SH "SHELL"
.PP

View File

@ -79,6 +79,8 @@
<arg>--stream</arg>
<arg>--chkregister</arg>
<arg>--relaxng</arg>
<arg>--schema</arg>
<arg>--nonet</arg>
</group>
<arg><option><replaceable>xmlfile</replaceable></option></arg>
</cmdsynopsis>
@ -441,6 +443,19 @@
validation.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--schema</option> <replaceable>schema</replaceable></term>
<listitem>
<simpara>Use a W3C XML Schema file named <replaceable>schema</replaceable> for validation.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--nonet</option></term>
<listitem>
<simpara>Do not use the Internet to fetch DTD's or entities.</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -1260,6 +1260,7 @@ static void usage(const char *name) {
printf("\t--recover : output what was parsable on broken XML documents\n");
printf("\t--noent : substitute entity references by their value\n");
printf("\t--noout : don't output the result tree\n");
printf("\t--nonet : refuse to fetch DTDs or entities over network\n");
printf("\t--htmlout : output results as HTML\n");
printf("\t--nowrap : do not put HTML doc wrapper\n");
printf("\t--valid : validate the document in addition to std well-formed check\n");
@ -1513,6 +1514,9 @@ main(int argc, char **argv) {
schema = argv[i];
noent++;
#endif
} else if ((!strcmp(argv[i], "-nonet")) ||
(!strcmp(argv[i], "--nonet"))) {
xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
} else {
fprintf(stderr, "Unknown option %s\n", argv[i]);
usage(argv[0]);