Environments[indent]TS 672 (unclear of service packs and patches)
TS 7.2
W2K3[/indent]
Task[indent]I want to take a DCR ("xml" type in this case) and "deconstruct" it into a series of FormAPI calls. Yeah, it sounds weird, but I'll try to explain...
We have DCTs that contain collections of fields for different language / locales and when the DCR gets saved, we want to split it into distinct DCRs for each language / locale type (each "component" DCR goes into it's own branch's templatedata/category/data/ directory with the same name, and will have the proper EAs on them) - although there are some tricky issues with this aspect, that's not the focus of this task.
When you edit one of these "component" DCRs (in any of the language / locale branches) - the idea is to merge all the content from all the associated language / locale component DCRs into the form so that you once again see the "full" DCR. (not my desired architecture, but it's what I've got handed to me).
Thus far, the process has been to slurp in the DCR data from the component DCRs and merge them at the file system level and then force (or provide a mans to force) a refresh of the Edit DCR window so that all the data shows up. This has a number of problems which I won't go into right now.
The idea I'm thinking about is to take each of the [other] language / locale DCRs and, using a callserver script, deconstruct the DCR into a series of xpaths from which I can then make FormAPI calls to populate their data into the open form - without modifying the actual DCR at the file system level.
Theoretically, this doesn't sound too bad.
Unfortunately, I'm having a bear of a time trying to figure out how to get the proper xpaths for each item I find in the DCR.[/indent]
Approaches[indent]My initial approach was to use something like TeamSite::XMLnode to parse the DCR and recurse through it via things like get_node_list(). This works up to a point.
I can get all the individual element names, I can even [right now] get someone accurate xpaths (I need to play around with stacks to get the right push / pop algorithm) - but what I cannot figure out is how to determine: