Re: libfo interface and PHP ext

Tony Graham <[email protected]> Sun, 26 Feb 2006 20:55:48 +0000
Newsgroups gmane.text.xml.xmlroff.general
Message-ID <[email protected]>
"Mauro C." <[email protected]> writes:
> I'm continuing dev xmlroff php extension and study
> libfo.

Great.

> my problem is that actualy the only way to work with
> libfo is to write tmp file.
>
> I'agree the libfo abstract from xml implementation.
>
> I've found two solution:
>
> 1) include libxml in xmlroff php ext and then set
> FoXmlDoc->xml_doc directly.
> (I've seen fo-xml-doc-private.h).
>
> 2) change libfo interface and allow for examples
> fo_xml_doc_parse_file and fo_xml_doc_parse_memory, and
> generally the possibility to work with mem and/or
> file.

Isn't there a third solution:

3) Write an adapter such as fo_xml_doc_new_from_DOMXML(DOMXML), since you said
   last week that DOMXML was the PHP wrapper on xmlDocPtr.

   I don't know what the function name would look like as an PHP function
   name, but you probably get the idea.

   That way, you could do any amount of work in your PHP program to arrive at
   an XSL document that you want to format, and then just pass it to xmlroff.

   The downside is that such a function would work for PHP, but not for any
   other scripting language, since each host scripting language would require
   its own unique adapter function.

   The idea of a unique adapter function is counter to the promise of a SWIG
   interface where a bit of SWIG magic would allow multiple scripting
   languages to instantly support xmlroff.

I don't want to decide without further discussion.  Does anyone else have any
input?

> I have the same problem with the output result:
> where can I get a pointer to result doc
> (FoDocGP->job)?

Yes, I guess so.

> is the output file written when fo_doc_gp_finalize is
> invoked?

Yes, which really happens when you run:

   'g_object_unref (fo_doc);'

I am open for suggestions on how to change that.

I don't want to expose the GnomePrintJob underneath FoDoc any more than I
wanted to expose the xmlDocPtr under FoXmlDoc, but it's obvious that the
current setup is not useful for your purposes.

> actually ext has OO interface, but no error bubbling.
> tested only with PHP 4.4.2.
> configuration file incomplete.
>
> where can I release it? not possible to release it at
> pecl.php.net due to licence incompatibility.

You could contribute it to xmlroff.

Regards,


Tony.



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642