Saxon.Api

Class DocumentBuilder

Class DomDestination

Class DynamicError

Class NullDestination

Class Processor

Class QName

Class SchemaManager

Class SchemaValidator

Class SequenceEnumerator

Class Serializer

Class StaticError

Class TextWriterDestination

Class XPathCompiler

Class XPathExecutable

Class XPathSelector

Class XQueryCompiler

Class XQueryEvaluator

Class XQueryExecutable

Class XdmAtomicValue

Class XdmDestination

Class XdmEmptySequence

Class XdmItem

Class XdmNode

Class XdmValue

Class XmlDestination

Class XsltCompiler

Class XsltExecutable

Class XsltTransformer

Enum RecoveryPolicy

Enum SchemaValidationMode

Enum TreeModel

Enum WhitespacePolicy

Enum XdmAxis

Interface IMessageListener

Interface IQueryResolver

Interface IResultDocumentHandler

Interface IXmlLocation

Interface SchemaResolver

 

Saxon.Api
Class QName


public class QName
implements object

The QName class represents an instance of xs:QName, as defined in the XPath 2.0 data model. Internally, it has three components, a namespace URI, a local name, and a prefix. The prefix is intended to be used only when converting the value back to a string.

Note that a QName is not itself an XdmItem in this model; however it can be wrapped in an XdmItem.


Constructor Summary
QName(string uri, string lexical)

Construct a QName using a namespace URI and a lexical representation. The lexical representation may be a local name on its own, or it may be in the form prefix:local-name

QName(string prefix, string uri, string local)

Construct a QName using a namespace prefix, a namespace URI, and a local name (in that order).

QName(string lexicalQName, XdmNode element)

Construct a QName from a lexical QName, supplying an element node whose in-scope namespaces are to be used to resolve any prefix contained in the QName.

QName(System.Xml.XmlQualifiedName qualifiedName)

Construct a QName from an XmlQualifiedName (as defined in the System.Xml package).

 
Property Summary
static QName XS_STRING
static QName XS_INTEGER
static QName XS_DOUBLE
static QName XS_FLOAT
static QName XS_DECIMAL
static QName XS_BOOLEAN
static QName XS_ANYURI
static QName XS_QNAME
static QName XS_UNTYPED_ATOMIC
static QName XDT_UNTYPED_ATOMIC
 String Prefix

The prefix of the QName. This plays no role in operations such as comparison of QNames for equality, but is retained (as specified in XPath) so that a string representation can be reconstructed.

 String Uri

The namespace URI of the QName. Returns "" (the zero-length string) if the QName is not in a namespace.

 String LocalName

The local part of the QName

 String ClarkName

The expanded name, as a string using the notation devised by James Clark. If the name is in a namespace, the resulting string takes the form {uri}local. Otherwise, the value is the local part of the name.

 
Method Summary
static QName FromClarkName(string expandedName)

Factory method to construct a QName from a string containing the expanded QName in Clark notation, that is, {uri}local

 void Register(Processor processor)

Register a QName with the Processor. This makes comparison faster when the QName is compared with others that are also registered with the Processor.

 bool IsValid(Processor processor)

Validate the QName against the XML 1.0 or XML 1.1 rules for valid names.

 String ToString()

Convert the value to a string. The resulting string is the lexical form of the QName, using the original prefix if there was one.

 int GetHashCode()

Get a hash code for the QName, to support equality matching. This supports the semantics of equality, which considers only the namespace URI and local name, and not the prefix.

 bool Equals(object )

Test whether two QNames are equal. This supports the semantics of equality, which considers only the namespace URI and local name, and not the prefix.

 XmlQualifiedName ToXmlQualifiedName()

Convert the value to an XmlQualifiedName (as defined in the System.Xml package)

 
Constructor Detail

QName

public QName(string uri,
             string lexical)

Construct a QName using a namespace URI and a lexical representation. The lexical representation may be a local name on its own, or it may be in the form prefix:local-name

This constructor does not check that the components of the QName are lexically valid.

Parameters:
uri -
The namespace URI. Use either the string "" or null for names that are not in any namespace.
lexical -
Either the local part of the name, or the prefix and local part in the format prefix:local

QName

public QName(string prefix,
             string uri,
             string local)

Construct a QName using a namespace prefix, a namespace URI, and a local name (in that order).

