Forum OpenACS Q&A: using OpenACS style ADP templates to generate an XML string

I am attempting to pull data from our database and convert it into XML.  These XML documents will then be used to interact with other libraries and servers.  The browser will still receive HTML when it's done.  Perhaps in a future iteration, these same XML documents will become components of an AJAX interface for the client.

I would like to use the OpenACS templating system for this and be able to store my templates as a string (not just as a file).  Within those strings, I'd like to use <multiple>, @var@, and similar features.  I have a basic prototype using ns_adp_parse, but it only recognizes the <% %> and <%= %> syntax.

Can anybody point me to the right documentation on this?  I have been looking for longer than seems reasonable and can't figure out how to do it.  Perhaps template::adp_include is what I want, but it seems to require that the files be on disk.  If that's the only way, can I assure that they'll never get called from a browser?  This is, for now, supposed to be for internal consumption only.

If this is a totally newbie question, I offer my apologies.  I'm fairly new to both TCL and OpenACS.  Thanks in advance to anybody who can help.

Kind regards,
Justis

I don't see anything that will help you right now.

The two procedures which you can use to parse a template are
template::adp_parse
and
template::adp_include

These both take a path to a file.

You might look at template::adp_include and create a complementary procedure that takes a string instead of a file path.

Dave,

Thanks for the help. I finally found the solution elsewhere on the forum. Here's the post, by Dan Wickstrom:
https://openacs.org/forums/message-view?message_id=53556

The key piece I needed was template::adp_compile, which can accept either a string or a filename: https://openacs.org/api-doc/proc-view?proc=template%3A%3Aadp_compile

Kind regards,
Justis