Page 1

Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

TUTORIAL 2: WORKING WITH NAMESPACES TRUE/FALSE 1. Name collisions are always avoidable with good planning. ANS: F

PTS: 1

REF: XML 56

2. One of the downsides of the use of XML vocabularies is their failure to provide simple element names to describe data. ANS: F

PTS: 1

REF: XML 56

3. Creating complex element names to avoid name collision would eliminate one of the benefits of XML. ANS: T

PTS: 1

REF: XML 56

4. Common XHTML element names like title, name, first, last, or address are likely to be found in the thousands of XML vocabularies currently available. ANS: T

PTS: 1

REF: XML 56

5. Once a namespace has been declared, it can be applied to any descendant of the element. ANS: T

PTS: 1

REF: XML 57

PTS: 1

REF: XML 57

6. All URIs are URLs. ANS: F

7. A URL does not have to actually point to a real site on the Web to be used to define a namespace. ANS: T

PTS: 1

REF: XML 58

8. One example of a URL is the identification of a book by its ISBN number. ANS: F

PTS: 1

REF: XML 58

9. Currently URLs are rarely used in place of URNs but this may change in the future. ANS: F

PTS: 1

REF: XML 58

10. Using URLs or URNs has not gained widespread acceptance in declaring namespaces. ANS: F

PTS: 1

REF: XML 58

11. Nothing prevents you from using almost any unique identifier to declare a namespace. ANS: T

PTS: 1

REF: XML 58


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

12. It is a good idea to verify that you have not added any syntax errors to a file after you have added several namespace prefixes to the elements in a document. ANS: T

PTS: 1

REF: XML 60

13. It is required that you use namespace prefixes for all of the elements in a compound XML document. ANS: F

PTS: 1

REF: XML 61

14. Many compound documents use a default namespace that covers most of the elements in the document, with elements from other XML vocabularies assigned namespace prefixes. ANS: T

PTS: 1

REF: XML 61

15. Unlike an element name, an attribute can be qualified by adding a namespace prefix. ANS: F

PTS: 1

REF: XML 61

16. Default namespaces apply to attributes but not to elements. ANS: F

PTS: 1

REF: XML 61

17. The class attribute is often used in CSS to apply common formats to groups of elements ANS: T

PTS: 1

REF: XML 62

18. If a namespace prefix is declared more than one, only the first instance is used in the style sheet. ANS: F

PTS: 1

REF: XML 63

19. Once you have declared a namespace in a style sheet, you can associate selectors with that namespace by adding the namespace prefix to each selector name. ANS: T

PTS: 1

REF: XML 63

20. If you omit the namespace prefix from a selector, the style sheet is rejected as invalid. ANS: F

PTS: 1

REF: XML 64

21. When the specifications for XML 1.0 were first posted, there was no support for namespaces. ANS: T

PTS: 1

REF: XML 65

22. At the outset of XML 1.0, there were several competing proposals for adding namespace support to XML and CSS. ANS: T

PTS: 1

REF: XML 65

23. All browsers support the use of the @namespace rule. ANS: F

PTS: 1

REF: XML 65


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

24. Vocabularies like RSS and MathML cannot be combined within single documents. ANS: F

PTS: 1

REF: XML 67

25. As time goes on, browsers are less and less likely to extend and improve their ability to support documents that combine multiple vocabularies. ANS: F

PTS: 1

REF: XML 68

26. Currently, it is sometimes easiest to design XML documents that use multiple vocabularies for viewing on specialized browsers. ANS: T

PTS: 1

REF: XML 68

27. Browsers like Amaya and Jumbo include built-in support and style sheets for the elements of the relevant vocabularies. ANS: T

PTS: 1

REF: XML 68

28. The elements of almost any XML document can be displayed in the current major browsers if you design style sheets to work with the elements of the XML vocabulary. ANS: T

PTS: 1

REF: XML 68

29. Every element in a document that lacks a namespace prefix is considered part of the XHTML vocabulary if the default namespace points to the URI for XHTML. ANS: T

PTS: 1

REF: XML 69

MODIFIED TRUE/FALSE 1. A document that combines several vocabularies is known as a(n) aggregate document. _________________________ ANS: F, compound PTS: 1

REF: XML 51

2. A name collapse occurs when the same element name is used from different XML vocabularies within the same compound document. _________________________ ANS: F, name collision PTS: 1

REF: XML 55

3. XML offers hosts as a mechanism for distinguishing elements from one vocabulary from elements into another vocabulary. _________________________ ANS: F, namespaces PTS: 1

REF: XML 56


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

4. A glossary is a defined collection of element and attribute names. _________________________ ANS: F, namespace PTS: 1

REF: XML 56

5. Applying a namespace to an XML document involves two steps. _________________________ ANS: T

PTS: 1

REF: XML 56

6. To declare a namespace you add the attribute xml:prefix= “uri” to an element within an XML document. _________________________ ANS: F, xmlns PTS: 1

REF: XML 57

7. In order to make a namespace available to all elements within a document, some XML authors add all namespace declarations to the document’s root element. _________________________ ANS: T

PTS: 1

REF: XML 57

8. If an XML vocabulary is made widely available, the namespace associated with that vocabulary needs to be unique. _________________________ ANS: T

PTS: 1

REF: XML 57

9. One type of URL is a Uniform Resource Name. _________________________ ANS: F, URI PTS: 1

REF: XML 58

10. Currently, URNs are rarely used in place of URLs but this may change in the future. _________________________ ANS: T

PTS: 1

REF: XML 58

11. The main requirement of a URI is that it be standardized. ___________________________________ ANS: F, unique PTS: 1

REF: XML 58

12. To apply an XML namespace, you give elements and attributes local names. _________________________ ANS: F, qualified PTS: 1

REF: XML 58

13. A(n) unindexed name is a name without a namespace reference. _________________________


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

ANS: F, unqualified PTS: 1

REF: XML 58

14. Like element names, there is no default namespace for attribute names. _________________________ ANS: F, Unlike PTS: 1

REF: XML 61

15. As with XML documents, the namespace prefix is required. _________________________ ANS: F, optional PTS: 1

REF: XML 63

16. Any @namespace rules in a style sheet must come before all @import and @charset rules. _________________________ ANS: F, after PTS: 1

REF: XML 63

17. Any @namespace rules in a style sheet must come after any style declarations. _________________________ ANS: F, before PTS: 1

REF: XML 63

18. If a namespace prefix is declared more than once, only the first instance is used in the style sheet. _________________________ ANS: F, last PTS: 1

REF: XML 63


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

19. Figure 2-22 shows the changing of a document from XML to XHTML. _________________________ ANS: F, HTML PTS: 1

REF: XML 69

MULTIPLE CHOICE

1. The figure above shows an example of a name ____. a. aggregation c. montage b. collision d. collapse ANS: B

PTS: 1

REF: XML 55

2. One of the benefits of XML ____ is the ability to use simple element names to describe data. a. glossaries c. indices b. vocabularies d. sort orders ANS: C

PTS: 1

REF: XML 56

3. A ____ is a mechanism that permits elements from one vocabulary to be distinguished from elements in another. a. schematic c. MML b. CML d. namespace ANS: D

PTS: 1

REF: XML 56

4. Applying a namespace to an XML document involves ____ steps. a. two c. five b. three d. seven ANS: A

PTS: 1

REF: XML 56

5. The first step in applying a namespace to an XML document is to ____ the namespace. a. initiate c. call b. invoke d. declare


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

ANS: D

PTS: 1

REF: XML 57

6. A string of characters that uniquely identifies a resource is called a(n) ____. a. URP c. URI b. URH d. URM ANS: C

PTS: 1

REF: XML 57

7. To declare a namespace you add this attribute to an element within an XML document: ____. a. xmlns (prefix= “uri”) c. xmlns:prefix= “uri” b. xmlns= “uri” d. xmlns: “uri” ANS: C

PTS: 1

REF: XML 57

8. Given this declaration <model xmlns:mod= “http://jacksonelect.com/models”> the prefix is ____. a. model c. mod b. xml d. xmlns ANS: C

PTS: 1

REF: XML 57

9. What is the maximum number of namespace attributes you can declare within an element? a. 1 c. 3 b. 2 d. There is no limit. ANS: D

PTS: 1

REF: XML 57

10. The purpose of a ____ is to provide a unique string of characters identifying a resource. a. hostname c. protocol b. client name d. URI ANS: D

PTS: 1

11. One version of a ____ is a URL. a. URI b. URN ANS: A

PTS: 1

REF: XML 57 c. URT d. URH REF: XML 57

