Cameron Laird wrote:
> Here's a node:
> <ns:some_element name = "myname" ...>
> When I
> dom::node cget $node -nodeName
> I receive some_element. To determine ns, I have to
> array set node [set $node]
> puts "The namespace is $node(node_prefix)."
> True? Is there a better way? Should this be obvious from
> the documentation?
DOM Level 2 provides the 'namespaceURI' and 'prefix'
attributes on the Node interface for this purpose.
In terms of TclDOM v2.2, you can use:
dom::node cget $node -prefix
to get the NS prefix (usually not of great interest) or
dom::node cget $node -namespaceURI
to the namespace URI (usually want you need to know).
Looks like the TclDOM man page is not up-to-date wrt
Level 2 features (sigh...). Please submit a documentation
bug on SF.
HTHs,
Steve Ball
--
Steve Ball | XSLT Standard Library | Training & Seminars
Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas
http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development
Ste...@zv... +---------------------------+---------------------
Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099
|