mirror of
https://github.com/darlinghq/darling-libxml2.git
synced 2024-12-02 09:16:23 +00:00
added entities testing to the Thread test make the test reasonable fix the
* test/threads/*: added entities testing to the Thread test * testThreads.c: make the test reasonable * DOCBparser.c: fix the DTD public and system ID * xmllint.c: added --sgml for SGML DocBook importing * Makefile.am: added Docbtests target Daniel
This commit is contained in:
parent
0a702dcab3
commit
89cad536e3
@ -1,3 +1,11 @@
|
||||
Mon Oct 22 11:32:36 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* test/threads/*: added entities testing to the Thread test
|
||||
* testThreads.c: make the test reasonable
|
||||
* DOCBparser.c: fix the DTD public and system ID
|
||||
* xmllint.c: added --sgml for SGML DocBook importing
|
||||
* Makefile.am: added Docbtests target
|
||||
|
||||
Fri Oct 19 11:47:13 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* nanoftp.c: use only "anonymous@" string for anonymous passwds
|
||||
|
26
DOCBparser.c
26
DOCBparser.c
@ -47,6 +47,15 @@
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/globals.h>
|
||||
|
||||
/*
|
||||
* DocBook XML current versions
|
||||
*/
|
||||
|
||||
#define XML_DOCBOOK_XML_PUBLIC (const xmlChar *) \
|
||||
"-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
#define XML_DOCBOOK_XML_SYSTEM (const xmlChar *) \
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
|
||||
|
||||
/*
|
||||
* Internal description of an SGML entity
|
||||
*/
|
||||
@ -3554,17 +3563,20 @@ docbParseDocTypeDecl(docbParserCtxtPtr ctxt) {
|
||||
|
||||
/*
|
||||
* Create or update the document accordingly to the DOCTYPE
|
||||
* But use the predefined PUBLIC and SYSTEM ID of DocBook XML
|
||||
*/
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI);
|
||||
ctxt->sax->internalSubset(ctxt->userData, name,
|
||||
XML_DOCBOOK_XML_PUBLIC,
|
||||
XML_DOCBOOK_XML_SYSTEM);
|
||||
|
||||
/*
|
||||
* Is there any internal subset declarations ?
|
||||
* they are handled separately in docbParseInternalSubset()
|
||||
*/
|
||||
if (RAW != '[') {
|
||||
return;
|
||||
if (RAW != '>') {
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"docbParseDocTypeDecl : internal subset not handled\n");
|
||||
} else {
|
||||
NEXT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
23
Makefile.am
23
Makefile.am
@ -1,8 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# Dependancies are fucked in make distcheck could not find why :-(
|
||||
AUTOMAKE_OPTIONS=no-dependencies
|
||||
|
||||
SUBDIRS = include . doc example
|
||||
|
||||
INCLUDES = -I@srcdir@/include -I$(top_builddir)/include @THREAD_CFLAGS@ @Z_CFLAGS@
|
||||
@ -226,6 +223,26 @@ XMLtests : xmllint
|
||||
rm result.$$name result2.$$name ; \
|
||||
fi ; fi ; done)
|
||||
|
||||
Docbtests : xmllint
|
||||
@(echo > .memdump)
|
||||
@echo "##"
|
||||
@echo "## SGML DocBook regression tests"
|
||||
@echo "##"
|
||||
@(for i in $(srcdir)/test/DocBook/*.sgm ; do \
|
||||
name=`basename $$i .sgm`; \
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/DocBook/$$name.xml ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(top_builddir)/xmllint --sgml $$i > $(srcdir)/result/DocBook/$$name.xml ; \
|
||||
$(top_builddir)/xmllint --valid --noout $(srcdir)/result/DocBook/$$name.xml ; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(top_builddir)/xmllint --sgml $$i > result.$$name ; \
|
||||
diff $(srcdir)/result/DocBook/$$name.xml result.$$name ; \
|
||||
$(top_builddir)/xmllint --valid --noout result.$$name ; \
|
||||
rm result.$$name ; \
|
||||
fi ; fi ; done)
|
||||
|
||||
XMLenttests : xmllint
|
||||
@(echo > .memdump)
|
||||
@echo "##"
|
||||
|
@ -1 +1 @@
|
||||
<!ELEMENT a EMPTY>
|
||||
<!ELEMENT a (#PCDATA)>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE abc SYSTEM "http://example.org/abc.dtd">
|
||||
<abc>
|
||||
<a/>
|
||||
<b/>
|
||||
<a>Let's use predefined entites & < ></a>
|
||||
<b>Let's use a DTD defined entity &bent;</b>
|
||||
<c/>
|
||||
</abc>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE acb SYSTEM "http://example.org/acb.dtd">
|
||||
<acb>
|
||||
<a/>
|
||||
<a>Let's use predefined entites & < ></a>
|
||||
<c/>
|
||||
<b/>
|
||||
<b>Let's use a DTD defined entity &bent;</b>
|
||||
</acb>
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
<!ELEMENT b EMPTY>
|
||||
<!ELEMENT b (#PCDATA)>
|
||||
<!ENTITY bent "the b entity">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE bac SYSTEM "http://example.org/bac.dtd">
|
||||
<bac>
|
||||
<b/>
|
||||
<a/>
|
||||
<b>Let's use a DTD defined entity &bent;</b>
|
||||
<a>Let's use predefined entites & < ></a>
|
||||
<c/>
|
||||
</bac>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE bca SYSTEM "http://example.org/bca.dtd">
|
||||
<bca>
|
||||
<b/>
|
||||
<b>Let's use a DTD defined entity &bent;</b>
|
||||
<c/>
|
||||
<a/>
|
||||
<a>Let's use predefined entites & < ></a>
|
||||
</bca>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE cab SYSTEM "http://example.org/cab.dtd">
|
||||
<cab>
|
||||
<c/>
|
||||
<a/>
|
||||
<b/>
|
||||
<a>Let's use predefined entites & < ></a>
|
||||
<b>Let's use a DTD defined entity &bent;</b>
|
||||
</cab>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE cba SYSTEM "http://example.org/cba.dtd">
|
||||
<cba>
|
||||
<c/>
|
||||
<b/>
|
||||
<a/>
|
||||
<b>Let's use a DTD defined entity &bent;</b>
|
||||
<a>Let's use predefined entites & < ></a>
|
||||
</cba>
|
||||
|
||||
|
@ -90,7 +90,7 @@ main()
|
||||
int ret;
|
||||
|
||||
xmlInitParser();
|
||||
for (repeat = 0;repeat < 10000;repeat++) {
|
||||
for (repeat = 0;repeat < 500;repeat++) {
|
||||
xmlLoadCatalog(catalog);
|
||||
|
||||
for (i = 0; i < num_threads; i++) {
|
||||
|
47
xmllint.c
47
xmllint.c
@ -68,6 +68,9 @@
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
#include <libxml/catalog.h>
|
||||
#endif
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
#include <libxml/DOCBparser.h>
|
||||
#endif
|
||||
#include <libxml/globals.h>
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
@ -86,6 +89,9 @@ static char * dtdvalid = NULL;
|
||||
static int repeat = 0;
|
||||
static int insert = 0;
|
||||
static int compress = 0;
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
static int sgml = 0;
|
||||
#endif
|
||||
static int html = 0;
|
||||
static int htmlout = 0;
|
||||
static int push = 0;
|
||||
@ -412,6 +418,38 @@ static void parseAndPrintFile(char *filename) {
|
||||
xmlDocSetRootElement(doc, n);
|
||||
}
|
||||
}
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
/*
|
||||
* build an SGML tree from a string;
|
||||
*/
|
||||
else if ((sgml) && (push)) {
|
||||
FILE *f;
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (f != NULL) {
|
||||
int res, size = 3;
|
||||
char chars[4096];
|
||||
docbParserCtxtPtr ctxt;
|
||||
|
||||
/* if (repeat) */
|
||||
size = 4096;
|
||||
res = fread(chars, 1, 4, f);
|
||||
if (res > 0) {
|
||||
ctxt = docbCreatePushParserCtxt(NULL, NULL,
|
||||
chars, res, filename, 0);
|
||||
while ((res = fread(chars, 1, size, f)) > 0) {
|
||||
docbParseChunk(ctxt, chars, res, 0);
|
||||
}
|
||||
docbParseChunk(ctxt, chars, 0, 1);
|
||||
doc = ctxt->myDoc;
|
||||
docbFreeParserCtxt(ctxt);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
} else if (sgml) {
|
||||
doc = docbParseFile(filename, NULL);
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
else if (html) {
|
||||
doc = htmlParseFile(filename, NULL);
|
||||
@ -789,6 +827,9 @@ static void usage(const char *name) {
|
||||
printf("\t--repeat : repeat 100 times, for timing or profiling\n");
|
||||
printf("\t--insert : ad-hoc test for valid insertions\n");
|
||||
printf("\t--compress : turn on gzip compression of output\n");
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
printf("\t--sgml : use the DocBook SGML parser\n");
|
||||
#endif
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
printf("\t--html : use the HTML parser\n");
|
||||
#endif
|
||||
@ -856,6 +897,12 @@ main(int argc, char **argv) {
|
||||
else if ((!strcmp(argv[i], "-htmlout")) ||
|
||||
(!strcmp(argv[i], "--htmlout")))
|
||||
htmlout++;
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
else if ((!strcmp(argv[i], "-sgml")) ||
|
||||
(!strcmp(argv[i], "--sgml"))) {
|
||||
sgml++;
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
else if ((!strcmp(argv[i], "-html")) ||
|
||||
(!strcmp(argv[i], "--html"))) {
|
||||
|
Loading…
Reference in New Issue
Block a user