Re: [xml] Input parameters of xmlEncodeSpecialChars



On Fri, Aug 04, 2006 at 08:36:35AM +0200, Unai Astorquiza wrote:
Hi,

A simple question. The documentation says this about the function xmlEncodeSpecialChars:

*******************************************************
xmlChar *     xmlEncodeSpecialChars   (xmlDocPtr doc, 
                                       const xmlChar * input)

Do a global encoding of a string, replacing the predefined entities this routine is reentrant, and result 
must be deallocated.
doc:  the document containing the string
input:        A string to convert to XML.
Returns:      A newly allocated string with the substitution done.
*******************************************************

Looking at the code (2.6.24), the first parameter (xmlDocPtr doc) is not used and is declared as follows 
(xmlDocPtr doc ATTRIBUTE_UNUSED)

Is it safe to pass a NULL as the xmlDocPtr?

  yes

I mean, looking at the code, there´s no problem, but as the documentation does not say anything about 
passing a NULL, could this behavior change in the next versions?

  No, that should not break. We used to look up the document for being HTML
and doing specific thing for predefined HTML entities but that has been dropped
since.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]