This constructor does not check that the components of the QName are lexically valid.

Parameters:
prefix -
The prefix of the name. Use either the string "" or null for names that have no prefix (that is, they are in the default namespace)
uri -
The namespace URI. Use either the string "" or null for names that are not in any namespace.
local -
The local part of the name

QName

public QName(string lexicalQName,
             XdmNode element)

Construct a QName from a lexical QName, supplying an element node whose in-scope namespaces are to be used to resolve any prefix contained in the QName.

This constructor checks that the components of the QName are lexically valid.

If the lexical QName has no prefix, the name is considered to be in the default namespace, as defined by xmlns="...".

If the prefix of the lexical QName is not in scope, returns null.

Parameters:
lexicalQName -
The lexical QName, in the form prefix:local or simply local.
element -
The element node whose in-scope namespaces are to be used to resolve the prefix part of the lexical QName.

QName

public QName(System.Xml.XmlQualifiedName qualifiedName)

Construct a QName from an XmlQualifiedName (as defined in the System.Xml package).

Note that an XmlQualifiedName does not contain any prefix, so the result will always have a prefix of ""

Parameters:
qualifiedName -
The XmlQualifiedName

Property Detail

XS_STRING

public static readonly QName XS_STRING {}

XS_INTEGER

public static readonly QName XS_INTEGER {}

XS_DOUBLE

public static readonly QName XS_DOUBLE {}

XS_FLOAT

public static readonly QName XS_FLOAT {}

XS_DECIMAL

public static readonly QName XS_DECIMAL {}

XS_BOOLEAN

public static readonly QName XS_BOOLEAN {}

XS_ANYURI

public static readonly QName XS_ANYURI {}

XS_QNAME

public static readonly QName XS_QNAME {}

XS_UNTYPED_ATOMIC

public static readonly QName XS_UNTYPED_ATOMIC {}

XDT_UNTYPED_ATOMIC

public static readonly QName XDT_UNTYPED_ATOMIC {}

Prefix

public String Prefix {get; }

The prefix of the QName. This plays no role in operations such as comparison of QNames for equality, but is retained (as specified in XPath) so that a string representation can be reconstructed.

Returns the zero-length string in the case of a QName that has no prefix.


Uri

public String Uri {get; }

The namespace URI of the QName. Returns "" (the zero-length string) if the QName is not in a namespace.


LocalName

public String LocalName {get; }

The local part of the QName


ClarkName

public String ClarkName {get; }

The expanded name, as a string using the notation devised by James Clark. If the name is in a namespace, the resulting string takes the form {uri}local. Otherwise, the value is the local part of the name.


Method Detail

FromClarkName

public QName FromClarkName(string expandedName)

Factory method to construct a QName from a string containing the expanded QName in Clark notation, that is, {uri}local

The prefix part of the QName will be set to an empty string.

Parameters:
expandedName -
The URI in Clark notation: {uri}local if the name is in a namespace, or simply local if not.

Register

public void Register(Processor processor)

Register a QName with the Processor. This makes comparison faster when the QName is compared with others that are also registered with the Processor.

Parameters:
processor -
The Processor in which the name is to be registered.

IsValid

public bool IsValid(Processor processor)

Validate the QName against the XML 1.0 or XML 1.1 rules for valid names.

Parameters:
processor -
The Processor in which the name is to be validated. This determines whether the XML 1.0 or XML 1.1 rules for forming names are used.
returns
true if the name is valid, false if not

ToString

public String ToString()

Convert the value to a string. The resulting string is the lexical form of the QName, using the original prefix if there was one.


GetHashCode

public int GetHashCode()

Get a hash code for the QName, to support equality matching. This supports the semantics of equality, which considers only the namespace URI and local name, and not the prefix.

The algorithm for allocating a hash code does not depend on registering the QName with the Processor.


Equals

public bool Equals(object )

Test whether two QNames are equal. This supports the semantics of equality, which considers only the namespace URI and local name, and not the prefix.

The result of the function does not depend on registering the QName with the Processor, but is computed more quickly if the QNames have both been registered


ToXmlQualifiedName

public XmlQualifiedName ToXmlQualifiedName()

Convert the value to an XmlQualifiedName (as defined in the System.Xml package)

Note that this loses the prefix.