diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2003-07-22 20:52:14 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2003-07-22 20:52:14 +0000 |
commit | 8edf1c5c6c2d16fb43d3ab1d0ba9fd8c9413e725 (patch) | |
tree | e1100e809c8fbb8b58ddb2886971e35156b1010d | |
parent | cbbd78da9bd46f411ac46ead0e3cc1bd977aa626 (diff) | |
download | libxml2-8edf1c5c6c2d16fb43d3ab1d0ba9fd8c9413e725.tar.gz |
added a new API xmlXIncludeProcessTree() to process XInclude only on a
* xinclude.c include/libxml/xinclude.h: added a new API
xmlXIncludeProcessTree() to process XInclude only on a subtree
this should fix bug #115385
Daniel
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | doc/downloads.html | 4 | ||||
-rw-r--r-- | include/libxml/xinclude.h | 1 | ||||
-rw-r--r-- | xinclude.c | 44 |
5 files changed, 47 insertions, 9 deletions
@@ -1,3 +1,9 @@ +Mon Jul 21 21:53:43 IST 2003 Daniel Veillard <daniel@veillard.com> + + * xinclude.c include/libxml/xinclude.h: added a new API + xmlXIncludeProcessTree() to process XInclude only on a subtree + this should fix bug #115385 + Fri Jul 18 17:11:42 CEST 2003 Daniel Veillard <daniel@veillard.com> * relaxng.c include/libxml/relaxng.h: adding Get interface for @@ -17,6 +17,7 @@ DOCS: TODO: ===== +- XInclude at the SAX level (libSRVG) - fix the C code prototype to bring back doc/libxml-undocumented.txt to a reasonable level - Computation of base when HTTP redirect occurs, might affect HTTP diff --git a/doc/downloads.html b/doc/downloads.html index 0ce55531..701d3b6d 100644 --- a/doc/downloads.html +++ b/doc/downloads.html @@ -9,9 +9,7 @@ H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } </style><title>Downloads</title></head><body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>Downloads</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="intro.html">Introduction</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="docs.html">Developer Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="news.html">News</a></li><li><a href="XMLinfo.html">XML</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="xmldtd.html">Validation & DTDs</a></li><li><a href="encoding.html">Encodings support</a></li><li><a href="catalog.html">Catalog support</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="guidelines.html">XML Guidelines</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The latest versions of libxml2 can be found on <a href="ftp://xmlsoft.org/">xmlsoft.org</a> (<a href="ftp://speakeasy.rpmfind.net/pub/libxml/">Seattle</a>, <a href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a> either as a <a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.5/">source -archive</a><!-- commenting this out because they seem to have disappeared or <a -href="ftp://ftp.gnome.org/pub/GNOME/stable/redhat/i386/libxml/">RPM -packages</a> --> +archive</a> , Antonin Sprinzl also provide <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a mirror in Austria</a>. (NOTE that you need both the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml(2)</a> and <a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml(2)-devel</a> packages installed to compile applications using libxml.)</p><p>Binary ports:</p><ul><li>Red Hat RPMs for i386 are available directly on <a href="ftp://xmlsoft.org/">xmlsoft.org</a>, the source RPM will compile on diff --git a/include/libxml/xinclude.h b/include/libxml/xinclude.h index 9c83ba0e..25be1fee 100644 --- a/include/libxml/xinclude.h +++ b/include/libxml/xinclude.h @@ -19,6 +19,7 @@ extern "C" { #endif int xmlXIncludeProcess (xmlDocPtr doc); +int xmlXIncludeProcessTree (xmlNodePtr tree); #ifdef __cplusplus } @@ -96,7 +96,7 @@ struct _xmlXIncludeCtxt { }; static int -xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc); +xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree); /** * xmlXIncludeFreeRef: @@ -533,7 +533,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, newctxt->incTab[i]->count++; /* prevent the recursion from freeing it */ } - xmlXIncludeDoProcess(newctxt, doc); + xmlXIncludeDoProcess(newctxt, doc, xmlDocGetRootElement(doc)); for (i = 0;i < ctxt->incNr;i++) { newctxt->incTab[i]->count--; newctxt->incTab[i] = NULL; @@ -2049,6 +2049,7 @@ xmlXIncludeTestNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) { * xmlXIncludeDoProcess: * @ctxt: the XInclude processing context * @doc: an XML document + * @tree: the top of the tree to process * * Implement the XInclude substitution on the XML document @doc * @@ -2056,12 +2057,12 @@ xmlXIncludeTestNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) { * or the number of substitutions done. */ static int -xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc) { +xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) { xmlNodePtr cur; int ret = 0; int i; - if (doc == NULL) + if ((doc == NULL) || (tree == NULL)) return(-1); if (ctxt == NULL) return(-1); @@ -2075,7 +2076,7 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc) { /* * First phase: lookup the elements in the document */ - cur = xmlDocGetRootElement(doc); + cur = tree; if (xmlXIncludeTestNode(ctxt, cur) == 1) xmlXIncludePreProcessNode(ctxt, cur); while (cur != NULL) { @@ -2139,14 +2140,45 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc) { int xmlXIncludeProcess(xmlDocPtr doc) { xmlXIncludeCtxtPtr ctxt; + xmlNodePtr tree; int ret = 0; if (doc == NULL) return(-1); + tree = xmlDocGetRootElement(doc); + if (tree == NULL) + return(-1); ctxt = xmlXIncludeNewContext(doc); if (ctxt == NULL) return(-1); - ret = xmlXIncludeDoProcess(ctxt, doc); + ret = xmlXIncludeDoProcess(ctxt, doc, tree); + if ((ret >= 0) && (ctxt->nbErrors > 0)) + ret = -1; + + xmlXIncludeFreeContext(ctxt); + return(ret); +} + +/** + * xmlXIncludeProcessTree: + * @tree: a node in an XML document + * + * Implement the XInclude substitution for the given subtree + * + * Returns 0 if no substitution were done, -1 if some processing failed + * or the number of substitutions done. + */ +int +xmlXIncludeProcessTree(xmlNodePtr tree) { + xmlXIncludeCtxtPtr ctxt; + int ret = 0; + + if ((tree == NULL) || (tree->doc == NULL)) + return(-1); + ctxt = xmlXIncludeNewContext(tree->doc); + if (ctxt == NULL) + return(-1); + ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree); if ((ret >= 0) && (ctxt->nbErrors > 0)) ret = -1; |