![]() |
|
|
+ Search |
![]()
|
Apr 11th, 2005 04:00
Martin Honnen,
The method namespaceDeclarations takes no argument and returns an array with the namespace declarations associated with the XML object it is called on. Here are some examples: var p = <xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">Kibology for <xhtml:b>all</xhtml:b>.</xhtml:p>; alert(p.namespaceDeclarations().join('\r\n')); /* shows 'http://www.w3.org/1999/xhtml http://www.w3.org/1999/xlink' */ var xhtml = new Namespace('http://www.w3.org/1999/xhtml'); // child element b with no own namespace declarations: var b = p.xhtml::b[0]; // show differences between inScopeNamespaces and // namespaceDeclarations: alert('Namespaces in scope:\r\n' + b.inScopeNamespaces().join('\r\n') + '\r\nnamespace declarations:\r\n' + b.namespaceDeclarations().join('\r\n')); /* shows 'Namespaces in scope: http://www.w3.org/1999/xhtml http://www.w3.org/1999/xlink namespace declarations: ' */