Forum OpenACS Q&A: Re: what is the best practive for extracting xml like info from variables

I really dislike the notion of pretending you're not using an RDBMS by using XML to hide structure from the datamodel.  Among other things, having much of the toolkit use the RDBMS as its designed to be used while other parts hide the datamodel as an XML string makes interoperability between pieces of the toolkit more difficult, increases the learning curve needed to grasp it, and the amount of trivia one needs to remember to hack in it ("gee, does this package stuff XML strings or model data directly?  I don't remember...")

Of course if this package isn't meant to ever be a candidate for inclusion in the toolkit distribution feel free to do whatever you want.

Having said this ... if you insist on this approach, you really should properly parse the document using ns_xml or (preferably, since we're switching) tDOM.  Generalized XML is not parsable by simple regexps, if at some point your XML description crosses that threshold you're going to have to switch to a proper parser anyway.