QName objects represent qualified names of XML elements and attributes. Each
QName object has a local name and a namespace Uniform Resource Identifier
(URI). When the value of the namespace URI is null
, the QName object
matches any namespace. Use the QName constructor to create a new QName
object that is either a copy of another QName object or a new QName object
with a uri
from a Namespace
object and a localName
from a QName
object.
Constructor
new(?namespace:Dynamic, ?name:Dynamic)
Creates a QName object. The values assigned to the uri and localName
properties of the new QName object depend on the type of value
passed for the namespace
and name
parameters.
If two parameters are passed, creates a QName object with a URI from a Namespace object and a localName from a QName object. If either parameter is not the expected data type, the parameter is converted to a string and assigned to the corresponding property of the new QName object. For example, if both parameters are strings, a new QName object is returned with a uri property set to the first parameter and a localName property set to the second parameter. In other words, the following permutations, along with many others, are valid forms of the constructor:
- QName (uri:Namespace, localName:String);
- QName (uri:String, localName: QName);
- QName (uri:String, localName: String);
If you pass null for the uri parameter, the uri property of the new QName object is set to null.
If one parameter is passed, creates a QName object that is a copy of another QName object. If the parameter passed to the constructor is a QName object, a copy of the QName object is created. If the parameter is not a QName object, the parameter is converted to a string and assigned to the localName property of the new QName instance. If the parameter is undefined or unspecified, a new QName object is created with the localName property set to the empty string.