faqts : Computers : Programming : Languages : JavaScript : Language Core : E4X (ECMAScript for XML) : XML objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

How do I use the method addNamespace?
How do I use the method inScopeNamespaces?
How do I use the method addNamespace?
How do I use the method inScopeNamespaces?
How do I use the method removeNamespace?
How do I use the method removeNamespace?

Apr 8th, 2005 03:00
Martin Honnen,


The method inScopeNamespaces takes no arguments and returns an array of
Namespace objects representing the namespace that are in scope for this
XML object.
The method addNamespace takes one argument which can be a string with a
namespace URI or a Namespace object and adds the argument to the in
scope namespaces of this XML object. The method returns the XML object
it is called on.
The method removeNamespace takes one argument which can be a string with
a namespace URI or a Namespace object and removes the namespace from the
in scope namespaces of this XML object if the namespace is not used for
the qualified name of the object or its attributes.
Here is an example using the three methods:
  var xhtml = <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" />;
  alert(xhtml.inScopeNamespaces());
  // shows 'http://www.w3.org/1999/xhtml'
  xhtml.addNamespace(new Namespace('http://www.w3.org/1999/xlink'));
  alert(xhtml.inScopeNamespaces());
  // shows 'http://www.w3.org/1999/xhtml,http://www.w3.org/1999/xlink'
  xhtml.removeNamespace(new Namespace('http://www.w3.org/1999/xlink'));
  alert(xhtml.inScopeNamespaces());
  // shows 'http://www.w3.org/1999/xhtml'