Typical usage may lead to an explosion of different QName objects that are equal. Therefore, application code
is encouraged to define and use constants for frequently used QNames. For example, for the XML Schema namespace:
val XsPrefix = "xs"val XsElementQName = QName(XsPrefix, "element")
val XsAttributeQName = QName(XsPrefix, "attribute")
val XsComplexTypeQName = QName(XsPrefix, "complexType")
val XsSimpleTypeQName = QName(XsPrefix, "simpleType")
// ...
In this example, the QName constant names are in upper camel case, starting with the prefix, followed by the local part,
and ending with suffix "QName".
Implementation note: It was tried as alternative implementation to define the QName subclasses as (Scala 2.10) value classes.
The QName would then wrap the qualified name as string representation (with or without prefix). One cost would be that parsing
the (optional) prefix and the local name would occur far more frequently. Another cost would be that the alternative implementation
would not directly express that a QName is a combination of an optional prefix and a local part. Therefore that alternative
implementation has been abandoned.
Linear Supertypes
Serializable, Serializable, Immutable, AnyRef, Any
Qualified name. See http://www.w3.org/TR/xml-names11/. Semantically like a
QName
in Anti-XML, and not like aQName
in Java.There are 2 types of
QName
s:QNames are meaningless outside their scope, which resolves the
QName
as an eu.cdevreeze.yaidom.core.EName.Typical usage may lead to an explosion of different QName objects that are equal. Therefore, application code is encouraged to define and use constants for frequently used QNames. For example, for the XML Schema namespace:
In this example, the QName constant names are in upper camel case, starting with the prefix, followed by the local part, and ending with suffix "QName".
Implementation note: It was tried as alternative implementation to define the QName subclasses as (Scala 2.10) value classes. The QName would then wrap the qualified name as string representation (with or without prefix). One cost would be that parsing the (optional) prefix and the local name would occur far more frequently. Another cost would be that the alternative implementation would not directly express that a QName is a combination of an optional prefix and a local part. Therefore that alternative implementation has been abandoned.