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

When you parse the imsmanifest file, you assume that the namespace is mapped to the prefix imscp. But a imsmanifest file could map the namespace to any other prefix and still be valid according to the specification. Isn't is possible to tell the tdom parser to look for the namespace according to the URI and not the prefix. This would make the code also more readable, because you would not have to look for unprefixed and prefixed nodes?
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.