Re: [xml] Input parameters of xmlEncodeSpecialChars

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

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 

Is it safe to pass a NULL as the xmlDocPtr?


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


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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