TopLevel
Class Namespace
![](https://sfcclearning.com/infocenter/DWAPI/scriptapi/html/api/images/inherit.gif.pagespeed.ce.4vPrGmNumQ.gif)
Namespace objects represent XML namespaces and provide an
association between a namespace prefix and a Unique Resource
Identifier (URI). The prefix is either the undefined value
or a string value that may be used to reference the namespace
within the lexical representation of an XML value. When an
XML object containing a namespace with an undefined prefix is
encoded as XML by the method toXMLString(), the implementation
will automatically generate a prefix.
The URI is a string value used to uniquely identify the namespace.
Properties
prefix
:
String
(Read Only)
The prefix of the Namespace object.
uri
:
String
(Read Only)
The Uniform Resource Identifier (URI) of the Namespace object.
Constructor Summary
Namespace()
Constructs a simple namespace where the uri and prefix properties are set to an empty string.
Method Summary
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Constructor Detail
Namespace
public Namespace()
Constructs a simple namespace where the
uri and prefix properties are set to an empty string.
A namespace with URI set to the empty string represents no namespace.
No namespace is used in XML objects to explicitly specify
that a name is not inside a namespace and may never be
associated with a prefix other than the empty string.
Namespace
public Namespace(uriValue
:
Object)
Constructs a Namespace object and assigns values to the
uri and prefix properties based on the type
of uriValue. If uriValue is a
Namespace object, a copy of the Namespace is constructed.
If uriValue is a QName object, the uri property is
set to the QName object's uri property.
Otherwise, uriValue is converted into a string and
assigned to the uri property.
Parameters:
uriValue
-
the value to use when constructing the Namespace.
Namespace
Constructs a Namespace object and assigns values to the
uri and prefix properties.
The value of the prefixValue parameter is assigned to the
prefix property in the following manner:
- If undefined is passed, prefix is set to undefined.
- If the argument is a valid XML name, it is converted to a string and assigned to the prefix property.
- If the argument is not a valid XML name, the prefix property is set to undefined.
- If a QName object is passed for the uriValue parameter, the uri property is set to the value of the QName object's uri property.
- If a QName object is not passed for the uriValue parameter, the uriValue parameter is converted to a string and assigned to the uri property.
Parameters:
prefixValue
-
the prefix value to use when constructing the Namespace.
uriValue
-
the value to use when constructing the Namespace.
Method Detail
getPrefix
getPrefix()
:
String
Returns the prefix of the Namespace object.
Returns:
the prefix of the Namespace object.
getUri
getUri()
:
String
Returns the Uniform Resource Identifier (URI) of the Namespace object.
Returns:
the Uniform Resource Identifier (URI) of the Namespace object.
toString
toString()
:
String
Returns a string representation of this Namespace object.
Returns:
a string representation of this Namespace object.