Naming Collision - Example: XML Element Names

Example: XML Element Names

In XML, 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:

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

Read more about this topic:  Naming Collision

Famous quotes containing the words element and/or names:

    Cranks live by theory, not by pure desire. They want votes, peace, nuts, liberty, and spinning-looms not because they love these things, as a child loves jam, but because they think they ought to have them. That is one element which makes the crank.
    Rose Macaulay (1881–1958)

    The world is a puzzling place today. All these banks sending us credit cards, with our names on them. Well, we didn’t order any credit cards! We don’t spend what we don’t have. So we just cut them in half and throw them out, just as soon as we open them in the mail. Imagine a bank sending credit cards to two ladies over a hundred years old! What are those folks thinking?
    Sarah Louise Delany (b. 1889)