Hi, I had to do the quiz for XML and I am not quite sure whether I've got all the question right. Please tell me whether I've got each question right or wrong. Thank you very much.
What kind of component in an XML file is written like this:
<?xml version="1.0"?>
Select one:
a. an empty element
b. none of the other cases - this is illegal XML
c. an attribute
d. a processing instruction
e. none of the other cases, but this is legal XML
Answer: d
This is XML.
<?xml version="1.0"?>
<block>
<order strength="firm">
<item>widget-LH-metric</item>
<number>25</number> </order>
<order strength="firm"><item>tap</item><number/></order>
</block>
name the root element: block
what is the name of the attribute: strength
what is the name of the empty element: number
3.This is an XML document. Choose all of the statements that are true:
<?xml version="1.0"?>
<block>blah<blip>
<fred>blah</blip>
<fred></BLOCK>
<fred/>
Select one or more:
a. syntactically correct XML but not well-formed
b. not syntactically correct
c. this is legal well-formed XML
Answer: b
- A DTD :
Select one or more:
a. is written in a language defined in a seperate specification from XML outside the XML syntax
b. is itself a well-formed XML document
c. must always be contained in the XML document to be valid
d. uses <!ELEMENT components
Answer: a, d
A DTD component in a document
<!ELEMENT order (#PCDATA) >
must name an element in a different namespace from the rest of the document
Select one:
True
False
Answer: True
Given this fragment of a DTD specification for a document, state whether each of the following fragments of XML is valid or invalid according to this DTD.
<!ELEMENT zoo (animalStock)*>
<!ELEMENT animalStock (animal , count)>
<!ELEMENT animal (lion | kangaroo | ant | zebra | aname)>
<!ELEMENT kangaroo (#PCDATA)>
<!ELEMENT lion (#PCDATA)>
<!ELEMENT ant (#PCDATA)>
<!ELEMENT zebra (#PCDATA)>
<!ELEMENT count (#PCDATA)><zoo> <animalStock> <animal type="lion">white</animal> <count>3</count> </animalStock> </zoo>
Answer: invalid
<zoo> <animalStock> <animal><ant/></animal> <count>1000000</count> </animalStock> <animalStock> <animal><kangaroo>red</kangaroo> </animal> <count>6</count> </animalStock> </zoo>
Answer: valid
<animalStock>
<animal><lion/></animal>
<count>1</count>
</animalStock>
Answer: invalid
<animalStock> <animal type="lion"/> <count>1</count> </animalStock>
Answer: invalid
<zoo> <animal> <lion> </animal> </zoo>
Answer: invalid
<animalStock> <animal><zebra>mountain</zebra></animal> <count> 35</count> </animalStock>
Answer: invalid
XML Schema: choose all of the following that are the names of simple types in XSD
Select one or more:a. boolean
b. thin
c. short
d. year
e. solid
f. alphanumeric
g. java
h. integer
i. string
j. date
k. identifier
Answer: all of them ?
Thanks!