Naming collision
Encyclopedia
A naming collision is a circumstance where two or more identifiers in a given namespace
Namespace (computer science)
A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...

 or a given scope
Scope (programming)
In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities it can contain and how it affects them—or semantics...

 cannot be unambiguously resolved
Name resolution
-In computer languages:Expressions in computer languages can contain identifiers. The semantics of such expressions depend on the entities that the identifiers refer to. The algorithm that determines what an identifier in a given context refers to is part of the language definition.The complexity...

, and such unambiguous resolution is a requirement of the underlying system.

Example: XML element names

In XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

, element names can be originated and changed to reflect the type of information contained in the document. This level of flexibility may cause problems if separate documents encode different kinds of information, but use the same identifiers for the element names.

For example, the following sample document defines the basic semantics for a "person" document and a "book" document. Both of these use a "title" element, but the meaning is not the same:



Nancy
Davolio
Dr.
29



Ms.
ABCD1234567



For an application to allow a user to correctly query for and retrieve the "title" element, it must provide a way to unambiguously specify which title element is being requested. Failure to do so would give rise to a naming collision on the title element (as well as any other elements that shared this unintended similarity).

In the preceding example, there is enough information in the structure of the document itself (which is specified by the "root" element) to provide a means of unambiguously resolving element names.

For example, using XPath
XPath
XPath is a language for selecting nodes from an XML document. In addition, XPath may be used to compute values from the content of an XML document...

:

//root/person/title ;; the formal title for a person
//root/book/title ;; the title of a book

Collision domain

The term collision domain
Collision domain
A collision domain is a section of a network where data packets can collide with one another when being sent on a shared medium or through repeaters, in particular, when using early versions of Ethernet. A network collision occurs when more than one device attempts to send a packet on a network...

may also be used to refer to a system in which a single name or identifier is open to multiple interpretations by different layers or processing. The notion of a namespace
Namespace
In general, a namespace is a container that provides context for the identifiers it holds, and allows the disambiguation of homonym identifiers residing in different namespaces....

 has been widely adopted as a software programming practice to avert undesired clashes.

See also

  • Namespace
    Namespace
    In general, a namespace is a container that provides context for the identifiers it holds, and allows the disambiguation of homonym identifiers residing in different namespaces....

  • XML Namespaces
  • Delimiter collision
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK