List Info

Thread: xsltParseStylesheetDoc documentation/resource ownership




xsltParseStylesheetDoc documentation/resource ownership
user name
2006-09-28 20:22:49

Looking at the documentation at http://xmlsoft.org/XSLT/html/libxslt-xsltInternals.html#xsltParseStylesheetDoc I don’t see anything written about the ownership policy for the xmlDocPtr passed in.  My experimentation suggested that the xsltStylesheet takes ownership of the xmlDoc, and reading the code in xslt.c I see that xsltFreeStylesheet does call xmlFreeDoc(style->doc); which appears to confirm the experimental view.

 

Could/should this be documented in the documentation of xsltStylesheet and/or the documentation of the functions that take ownership of an xmlDoc when a stylesheet is created?  If yes, am I about to be asked for a patch?

 

I think there are probably other places where the documentation could make ownership policies clearer, but maybe I’m missing out on some blanket statement(s) that would cover many common cases?

 

-- James

 

xsltParseStylesheetDoc documentation/resource ownership
user name
2006-09-28 21:58:27
On Thu, Sep 28, 2006 at 01:22:49PM -0700, James Dennett
wrote:
> Looking at the documentation at
> http://xmlsoft.org/XSLT/html/libxslt-xsl
tInternals.html#xsltParseStylesh
> eetDoc I don't see anything written about the ownership
policy for the
> xmlDocPtr passed in.  My experimentation suggested that
the
> xsltStylesheet takes ownership of the xmlDoc, and
reading the code in
> xslt.c I see that xsltFreeStylesheet does call
xmlFreeDoc(style->doc);
> which appears to confirm the experimental view.
> 

 yes true. Also the document is modified.

> 
> Could/should this be documented in the documentation of
xsltStylesheet
> and/or the documentation of the functions that take
ownership of an
> xmlDoc when a stylesheet is created?  If yes, am I
about to be asked for
> a patch? 

  I can't resist an offer for a patch, it's well-known 

> I think there are probably other places where the
documentation could
> make ownership policies clearer, but maybe I'm missing
out on some
> blanket statement(s) that would cover many common
cases?

  Well that case is special, that's sure, it's a bit against
the general
rule, and was mostly to avoid copying the document first.
Hopefully
most people give a file path or URL to the stylesheet
instead.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )