XML Interviews Question page27,xml Interviews Guide,xml Interviews

This page discusses - XML Interviews Question page27,xml Interviews Guide,xml Interviews

XML Interviews Question page27,xml Interviews Guide,xml Interviews

XML Interviews Question page27

     

  1. Can qualified names be used in attribute values?
    Yes, but they have no special significance. That is, they are not necessarily recognized as such and mapped to universal names. For example, the value of the C attribute in the following is the string "foo:D", not the universal name {http://www.foo.org/}D.
    <foo:A xmlns:foo="http://www.foo.org/">
    <foo:B C="foo:D"/>
    <foo:A>
    In spite of this, there is nothing to stop an application from recognizing a qualified name in an attribute value and processing it as such. This is being done in various technologies today. For example, in the following XML Schemas definition, the attribute value xsd:string identifies the type of the foo attribute as the universal name {http://www.w3.org/1999/XMLSchema}string. <xsd:attribute name="foo" type="xsd:string" /> There are two potential problems with this. First, the application must be able to retrieve the prefix mappings currently in effect. Fortunately, both SAX 2.0 and DOM level 2 support this capability. Second, any general purpose transformation tool, such as one that writes an XML document in canonical form and changes namespace prefixes in the process, will not recognize qualified names in attribute values and therefore not transform them correctly. Although this may be solved in the future by the introduction of the QName (qualified name) data type in XML Schemas, it is a problem today.
       
  2. How are qualified names mapped to names in XML namespaces?
    If a qualified name in the body of a document (as opposed to the DTD) includes a prefix, then that prefix is used to map the local part of the qualified name to a universal name -- that is, a name in an XML namespace. For example, in the following, the prefix foo is used to map the local names A, B, and C to names in the http://www.foo.org/ namespace:
    <?xml version="1.0" ?>
    <foo:A xmlns:foo="http://www.foo.org/" foo:C="bar">
    <foo:B>abcd
    <foo:A>
    If a qualified name in the body of a document does not include a prefix and a default XML namespace is in scope then one of two things happens. If the name is used as an element tag, it is mapped to a name in the default XML namespace. If it is used as an attribute name, it is not in any XML namespace. For example, in the following, A and B are in the http://www.foo.org/ namespace and C is not in any XML namespace:
    <?xml version="1.0" ?>
    <A xmlns="http://www.foo.org/" C="bar">
    <B>abcd</B>
    <A>
    If a qualified name in the body of a document does not include a prefix and no default XML namespace is in scope, then that name is not in any XML namespace. For example, in the following, A, B, and C are not in any XML namespace:
    <?xml version="1.0" ?>
    <A C="bar">
    <B>abcd</B>
    <A>
    Qualified names in the DTD are never mapped to names in an XML namespace because they are never in the scope of an XML namespace declaration.
      
  3. How are universal names represented?
    There is no standard way to represent a universal name. However, three representations are common. The first representation keeps the XML namespace name (URI) and the local name separate. For example, many DOM level 1 implementations have different methods for returning the XML namespace name (URI) and the local name of an element or attribute node. The second representation concatenates the namespace name (URI) and the local name with caret (^). The result is a universally unique name, since carets are not allowed in URIs or local names. This is the method used by John Cowan's Namespace SAX Filter . For example, the universal name that has the URI http://www.google.org/to/servers and the local name Address would be represented as: http://www.foo.com/ito/servers^Address
    The third representation places the XML namespace name (URI) in braces and concatenates this with the local name. This notation is suggested only for documentation and I am aware of no code that uses it. For example, the above name would be represented as:
    {http://www.foo.com/ito/servers}Address
      
  4. Are universal names universally unique?
    No, but it is reasonable to assume they are.
    Universal element type and attribute names are not guaranteed to be universally unique -- that is, unique within the space of all XML documents -- because it is possible for two different people, each defining their own XML namespace, to use the same URI and the same element type or attribute name. However, this occurs only if:
    * One or both people use a URI that is not under their control, such as somebody outside Netscape using the URI http://www.netscape.com/, or
    * Both people have control over a URI and both use it.
      
    The first case means somebody is cheating when assigning URIs (a process governed by trust) and the second case means that two people within an organization are not paying attention to each other's work. For widely published element type and attribute names, neither case is very likely. Thus, it is reasonable to assume that universal names are universally unique. (Since both cases are possible, applications that present security risks should be careful about assuming that universal names are universally unique.) For information about the ability of universal names to uniquely identify element types and attributes (as opposed to the names themselves being unique)

Tutorials

  1. XML Interviews Question
  2. XML Interviews Question page3
  3. XML Interviews Question page9
  4. XML Interviews Question page10
  5. XML Interviews Question page12
  6. XML Interviews Question page19
  7. XML Interviews Question page21
  8. XML Interviews Question page1,xml Interviews Guide,xml Interviews
  9. XML Interviews Question page11,xml Interviews Guide,xml Interviews
  10. XML Interviews Question page13,xml Interviews Guide,xml Interviews
  11. XML Interviews Question page14,xml Interviews Guide,xml Interviews
  12. XML Interviews Question page15,xml Interviews Guide,xml Interviews
  13. XML Interviews Question page16,xml Interviews Guide,xml Interviews
  14. XML Interviews Question page17,xml Interviews Guide,xml Interviews
  15. XML Interviews Question page18,xml Interviews Guide,xml Interviews
  16. XML Interviews Question page1,xml Interviews Guide,xml Interviews
  17. XML Interviews Question page21,xml Interviews Guide,xml Interviews
  18. XML Interviews Question page22,xml Interviews Guide,xml Interviews
  19. XML Interviews Question page23,xml Interviews Guide,xml Interviews
  20. XML Interviews Question page24,xml Interviews Guide,xml Interviews
  21. XML Interviews Question page25,xml Interviews Guide,xml Interviews
  22. XML Interviews Question page26,xml Interviews Guide,xml Interviews
  23. XML Interviews Question page27,xml Interviews Guide,xml Interviews
  24. XML Interviews Question page28,xml Interviews Guide,xml Interviews
  25. XML Interviews Question page29,xml Interviews Guide,xml Interviews
  26. XML Interviews Question page30,xml Interviews Guide,xml Interviews
  27. XML Interviews Question page1,xml Interviews Guide,xml Interviews
  28. XML Interviews Question page5,xml Interviews Guide,xml Interviews
  29. XML Interviews Question page6,xml Interviews Guide,xml Interviews
  30. XML Interviews Question page7,xml Interviews Guide,xml Interviews
  31. XML Interviews Question page8,xml Interviews Guide,xml Interviews