Re: [xml] setting doc->URL when doc loaded from memory

On Fri, Sep 19, 2003 at 08:44:25AM -0400, Rob Richards wrote:
Are there any issues or repercussions when manually setting the doc URL when
a doc is loaded from memory?

   Well this change the base for the URI-Reference computations, which
may be exactly what you're actually looking for.

When using just documents loaded from strings, I have been setting the
directory on the context to the correct directory before parsing which seems
to resolve the issue there (all externals are loading form their proper
directories). The problem I am running into now is when using that doc as a
stylesheet in libxslt when the stylesheet has no base tag and includes are
using relative paths. Setting the URL on the origional doc (needed to be
done here) to the directory I want to use as the base directory, and then
setting the URL on the copied doc to the same before pasing to
xsltParseStylesheetDoc seems to work, but doing so, will this cause any
issues elsewhere within libxml or libxslt?

  That should not be a problem, but it's better to call xmlNodeSetBase()
which will make sure it does a copy of the string to avoid memory crash
when freeing the document ! In general try to use the API for this
kind of modifications ...

Daniel Veillard      | Red Hat Network
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]