[xml-bindings]Difficulties with Python bindings



Hi,

I'm having a couple problems with the Python bindings, and wondered if 
anyone could help.

Firstly, I'm trying to write something which works a little like a 
webserver; all content starts as XML files which have xml-stylesheet PIs 
to locate the stylesheets (with relative paths).

Some of the documents are served as static files, loaded via 
libxml2.parseFile. When I load the stylesheet, with 
libxslt.loadStylesheetPI, the relative path gets resolved relative to 
wherever the original document was loaded from, which is what I wanted.

Some of the documents, however, are generated (with libxml2.newDoc, etc) 
and these have no filename, so the stylesheet's location gets resolved 
relative to the current directory, which breaks stuff. Is there any way I 
can 'set the filename' of a generated document? I can get around it by 
changing directory, but that strikes me as a bit of a hack.

Another problem is that I can't find an equivalent of xmlDocDumpMemory(), 
so the only way to serialise a document is to save it to a file. I'm 
currently hacking around it by redirecting stdout to a temporary file, 
saving the document to it and then reading it back in, which is icky.

Thanks in advance,
Gary

[ gary inauspicious org ][ GnuPG 85A8F78B ][ http://inauspicious.org/ ]




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