- A DTDs is an XML document.
- True
- False
- DTDs contain desclarations for elements and entities.
- True
- False
- DTDs are used to validate XML document.
- True
- False
- Each XML document can be represented as a tree structure.
- True
- False
- Ability to create one’s own tag is XML’s greatest disadvantage.
- True
- False
- DTDs are made up of three blocks of declarations and the DOCTYPE declaration.
- True
- False
- Elements, attributes and entities can be declared in any order.
- True
- False
- DOCTYPE declarations are specified in the prolog of the XML document.
- True
- False
- Internal DTDs specify the DTD within square brackets in the declaration itself.
- True
- False
- External DTDs use the keyword URL to specify the location of the DTD.
- True
- False
- Arrange the steps of creating DTDs.
(A) Declare all
the possible elements.
(B) Specify
the permissible element children, if any
(C) Set
the order in which elements must appear.
(D) Declare all
the possible element attribute.
(E) Set
the attribute data types and values.
(F) Declare
all the possible entities.
- Which of the following XML code Snippets is valid?
(A) <!DOCTYPE
mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP System
“hp.txt“>
<!ENTITY CH System
“ch.txt”>
<!ENTITY SK System “sk.txt”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories> &HP; ,
&CH; and a &SK;</Accessories>
</Mobile>
hp.txt
Head Phones
ch.txt
Charger
sk.txt
Starter’s Kit
(B)<!DOCTYPE
mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP System “hp.txt”>
<!ENTITY SK System
“sk.txt”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories> &HP; ,
&CH; and a &SK;</Accessories>
</Mobile>
hp.txt
Head Phones
ch.txt
Charger
sk.txt
Starter’s Kit
(C) <!DOCTYPE mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP System
“hp.txt“>
<!ENTITY CH System
“ch.txt”>
<!ENTITY SK System
“sk.txt”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories> &HP; ,
&CH; and a &SK;</Accessories>
</Mobile>
hp.txt
Head Phones
ch.txt
Charger
sk.txt
Starter’s Kit
(D) <!DOCTYPE mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP System
“hp.txt“>
<!ENTITY CH System “ch.txt”>
<!ENTITY SK System
“sk.txt”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999
<Accessories> &HP; ,
&CH; and a &SK;</Accessories>
</Mobile>
hp.txt
Head Phones
ch.txt
Charger
sk.txt
Starter’s Kit
- Element can contain character data but to be parsed, incase it contain entity references
- <!ELEMENT element-name (type|child-name|…)>
- <!ELEMENT element-name (child-name+)>
- <!ELEMENT element-name (child-name,(child-name|child-name|…)>
- <!ELEMENT element-name (#PCDATA)>
- <!ELEMENT element-name (child-elemnt-name)>
- Element with a number of children appearing only once in the XML document.
- <!ELEMENT element-name (type|child-name|…)>
- <!ELEMENT element-name (child-name+)>
- <!ELEMENT element-name (child-name,(child-name|child-name|…)>
- <!ELEMENT element-name (#PCDATA)>
- <!ELEMENT element-name (child-elemnt-name)>
- Element can accept either data type or children, etc.
- <!ELEMENT element-name (type|child-name|…)>
- <!ELEMENT element-name (child-name+)>
- <!ELEMENT element-name (child-name,(child-name|child-name|…)>
- <!ELEMENT element-name (#PCDATA)>
- <!ELEMENT element-name (child-elemnt-name)>
- Element’s children appear at least once in the XML document.
- <!ELEMENT element-name (type|child-name|…)>
- <!ELEMENT element-name (child-name+)>
- <!ELEMENT element-name (child-name,(child-name|child-name|…)>
- <!ELEMENT element-name (#PCDATA)>
- <!ELEMENT element-name (child-elemnt-name)>
- Element can have either one of two or more children.
- <!ELEMENT element-name (type|child-name|…)>
- <!ELEMENT element-name (child-name+)>
- <!ELEMENT element-name (child-name,(child-name|child-name|…)>
- <!ELEMENT element-name (#PCDATA)>
- <!ELEMENT element-name (child-elemnt-name)>
- Name of a notation.
- NMTOKEN
- NOTATION
- (en1|en2|…)
- xml:
- IDREF
- Predefined xml value.
- NMTOKEN
- NOTATION
- (en1|en2|…)
- xml:
- IDREF
- id of another element.
- NMTOKEN
- NOTATION
- (en1|en2|…)
- xml:
- IDREF
- valid xml name.
- NMTOKEN
- NOTATION
- (en1|en2|…)
- xml:
- IDREF
- enumerated list.
- NMTOKEN
- NOTATION
- (en1|en2|…)
- xml:
- IDREF
- Which of the following XML code is correct?
(A) <!DOCTYPE mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP “Head Phones”>
<!ENTITY SK “Starter’s
Kit ”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories> &HP; ,
&CH; and a &SK;</Accessories>
</Mobile>
(B) <!DOCTYPE mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP “Head Phones”>
<!ENTITY CH “charger”>
<!ENTITY SK “Starter’s
Kit”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories> HP , CH and a
SK</Accessories>
</Mobile>
(C) <!DOCTYPE mobile [
<!ELEMENT Mobile (Company, Model, Price,
Accessories)>
<!ELEMENT Company
(#PCDATA)>
<!ELEMENT Model (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST Model Type CDATA
“camera”>
<!ENTITY HP “hp.txt”>
<!ENTITY CH “ch.txt”>
<!ENTITY SK
“sk.txt”>
]>
<Mobile >
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories> &HP; ,
&CH; and a &SK;</Accessories>
</Mobile>
(D)
<!DOCTYPE mobile [
<!ELEMENT
Mobile
(Company, Model, Price, Accessories)>
<!ELEMENT
Company (#PCDATA)>
<!ELEMENT
Model (#PCDATA)>
<!ELEMENT
Price (#PCDATA)>
<!ELEMENT Accessories (#PCDATA)>
<ATTLIST
Model Type CDATA “camera”>
<!ENTITY
HP “Head Phones”>
<!ENTITY
CH “Charger”>
<!ENTITY SK
“Starter’s Kit”>
]>
<Mobile>
<Company>Nokia</Company>
<Mode
Type=“camera”>6600</Mode>
<Price>9999</Price>
<Accessories>
&HP; , &CH; and a &SK;</Accessories>
</Mobile>
0 nhận xét:
Đăng nhận xét