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

Are there any issues or repercussions when manually setting the doc URL when
a doc is loaded from memory?

I am running into the following scenario:

A doc is loaded from a string. The doc is then copied and passed to
If there are any includes which use relative paths, the relative paths are
not resolved correctly as getcwd which is called from libxml to get the base
directory is not the same as where the files are getting loaded from. For
this reason, I need to go and set the correct paths.

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?

I understand that loading a doc from memory really isnt the correct way to
do things to resolve the paths correctly, but is something I need to work



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