The Toolkit for Online Communities
17598 Community Members, 1 member online, 5109 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : ANN: IMS-LD beta released : One Message

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

To answer my own question. According to http://www.panoptic.com/wiki/aolserver/TDOM, 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 "http://www.imsglobal.org/xsd/imscp_v1p1"

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.