12. ____ serve as built-in mechanisms on the Web for generating unique addresses a. URLs c. Host names b. Protocols d. Client names ANS: A

PTS: 1

REF: XML 57

13. A ____ provides a persistent name for a resource. a. URN c. URL b. URI d. URX ANS: A

PTS: 1

14. URNs take the form ____. a. urn(NID) b. urn:NID ANS: C

PTS: 1

REF: XML 58 c. urn:NID:NSS d. urn/NID/NSS REF: XML 58


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

15. One example of a URN is a bookâ&#x20AC;&#x2122;s identification by its ____ number. a. bar c. ISBN b. serial d. key ANS: C

PTS: 1

REF: XML 58

16. To apply an XML namespace, you give elements and attributes ____ names. a. qualified c. unique b. registered d. documented ANS: A

PTS: 1

REF: XML 58

17. A namespace ____ identifies the namespace. a. prefix b. registry ANS: A

PTS: 1

c. model d. keytag

REF: XML 58

18. The ____ part of a qualified name identifies the element or attribute within that namespace. a. main c. index b. root d. local ANS: D

PTS: 1

REF: XML 58

19. Another name for the local part is the local ____. a. name c. symbol b. term d. entity ANS: A

PTS: 1

REF: XML 58

20. A(n) ____ name is a name without a namespace reference. a. empty c. unqualified b. null d. open ANS: C

PTS: 1

REF: XML 58

21. You can declare a ____ namespace by omitting the prefix in the namespace declaration. a. base c. main-level b. root d. default ANS: D

PTS: 1

REF: XML 61

22. The advantage of ____ namespaces is that they make the code easier to read because you do not have to add the namespace prefix to each element. a. default c. base b. main-level d. root ANS: A

PTS: 1

REF: XML 61

23. Many compound documents use a ____ namespace that covers most of the elements in the document, with elements from other XML vocabularies assigned namespace prefixes. a. main-level c. default b. base d. root ANS: C

PTS: 1

REF: XML 61


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

24. Like an element name, an attribute can be qualified by adding a namespace ____. a. epilog c. body b. prolog d. prefix ANS: D

PTS: 1

25. Default namespaces apply to ____. a. attributes b. comments ANS: C

PTS: 1

REF: XML 61 c. elements d. Both A and C REF: XML 61

26. An attribute name without a ____ is assumed to belong to the same namespace as the element that contains it. a. link c. model b. opening tag d. prefix ANS: D

PTS: 1

REF: XML 61

27. You can use the ____ symbol to apply a style to any element within a namespace or to elements across different namespaces. a. ? c. & b. @ d. * ANS: D

PTS: 1

REF: XML 63

28. Which of the following sets a width of 150 pixels to any element named title from any namespace? a. #|title {width: 150px| c. ^|title {width: 150px| b. *|title {width: 150px| d. ?|title {width: 150px| ANS: B

PTS: 1

REF: XML 64

