Forum OpenACS Development: Re: question about tDOM and namespaces (Re: ANN: IMS-LD beta released )

To answer my own question. According to, it is possible to make XPath queries independent from the prefix in the source document by adding a namespace declaration node to the root with a prefix of your own choosing.
This could mean, that after parsing the manifest you could call
$manifest setAttributeNS "" xmlns:imscp ""

Whereever in the code where you have constructs like

set organizations [$manifest child all imscp:organizations]
if { ![llength $organizations] } {
set organizations [$manifest child all organizations]

you could more simply write

set organizations [$manifest selectNodes imscp:organizations]

What do you think?


Thanks for your help.

Just one question. That would affect all the child nodes, right?, what about the imsld specific nodes?

Yes, my idea is whenever you have to retrieve child nodes to use the selectNodes function, because thus you query for the actual namespace and not the prefix, whereas the child function seems to retrieve nodes only based on the prefix.

Sorry, that I forgot to add that the same would be necessary for all namespaces used in the manifest.