mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
small typo pointed out by Mike Hommey slightly improved the --c14n
* xmlIO.c: small typo pointed out by Mike Hommey * doc/xmllint.xml, xmllint.html, xmllint.1: slightly improved the --c14n description, c.f. #144675 . * nanohttp.c nanoftp.c: applied a first simple patch from Mike Hommey for $no_proxy, c.f. #133470 * parserInternals.c include/libxml/parserInternals.h include/libxml/xmlerror.h: cleanup to avoid 'error' identifier in includes # * parser.c SAX2.c debugXML.c include/libxml/parser.h: first version of the inplementation of parsing within the context of a node in the tree #142359, new function xmlParseInNodeContext(), added support at the xmllint --shell level as the "set" function * test/scripts/set* result/scripts/* Makefile.am: extended the script based regression tests to instrument the new function. Daniel
This commit is contained in:
23
ChangeLog
23
ChangeLog
@ -1,11 +1,30 @@
|
|||||||
|
Mon Aug 16 02:42:30 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlIO.c: small typo pointed out by Mike Hommey
|
||||||
|
* doc/xmllint.xml, xmllint.html, xmllint.1: slightly improved
|
||||||
|
the --c14n description, c.f. #144675 .
|
||||||
|
* nanohttp.c nanoftp.c: applied a first simple patch from
|
||||||
|
Mike Hommey for $no_proxy, c.f. #133470
|
||||||
|
* parserInternals.c include/libxml/parserInternals.h
|
||||||
|
include/libxml/xmlerror.h: cleanup to avoid 'error' identifier
|
||||||
|
in includes #
|
||||||
|
* parser.c SAX2.c debugXML.c include/libxml/parser.h:
|
||||||
|
first version of the inplementation of parsing within
|
||||||
|
the context of a node in the tree #142359, new function
|
||||||
|
xmlParseInNodeContext(), added support at the xmllint --shell
|
||||||
|
level as the "set" function
|
||||||
|
* test/scripts/set* result/scripts/* Makefile.am: extended
|
||||||
|
the script based regression tests to instrument the new function.
|
||||||
|
|
||||||
Sat Aug 14 18:53:08 MDT 2004 John Fleck <jfleck@inkstain.net>
|
Sat Aug 14 18:53:08 MDT 2004 John Fleck <jfleck@inkstain.net>
|
||||||
* doc/xmllint.xml, xmllint.html, xmllint.1
|
|
||||||
|
* doc/xmllint.xml, xmllint.html, xmllint.1:
|
||||||
add c14n to man page (man, it's hard to keep up with
|
add c14n to man page (man, it's hard to keep up with
|
||||||
Daniel!)
|
Daniel!)
|
||||||
|
|
||||||
Sat Aug 14 18:45:38 MDT 2004 John Fleck <jfleck@inkstain.net>
|
Sat Aug 14 18:45:38 MDT 2004 John Fleck <jfleck@inkstain.net>
|
||||||
|
|
||||||
* doc/xmllint.xml, xmllint.html, xmllint.1
|
* doc/xmllint.xml, xmllint.html, xmllint.1:
|
||||||
add pattern, walker, maxmem, output and xmlout to man page
|
add pattern, walker, maxmem, output and xmlout to man page
|
||||||
fixes #144675
|
fixes #144675
|
||||||
|
|
||||||
|
@ -505,14 +505,15 @@ Scripttests : xmllint$(EXEEXT)
|
|||||||
if [ -f $$xml ] ; then \
|
if [ -f $$xml ] ; then \
|
||||||
if [ ! -f $(srcdir)/result/scripts/$$name ] ; then \
|
if [ ! -f $(srcdir)/result/scripts/$$name ] ; then \
|
||||||
echo New test file $$name ; \
|
echo New test file $$name ; \
|
||||||
$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name ; \
|
$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name 2> $(srcdir)/result/scripts/$$name.err ; \
|
||||||
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
||||||
else \
|
else \
|
||||||
log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i 2>&1 > result.$$name ; \
|
log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > result.$$name 2> result.$$name.err ; \
|
||||||
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
||||||
diff $(srcdir)/result/scripts/$$name result.$$name` ; \
|
diff $(srcdir)/result/scripts/$$name result.$$name ; \
|
||||||
|
diff $(srcdir)/result/scripts/$$name.err result.$$name.err` ; \
|
||||||
if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
|
if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
|
||||||
rm result.$$name ; \
|
rm result.$$name result.$$name.err ; \
|
||||||
fi ; fi ; done)
|
fi ; fi ; done)
|
||||||
|
|
||||||
Catatests : xmlcatalog$(EXEEXT)
|
Catatests : xmlcatalog$(EXEEXT)
|
||||||
|
4
SAX2.c
4
SAX2.c
@ -2042,10 +2042,8 @@ xmlSAX2StartElementNs(void *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctxt->myDoc->children == NULL) {
|
if ((ctxt->myDoc->children == NULL) || (parent == NULL)) {
|
||||||
xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
|
xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
|
||||||
} else if (parent == NULL) {
|
|
||||||
parent = ctxt->myDoc->children;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Build the namespace list
|
* Build the namespace list
|
||||||
|
47
debugXML.c
47
debugXML.c
@ -1733,6 +1733,51 @@ xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlShellSetContent:
|
||||||
|
* @ctxt: the shell context
|
||||||
|
* @value: the content as a string
|
||||||
|
* @node: a node
|
||||||
|
* @node2: unused
|
||||||
|
*
|
||||||
|
* Implements the XML shell function "dir"
|
||||||
|
* dumps informations about the node (namespace, attributes, content).
|
||||||
|
*
|
||||||
|
* Returns 0
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
xmlShellSetContent(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||||
|
char *value, xmlNodePtr node,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
xmlNodePtr results;
|
||||||
|
xmlParserErrors ret;
|
||||||
|
|
||||||
|
if (!ctxt)
|
||||||
|
return (0);
|
||||||
|
if (node == NULL) {
|
||||||
|
fprintf(ctxt->output, "NULL\n");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (value == NULL) {
|
||||||
|
fprintf(ctxt->output, "NULL\n");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = xmlParseInNodeContext(node, value, strlen(value), 0, &results);
|
||||||
|
if (ret == XML_ERR_OK) {
|
||||||
|
if (node->children != NULL) {
|
||||||
|
xmlFreeNodeList(node->children);
|
||||||
|
node->children = NULL;
|
||||||
|
node->last = NULL;
|
||||||
|
}
|
||||||
|
xmlAddChildList(node, results);
|
||||||
|
} else {
|
||||||
|
fprintf(ctxt->output, "failed to parse content\n");
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
/**
|
/**
|
||||||
* xmlShellRNGValidate:
|
* xmlShellRNGValidate:
|
||||||
@ -2358,6 +2403,8 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
xmlShellDu(ctxt, NULL, ctxt->node, NULL);
|
xmlShellDu(ctxt, NULL, ctxt->node, NULL);
|
||||||
} else if (!strcmp(command, "base")) {
|
} else if (!strcmp(command, "base")) {
|
||||||
xmlShellBase(ctxt, NULL, ctxt->node, NULL);
|
xmlShellBase(ctxt, NULL, ctxt->node, NULL);
|
||||||
|
} else if (!strcmp(command, "set")) {
|
||||||
|
xmlShellSetContent(ctxt, arg, ctxt->node, NULL);
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
#ifdef LIBXML_XPATH_ENABLED
|
||||||
} else if (!strcmp(command, "setns")) {
|
} else if (!strcmp(command, "setns")) {
|
||||||
if (arg[0] == 0) {
|
if (arg[0] == 0) {
|
||||||
|
@ -216,11 +216,7 @@ Use a W3C XML Schema file named \fIschema\fR for validation\&.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-c14n\fR
|
\fB\-\-c14n\fR
|
||||||
Output canonical XML\&.
|
Use the W3C XML Canonicalisation (C14N) to serialize the result of parsing to stdout, it keeps comments in teh result\&.
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-\-nonet\fR
|
|
||||||
Do not use the Internet to fetch DTD's or entities\&.
|
|
||||||
|
|
||||||
.SH "SHELL"
|
.SH "SHELL"
|
||||||
|
|
||||||
|
@ -521,17 +521,13 @@
|
|||||||
<simpara>Use a W3C XML Schema file named <replaceable>schema</replaceable> for validation.</simpara>
|
<simpara>Use a W3C XML Schema file named <replaceable>schema</replaceable> for validation.</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
|
||||||
<term><option>--c14n</option></term>
|
|
||||||
<listitem>
|
|
||||||
<simpara>Output canonical XML.</simpara>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<option>--nonet</option></term>
|
<option>--c14n</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<simpara>Do not use the Internet to fetch DTD's or entities.</simpara>
|
<simpara>Use the W3C XML Canonicalisation (C14N) to
|
||||||
|
serialize the result of parsing to stdout, it keeps comments in
|
||||||
|
teh result.</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@ -915,6 +915,12 @@ XMLPUBFUN int XMLCALL
|
|||||||
int depth,
|
int depth,
|
||||||
const xmlChar *string,
|
const xmlChar *string,
|
||||||
xmlNodePtr *lst);
|
xmlNodePtr *lst);
|
||||||
|
XMLPUBFUN xmlParserErrors XMLCALL
|
||||||
|
xmlParseInNodeContext (xmlNodePtr node,
|
||||||
|
const char *data,
|
||||||
|
int datalen,
|
||||||
|
int options,
|
||||||
|
xmlNodePtr *lst);
|
||||||
XMLPUBFUN int XMLCALL
|
XMLPUBFUN int XMLCALL
|
||||||
xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
|
xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
|
||||||
xmlSAXHandlerPtr sax,
|
xmlSAXHandlerPtr sax,
|
||||||
|
@ -286,7 +286,7 @@ XMLPUBFUN int XMLCALL
|
|||||||
/* internal error reporting */
|
/* internal error reporting */
|
||||||
XMLPUBFUN void XMLCALL
|
XMLPUBFUN void XMLCALL
|
||||||
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
|
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
|
||||||
xmlParserErrors error,
|
xmlParserErrors xmlerr,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
const xmlChar * str1,
|
const xmlChar * str1,
|
||||||
const xmlChar * str2);
|
const xmlChar * str2);
|
||||||
|
@ -707,12 +707,12 @@ typedef void (*xmlGenericErrorFunc) (void *ctx,
|
|||||||
/**
|
/**
|
||||||
* xmlStructuredErrorFunc:
|
* xmlStructuredErrorFunc:
|
||||||
* @userData: user provided data for the error callback
|
* @userData: user provided data for the error callback
|
||||||
* @error: the error being raised.
|
* @xmlerr: the error being raised.
|
||||||
*
|
*
|
||||||
* Signature of the function to use when there is an error and
|
* Signature of the function to use when there is an error and
|
||||||
* the module handles the new error reporting mechanism.
|
* the module handles the new error reporting mechanism.
|
||||||
*/
|
*/
|
||||||
typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
|
typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr xmlerr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the following function to reset the two global variables
|
* Use the following function to reset the two global variables
|
||||||
|
@ -195,7 +195,7 @@ xmlNanoFTPInit(void) {
|
|||||||
|
|
||||||
proxyPort = 21;
|
proxyPort = 21;
|
||||||
env = getenv("no_proxy");
|
env = getenv("no_proxy");
|
||||||
if (env != NULL)
|
if (env && ((env[0] == '*' ) && (env[1] == 0)))
|
||||||
return;
|
return;
|
||||||
env = getenv("ftp_proxy");
|
env = getenv("ftp_proxy");
|
||||||
if (env != NULL) {
|
if (env != NULL) {
|
||||||
|
@ -223,7 +223,7 @@ xmlNanoHTTPInit(void) {
|
|||||||
if (proxy == NULL) {
|
if (proxy == NULL) {
|
||||||
proxyPort = 80;
|
proxyPort = 80;
|
||||||
env = getenv("no_proxy");
|
env = getenv("no_proxy");
|
||||||
if (env != NULL)
|
if (env && ((env[0] == '*') && (env[1] == 0)))
|
||||||
goto done;
|
goto done;
|
||||||
env = getenv("http_proxy");
|
env = getenv("http_proxy");
|
||||||
if (env != NULL) {
|
if (env != NULL) {
|
||||||
|
190
parser.c
190
parser.c
@ -10830,6 +10830,196 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
|
|||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlParseInNodeContext:
|
||||||
|
* @node: the context node
|
||||||
|
* @data: the input string
|
||||||
|
* @datalen: the input string length in bytes
|
||||||
|
* @options: a combination of xmlParserOption
|
||||||
|
* @lst: the return value for the set of parsed nodes
|
||||||
|
*
|
||||||
|
* Parse a well-balanced chunk of an XML document
|
||||||
|
* within the context (DTD, namespaces, etc ...) of the given node.
|
||||||
|
*
|
||||||
|
* The allowed sequence for the data is a Well Balanced Chunk defined by
|
||||||
|
* the content production in the XML grammar:
|
||||||
|
*
|
||||||
|
* [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
|
||||||
|
*
|
||||||
|
* Returns XML_ERR_OK if the chunk is well balanced, and the parser
|
||||||
|
* error code otherwise
|
||||||
|
*/
|
||||||
|
xmlParserErrors
|
||||||
|
xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen,
|
||||||
|
int options, xmlNodePtr *lst) {
|
||||||
|
#ifdef SAX2
|
||||||
|
xmlParserCtxtPtr ctxt;
|
||||||
|
xmlDocPtr doc = NULL;
|
||||||
|
xmlNodePtr fake, cur;
|
||||||
|
int nsnr = 0;
|
||||||
|
|
||||||
|
xmlParserErrors ret = XML_ERR_OK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check all input parameters, grab the document
|
||||||
|
*/
|
||||||
|
if ((lst == NULL) || (node == NULL) || (data == NULL) || (datalen < 0))
|
||||||
|
return(XML_ERR_INTERNAL_ERROR);
|
||||||
|
switch (node->type) {
|
||||||
|
case XML_ELEMENT_NODE:
|
||||||
|
case XML_ATTRIBUTE_NODE:
|
||||||
|
case XML_TEXT_NODE:
|
||||||
|
case XML_CDATA_SECTION_NODE:
|
||||||
|
case XML_ENTITY_REF_NODE:
|
||||||
|
case XML_PI_NODE:
|
||||||
|
case XML_COMMENT_NODE:
|
||||||
|
case XML_DOCUMENT_NODE:
|
||||||
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return(XML_ERR_INTERNAL_ERROR);
|
||||||
|
|
||||||
|
}
|
||||||
|
while ((node != NULL) && (node->type != XML_ELEMENT_NODE) &&
|
||||||
|
(node->type != XML_DOCUMENT_NODE) &&
|
||||||
|
(node->type != XML_HTML_DOCUMENT_NODE))
|
||||||
|
node = node->parent;
|
||||||
|
if (node == NULL)
|
||||||
|
return(XML_ERR_INTERNAL_ERROR);
|
||||||
|
if (node->type == XML_ELEMENT_NODE)
|
||||||
|
doc = node->doc;
|
||||||
|
else
|
||||||
|
doc = (xmlDocPtr) node;
|
||||||
|
if (doc == NULL)
|
||||||
|
return(XML_ERR_INTERNAL_ERROR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* allocate a context and set-up everything not related to the
|
||||||
|
* node position in the tree
|
||||||
|
*/
|
||||||
|
if (doc->type == XML_DOCUMENT_NODE)
|
||||||
|
ctxt = xmlCreateMemoryParserCtxt((char *) data, datalen);
|
||||||
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
|
else if (doc->type == XML_HTML_DOCUMENT_NODE)
|
||||||
|
ctxt = htmlCreateMemoryParserCtxt((char *) data, datalen);
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
return(XML_ERR_INTERNAL_ERROR);
|
||||||
|
|
||||||
|
if (ctxt == NULL)
|
||||||
|
return(XML_ERR_NO_MEMORY);
|
||||||
|
fake = xmlNewComment(NULL);
|
||||||
|
if (fake == NULL) {
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
return(XML_ERR_NO_MEMORY);
|
||||||
|
}
|
||||||
|
xmlAddChild(node, fake);
|
||||||
|
|
||||||
|
xmlCtxtUseOptions(ctxt, options);
|
||||||
|
if (doc->dict != NULL) {
|
||||||
|
if (ctxt->dict != NULL)
|
||||||
|
xmlDictFree(ctxt->dict);
|
||||||
|
ctxt->dict = doc->dict;
|
||||||
|
}
|
||||||
|
xmlDetectSAX2(ctxt);
|
||||||
|
ctxt->myDoc = doc;
|
||||||
|
|
||||||
|
if (node->type == XML_ELEMENT_NODE) {
|
||||||
|
nodePush(ctxt, node);
|
||||||
|
/*
|
||||||
|
* initialize the SAX2 namespaces stack
|
||||||
|
*/
|
||||||
|
cur = node;
|
||||||
|
while ((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) {
|
||||||
|
xmlNsPtr ns = cur->nsDef;
|
||||||
|
const xmlChar *iprefix, *ihref;
|
||||||
|
|
||||||
|
while (ns != NULL) {
|
||||||
|
if (ctxt->dict) {
|
||||||
|
iprefix = xmlDictLookup(ctxt->dict, ns->prefix, -1);
|
||||||
|
ihref = xmlDictLookup(ctxt->dict, ns->href, -1);
|
||||||
|
} else {
|
||||||
|
iprefix = ns->prefix;
|
||||||
|
ihref = ns->href;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xmlGetNamespace(ctxt, iprefix) == NULL) {
|
||||||
|
nsPush(ctxt, iprefix, ihref);
|
||||||
|
nsnr++;
|
||||||
|
}
|
||||||
|
ns = ns->next;
|
||||||
|
}
|
||||||
|
cur = cur->parent;
|
||||||
|
}
|
||||||
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ctxt->validate) || (ctxt->replaceEntities != 0)) {
|
||||||
|
/*
|
||||||
|
* ID/IDREF registration will be done in xmlValidateElement below
|
||||||
|
*/
|
||||||
|
ctxt->loadsubset |= XML_SKIP_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlParseContent(ctxt);
|
||||||
|
nsPop(ctxt, nsnr);
|
||||||
|
if ((RAW == '<') && (NXT(1) == '/')) {
|
||||||
|
xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL);
|
||||||
|
} else if (RAW != 0) {
|
||||||
|
xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL);
|
||||||
|
}
|
||||||
|
if ((ctxt->node != NULL) && (ctxt->node != node)) {
|
||||||
|
xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL);
|
||||||
|
ctxt->wellFormed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ctxt->wellFormed) {
|
||||||
|
if (ctxt->errNo == 0)
|
||||||
|
ret = XML_ERR_INTERNAL_ERROR;
|
||||||
|
else
|
||||||
|
ret = (xmlParserErrors)ctxt->errNo;
|
||||||
|
} else {
|
||||||
|
ret = XML_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the newly created nodeset after unlinking it from
|
||||||
|
* the pseudo sibling.
|
||||||
|
*/
|
||||||
|
|
||||||
|
cur = fake->next;
|
||||||
|
fake->next = NULL;
|
||||||
|
node->last = fake;
|
||||||
|
|
||||||
|
if (cur != NULL) {
|
||||||
|
cur->prev = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*lst = cur;
|
||||||
|
|
||||||
|
while (cur != NULL) {
|
||||||
|
cur->parent = NULL;
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlUnlinkNode(fake);
|
||||||
|
xmlFreeNode(fake);
|
||||||
|
|
||||||
|
|
||||||
|
if (ret != XML_ERR_OK) {
|
||||||
|
xmlFreeNodeList(*lst);
|
||||||
|
*lst = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctxt->dict = NULL;
|
||||||
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
|
||||||
|
return(ret);
|
||||||
|
#else /* !SAX2 */
|
||||||
|
return(XML_ERR_INTERNAL_ERROR);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LIBXML_SAX1_ENABLED
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
/**
|
/**
|
||||||
* xmlParseBalancedChunkMemoryRecover:
|
* xmlParseBalancedChunkMemoryRecover:
|
||||||
|
@ -127,7 +127,7 @@ xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
|
|||||||
/**
|
/**
|
||||||
* __xmlErrEncoding:
|
* __xmlErrEncoding:
|
||||||
* @ctxt: an XML parser context
|
* @ctxt: an XML parser context
|
||||||
* @error: the error number
|
* @xmlerr: the error number
|
||||||
* @msg: the error message
|
* @msg: the error message
|
||||||
* @str1: an string info
|
* @str1: an string info
|
||||||
* @str2: an string info
|
* @str2: an string info
|
||||||
@ -135,16 +135,16 @@ xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
|
|||||||
* Handle an encoding error
|
* Handle an encoding error
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
__xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
|
||||||
const char *msg, const xmlChar * str1, const xmlChar * str2)
|
const char *msg, const xmlChar * str1, const xmlChar * str2)
|
||||||
{
|
{
|
||||||
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
||||||
(ctxt->instate == XML_PARSER_EOF))
|
(ctxt->instate == XML_PARSER_EOF))
|
||||||
return;
|
return;
|
||||||
if (ctxt != NULL)
|
if (ctxt != NULL)
|
||||||
ctxt->errNo = error;
|
ctxt->errNo = xmlerr;
|
||||||
__xmlRaiseError(NULL, NULL, NULL,
|
__xmlRaiseError(NULL, NULL, NULL,
|
||||||
ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL,
|
ctxt, NULL, XML_FROM_PARSER, xmlerr, XML_ERR_FATAL,
|
||||||
NULL, 0, (const char *) str1, (const char *) str2,
|
NULL, 0, (const char *) str1, (const char *) str2,
|
||||||
NULL, 0, 0, msg, str1, str2);
|
NULL, 0, 0, msg, str1, str2);
|
||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
|
0
result/scripts/base.err
Normal file
0
result/scripts/base.err
Normal file
0
result/scripts/base2.err
Normal file
0
result/scripts/base2.err
Normal file
3
result/scripts/set1
Normal file
3
result/scripts/set1
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/ > / > <?xml version="1.0"?>
|
||||||
|
<b/>
|
||||||
|
/ >
|
0
result/scripts/set1.err
Normal file
0
result/scripts/set1.err
Normal file
12
result/scripts/set3
Normal file
12
result/scripts/set3
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/ > a > Object is a Node Set :
|
||||||
|
Set contains 1 nodes:
|
||||||
|
1 ELEMENT a
|
||||||
|
default namespace href=bar
|
||||||
|
a > a > Object is a Node Set :
|
||||||
|
Set contains 2 nodes:
|
||||||
|
1 ELEMENT a
|
||||||
|
default namespace href=bar
|
||||||
|
2 ELEMENT b
|
||||||
|
a > <?xml version="1.0"?>
|
||||||
|
<a xmlns="bar"><b/></a>
|
||||||
|
a >
|
3
result/scripts/set3.err
Normal file
3
result/scripts/set3.err
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
./test/scripts/set3.xml:1: parser warning : xmlns: URI bar is not absolute
|
||||||
|
<a xmlns="bar">foo</a>
|
||||||
|
^
|
6
result/scripts/set4
Normal file
6
result/scripts/set4
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/ > b > b > Object is a Node Set :
|
||||||
|
Set contains 1 nodes:
|
||||||
|
1 ELEMENT a:c
|
||||||
|
b > <?xml version="1.0"?>
|
||||||
|
<a xmlns:a="bar"><b xmlns:a="foo"><a:c/></b></a>
|
||||||
|
b >
|
0
result/scripts/set4.err
Normal file
0
result/scripts/set4.err
Normal file
2
test/scripts/set1.script
Normal file
2
test/scripts/set1.script
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
set <b/>
|
||||||
|
save -
|
1
test/scripts/set1.xml
Normal file
1
test/scripts/set1.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<a>foo</a>
|
5
test/scripts/set3.script
Normal file
5
test/scripts/set3.script
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cd *
|
||||||
|
xpath //*[namespace-uri()="bar"]
|
||||||
|
set <b/>
|
||||||
|
xpath //*[namespace-uri()="bar"]
|
||||||
|
save -
|
1
test/scripts/set3.xml
Normal file
1
test/scripts/set3.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<a xmlns="bar">foo</a>
|
4
test/scripts/set4.script
Normal file
4
test/scripts/set4.script
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
cd a/b
|
||||||
|
set <a:c/>
|
||||||
|
xpath //*[namespace-uri()="foo"]
|
||||||
|
save -
|
1
test/scripts/set4.xml
Normal file
1
test/scripts/set4.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<a xmlns:a="bar"><b xmlns:a="foo"/></a>
|
1
valid.c
1
valid.c
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <libxml/xmlmemory.h>
|
#include <libxml/xmlmemory.h>
|
||||||
#include <libxml/hash.h>
|
#include <libxml/hash.h>
|
||||||
|
#include <libxml/uri.h>
|
||||||
#include <libxml/valid.h>
|
#include <libxml/valid.h>
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
#include <libxml/parserInternals.h>
|
#include <libxml/parserInternals.h>
|
||||||
|
2
xmlIO.c
2
xmlIO.c
@ -182,7 +182,7 @@ static const char *IOerr[] = {
|
|||||||
"loading error",
|
"loading error",
|
||||||
"not a socket", /* ENOTSOCK */
|
"not a socket", /* ENOTSOCK */
|
||||||
"already connected", /* EISCONN */
|
"already connected", /* EISCONN */
|
||||||
"connection refuxed", /* ECONNREFUSED */
|
"connection refused", /* ECONNREFUSED */
|
||||||
"unreachable network", /* ENETUNREACH */
|
"unreachable network", /* ENETUNREACH */
|
||||||
"adddress in use", /* EADDRINUSE */
|
"adddress in use", /* EADDRINUSE */
|
||||||
"already in use", /* EALREADY */
|
"already in use", /* EALREADY */
|
||||||
|
Reference in New Issue
Block a user