29. Which of the following would apply to all elements named title in any namespace? a. ?|title {width: 150px| c. title {width: 150px| b. *|title {width: 150px| d. #|title {width: 150px| ANS: C

PTS: 1

REF: XML 64

30. Internet Explorer inserts the ____ character before the namespace prefix in CSS style sheets. a. | c. \ b. / d. + ANS: C

PTS: 1

REF: XML 65

31. You can use the ____ symbol to apply the same style to several elements in the namespace. a. ? c. * b. # d. ^ ANS: C

PTS: 1

REF: XML 65

32. Which of the following supports the definition of namespaces using the escape character? a. Firefox c. Internet Explorer b. Opera d. All of the above ANS: C

PTS: 1

REF: XML 65


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

33. The standard ____ that are shared throughout the world such as XHTML, RSS, or MathML can also be combined within single documents. a. glossaries c. indices b. vocabularies d. engines ANS: B

PTS: 1

REF: XML 67

34. The namespace URI http://www.microsoft.com/standard/channels.dtd corresponds to what vocabulary? a. RSS 1.0 c. CDF b. VoiceXML d. XSLT ANS: C

PTS: 1

REF: XML 68

35. The namespace URI http://www.xml-cml.org/dtd/cml1_0_1.dtd corresponds to what vocabulary? a. CDF c. CML b. MathML d. SMIL ANS: C

PTS: 1

REF: XML 68

36. The namespace URI http://www.w3.org/1998/Math/MathML corresponds to what vocabulary? a. SMIL c. XForms b. MathML d. VoiceXML ANS: B

PTS: 1

REF: XML 68

37. The namespace URI http://purl.org/rss/1.0 corresponds to what vocabulary? a. RSS 1.0 c. SVG b. SMIL d. XHTML ANS: A

PTS: 1

REF: XML 68

38. The namespace URI http://www.w3.org/2001/SMIL20/Language corresponds to what vocabulary? a. XMLSchema c. RSS 1.0 b. SMIL d. XSLT ANS: B

PTS: 1

REF: XML 68

39. The namespace URI http://www.w3.org/2000/svg corresponds to what vocabulary? a. SVG c. CML b. CDF d. RSS 1.0 ANS: A

PTS: 1

REF: XML 68

40. The namespace URI http://www.w3.org/2001/vxml corresponds to what vocabulary? a. CDF c. VoiceXML b. CML d. SMIL ANS: C

PTS: 1

REF: XML 68

41. The namespace URI http://www.w3.org/2002/xforms corresponds to what vocabulary? a. CML c. XForms b. SVG d. RSS 1.0 ANS: C

PTS: 1

REF: XML 68


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

42. The namespace URI http://www.w3.org/1999/xhtml corresponds to what vocabulary? a. CML c. XHTML b. XMLSchema d. XSLT ANS: C

PTS: 1

REF: XML 68

43. The namespace URI http://www.w3.org/2001/XMLSchema corresponds to what vocabulary? a. CDF c. XMLSchema b. SMIL d. RSS 1.0 ANS: C

PTS: 1

REF: XML 68

44. The namespace URI http://www.w3.org/1999/XSL/Transform corresponds to what vocabulary? a. XForms c. XSLT b. XHTML d. XMLSchema ANS: C

PTS: 1

REF: XML 68

45. The W3C provides the ____ Web browser to display documents combining elements from the MathML and XHTML vocabularies. a. Firefox c. Amaya b. Opera d. Jumbo ANS: C

PTS: 1

REF: XML 68

46. Browsers like ____ can display compound documents that use XHTML and CML. a. Firefox c. Jumbo b. Opera d. Amaya ANS: C

PTS: 1

REF: XML 68

47. Figure 2-21 shows a(n) ____ XHTML and MathML document in the Amaya browser a. synthesized c. compound b. formulaic d. integrated ANS: C

PTS: 1

REF: XML 68


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

48. Converting an HTML file to an XHTML file can be done by adding a(n) ____ declaration at the top of the file and setting the default namespace of the document to the XHTML vocabulary. a. xhtml c. xml b. xsl d. Any of the above ANS: C

PTS: 1

REF: XML 69

49. Every element in a document that lacks a namespace prefix is considered part of the XHTML vocabulary if the default namespace points to the ____ for XHTML. a. URL c. URI b. URN d. Any of the above ANS: C

PTS: 1

REF: XML 69

50. The figure above shows the changing of a document from ____ to XHTML. a. CSS c. HTML b. XML d. It is impossible to tell from the diagram. ANS: C

PTS: 1

REF: XML 69

COMPLETION

1. The figure above shows the tree structure of the model ____________________. ANS: vocabulary


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

PTS: 1

REF: XML 49

2. A document that combines several vocabularies is known as a(n) ____________________ document. ANS: compound PTS: 1

REF: XML 51

3. A(n) ____________________ occurs when the same element name is used from different XML vocabularies within the same compound document. ANS: name collision PTS: 1

REF: XML 55

4. A(n) ____________________ is a defined collection of element and attribute names. ANS: namespace PTS: 1

REF: XML 56

5. In the syntax for the declaration of a namespace, a â&#x20AC;&#x153;uriâ&#x20AC;? stands for ____________________. ANS: Uniform Resource Identifier PTS: 1

REF: XML 57

6. URL stands for ____________________. ANS: Uniform Resource Locator PTS: 1

REF: XML 57

7. URN stands for ____________________. ANS: Uniform Resource Name PTS: 1

REF: XML 58

8. Using URNs or URLs is widely accepted in declaring ____________________. ANS: namespaces PTS: 1

REF: XML 58


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

9. The code highlighted in the figure above is used to declare the models and parts ____________________. ANS: namespaces PTS: 1

REF: XML 58

10. A qualified name, or ____________________, is an element name consisting of the namespace prefix and the local name. ANS: qname PTS: 1

REF: XML 58

11. A(n) ____________________ name is a name without a namespace reference. ANS: unqualified PTS: 1

REF: XML 58

12. To apply an XML namespace, you give elements and attributes ____________________ names. ANS: qualified PTS: 1

REF: XML 58

13. You can declare a default namespace by omitting the ____________________ in the namespace declaration. ANS: prefix PTS: 1

REF: XML 61

14. The advantage of ____________________ namespaces is that they make the code easier to read because you do not have to add the namespace prefix to each element. ANS: default PTS: 1

REF: XML 61

15. Default namespaces do not apply to ____________________. ANS: attributes PTS: 1

REF: XML 61

16. If a namespace prefix is declared more than once, only the ____________________ instance is used in the style sheet. ANS: last PTS: 1

REF: XML 63


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

17. The figure above shows the application of the models namespace to a(n) ____________________. ANS: style sheet PTS: 1

REF: XML 64

18. Internet Explorer inserts the backslash escape character before the ____________________ in CSS style sheets. ANS: namespace prefix PTS: 1

REF: XML 65

19. The figure above shows a(n) ____________________ XHTML and MathML document in the Amaya browser. ANS: compound PTS: 1

REF: XML 68


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

MATCHING Identify the letter of the choice that best matches the phrase or definition. a. compound e. URL b. name collision f. URN c. namespace g. qname d. URI h. unqualified name 1. 2. 3. 4. 5. 6.

Type of document that combines several vocabularies Used to identify the location of a resource on the Web A string of characters that uniquely identifies a resource A defined collection of element and attribute names A name without a namespace reference Occurs when the same element name is used from different XML vocabularies within the same compound document 7. Provides a persistent name for a resource 8. An element name consisting of a namespace prefix and the local name 1. 2. 3. 4. 5. 6. 7. 8.

ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS:

A E D C H B F G

PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS:

1 1 1 1 1 1 1 1

REF: REF: REF: REF: REF: REF: REF: REF:

XML 51 XML 57 XML 57 XML 56 XML 58 XML 55 XML 58 XML 58

SHORT ANSWER 1. What is a compound document? ANS: A document that combines several vocabularies is known as a compound document. PTS: 1

REF: XML 51

2. What is name collision? ANS: Name collision occurs when the same element name is used from different XML vocabularies within the same compound document PTS: 1

REF: XML 55

3. What is a namespace? ANS: A namespace is a defined collection of element and attribute names.


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

PTS: 1

REF: XML 56

4. What are the steps in applying a namespace to an XML document? ANS: Declare the namespace, and identify the elements and attributes within the document that belong to that namespace. PTS: 1

REF: XML 57

5. What is a Uniform Resource Identifier? ANS: A string of characters that uniquely identifies a resource. PTS: 1

REF: XML 57

6. What is a Uniform Resource Locator? ANS: A version of a URI, which is used to identify the location of a resource on the Web. PTS: 1

REF: XML 57

7. If you want to ensure the uniqueness of any namespaces associated with the vocabularies developed for your XML documents, what does it make sense to do? ANS: It makes sense to use your Web address as a foundation for the namespaces. PTS: 1

REF: XML 58

8. What is the general form for applying a qualified name to a two-sided tag? ANS: <prefix:element> ... </prefix:element> where prefix is the namespace prefix and element is the local part. PTS: 1

REF: XML 59

9. An opening element tag includes both the namespace prefix and the xmlns attribute to declare the namespace. What does this indicate? ANS: This indicates that the element is also part of the namespace that it declares. PTS: 1

REF: XML 59

10. If you declare a default namespace, any descendant element or attribute is considered part of the namespace unless what? ANS:


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

Unless a different namespace is declared within one of the child elements. PTS: 1

REF: XML 61

11. What is the syntax to create a default namespace? ANS: <element xmlns= “uri”> ... </element> PTS: 1

REF: XML 61

12. What is the syntax to qualify an attribute? ANS: <element prefix:attribute= “value”> ... </element> PTS: 1

REF: XML 61

13. What is wrong with this? mod:title {width: 150px} ANS: This doesn’t work as a way to include the prefix in the selector name, because CSS reserves the colon character for pseudo-elements and pseudo-classes. (Instead, you have to declare a namespace in the style sheet and then reference that namespace in the selector.) PTS: 1

REF: XML 63

14. What rule would you add to declare a namespace in a style sheet? ANS: @namespace prefix url(uri);, where prefix is the namespace prefix and uri is the URI of the namespace. PTS: 1

REF: XML 63

15. If a namespace prefix is omitted when a namespace is added to a style sheet, what is assumed? ANS: The URI in the @namespace rule is considered to be the default namespace for the selectors in the style sheet. PTS: 1

REF: XML 63

16. If a namespace prefix is declared more than once in a style sheet, what happens? ANS: Only the last instance of the prefix is used in the style sheet. PTS: 1

REF: XML 63

17. What is the syntax for adding a namespace prefix to a given selector?


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

ANS: prefix|selector {attribute1:value1; attribute2:value2; ...} PTS: 1

REF: XML 63

18. What is the syntax for applying a style to an element from a particular namespace in Internet Explorer? ANS: prefix\:selector {attrbiute1:value1; attribute2:value2; ...} PTS: 1

REF: XML 65

19. How do you convert an HTML file into an XHTML file? ANS: Converting an HTML file to an XHTML file can be done by adding an xml declaration at the top of the file and setting the default namespace of the document to the XHTML vocabulary. PTS: 1

REF: XML 69

20. Under what circumstances would every element in an HTML document that lacks a namespace prefix be considered part of the XHTML vocabulary? ANS: This would be the case if the default namespace points to the URI for XHTML. PTS: 1

REF: XML 69

ESSAY 1. Define each of the following: URI, URL, and URN. ANS: A Uniform Resource Identifier (URI) is a string of characters that uniquely identifies a resource, used to declare a namespace. A Uniform Resource Locator (URL) is a version of a URI used to identify the location of a resource on the Web, and often used as the basis for identifying namespaces because of the uniqueness it guarantees. A Uniform Resource Name (URN) is another version of a URI—a persistent name for a resource, independent of that resource’s location. PTS: 1

REF: XML 57-58

2. Discuss how to declare a namespace and how to declare a default namespace. ANS: To declare a namespace, add the following attribute to an element in the document: xmlns:prefix= “uri” where prefix is the namespace prefix and uri is the URI of the namespace. The namespace is applied to the element containing the xmlns attribute, as well as to its descendant elements. To declare a default namespace, add the xmlns attribute without a prefix as follows: xmlns= “uri” PTS: 1

REF: XML 57

3. What is the advantage and the disadvantage of default namespaces?


Full file at http://testbank360.eu/test-bank-new-perspectives-on-xml-comprehensive-2nd-edition-patrick-carey

ANS: The advantage of default namespaces is that they make the code easier to read because you do not have to add the namespace prefix to each element. The disadvantage, however, is that an elementâ&#x20AC;&#x2122;s namespace is not readily apparent from the code. Still, many compound documents use a default namespace that covers most of the elements in the document, with elements from other XML vocabularies assigned namespace prefixes. PTS: 1

REF: XML 61

4. Since an attribute is automatically associated with the namespace of its element, discuss why you would ever need to qualify an attribute name? ANS: In most cases you donâ&#x20AC;&#x2122;t. The only exception occurs when an attribute from one namespace needs to be used in an element from another namespace. For example, XHTML uses the class attribute to associate elements belonging to a common group or class. You could attach the class attribute from the XHTML namespace to elements from other namespaces. Since the class attribute is often used in CSS to apply common formats to groups of elements, using the class attribute in other XML elements would allow this feature of CSS to be applied to those elements as well. PTS: 1

REF: XML 62

5. How does the syntax differ from browser to browser for applying a namespace to selector? Present any variants in syntax. ANS: To apply a namespace to a selector, use the form prefix|selector {attribute1:value; attribute2:value2; ...} where prefix is the namespace prefix and selector is a selector for an element or group of elements in the document. For Internet Explorer browsers, use the following form to apply a namespace to a selector: prefix\:selector {attribute1:value; attribute2:value2; ...} PTS: 1

REF: XML 67

Test bank new perspectives on xml comprehensive 2nd edition patrick carey  

test bank new perspectives on xml comprehensive 2nd edition patrick carey. Full file at http://testbank360.eu/test-bank-new-perspective...

Read more
Read more
Similar to
Popular now
Just for you