Thanks Tom,
That's exactly what I needed, and you've done an exceptional job of
developing this as well as providing extremely thorough documentation.
Fortunately we run IIS only on our intranet and MSXMLDOM is not a problem. I
did notice some quirks with the VTMs in my 4.5.2 studio, was this intended
for 5.0? I was getting alerts for all the tags when the autocomplete was
triggered. I can send the exact message if you like.

Again, thanks for the quick reply and outstanding app.

Brandon



-----Original Message-----



Have you looked at the Torchbox CFXML Toolkit?

This is designed to let CF developers make an easy transition from database
queries to XML queries. Here's an example:

<!--- create the xml datasource (like a database DSN) ---> <CF_XMLDatasource
Name="user_settings"> <user_settings>
    <user layout="this" content="that" id = "1">Tom Dyson</user>
    <user layout="that" content="this" id = "2">Percy Thrower</user>
</user_settings> </CF_XMLDatasource>

<!--- query the datasource using XPath or SQL --->
<CF_XMLQuery Datasource="user_settings" Name="user_query">
    //user[@id=1]
</CF_XMLQuery>

<!--- output your query in the usual way --->
<CFOUTPUT Query="user_query">
    user: #user# layout: #user_layout# content: #user_content# </CFOUTPUT>

As for storing this in state, you could use the optional CACHEDWITHIN
attribute of either the CF_XMLDatasource tag or the CF_XMLQuery tag,
probably depending on whether you are using a single XML document to store
all the users settings (you'd cache the datasource) or a separate document
for each user (you'd cache the query). This attribute works in exactly the
same way as it does with CFQUERY.

Alternatively, if you're expecting high traffic, you could run this query
once when your users log in, and set client variables with the returned
results:

<cfset client.layout = user_query.user_layout>

In my experience, this kind of usage can offer better-than-database
performance, although every application has different requirements and I'd
strongly recommend testing under load before your portal goes into
production!

Incidentally, the current version of the Toolkit is based on Microsoft's
MSXML parser, so I'm afraid it's Windows only. We hope to release a platform
independent version soon, based on Xerces and Xalan (are people interested
in this?). You can download the current version from:

http://torchbox.com/xml/toolkit.cfm

Best wishes

Tom

-----------------+
tom dyson
t: +44 (0)1608 811870
m: +44 (0)7958 752657
[EMAIL PROTECTED]
http://torchbox.com

> Can anyone point me to a starting point for learning how to query XML 
> documents and store them in state (session, preferably)?
> 
> We're building a small portal, and the layout/content is all 
> user-defined. I had hoped to keep XML documents to store these 
> settings rather than use a database.
> 
> I guess I should also ask if this is an efficient use of the 
> technology and/or will I see a performance gain versus a hit to the db 
> everytime the page is opened.
> 
> Thanks,
> Brandon


-----------------------+
cf-xml mailing list
[EMAIL PROTECTED]
http://torchbox.com/xml

-----------------------+
cf-xml mailing list
[EMAIL PROTECTED]
http://torchbox.com/xml

Reply via email to