XML Exercises by sus16053

VIEWS: 0 PAGES: 5

									XML Skills Worksheet
Use this worksheet to test your understanding of markup and XML. It should help you
prepare for your XML Skills Test.

To receive credit for this worksheet you need to turn it in and answer all the questions
(except those in the section titled “Thought Provokers.”

THIS WORKSHEET CONTAINS ALL THE STUFF YOU NEED TO KNOW TO DO
WELL ON YOUR XML EXAM. THERE MAY BE ITEMS THAT WERE NOT
EXPLICITLY COVERED IN CLASS OR READINGS. IF THERE ARE ITEMS YOU
DON’T KNOW ASK AND I’LL HELP YOU, OR GOOGLE

Markup

What is a tag?
What is the difference between
structural and formatting markup?
What’s the difference between
fixed and extensible markup?
Give an example using XML
syntax of a tag that completely
changes the meaning of what is
inside.



XML Instance Documents

What does XML stand for?
Can a Web browser display XML?
What are the rules of XML element
names?
Write a simple xml file that represents
the elements of a class paper (no
attributes or nesting)
What are your options for viewing and
editing raw xml?

What are the main differences between
XML and HTML?
Is <p> an HTML Tag or an XML tag?
Are formatting tags like <b> and <i>
allowed inside an XML File (there is a
simple answer and a more advanced
answer)?
What’s the difference between an
attribute and a child element?
What are the syntax rules of a well
formed document?

What is the root element?
What two ways can you close a tag?
What is nesting and what does it do for
you?
Write an xml file that represents the
elements of a class paper (use attributes
and nesting)
What does it mean to parse?
Translate instance1.xml into English



XSLT and XPath

What does XSLT stand for?

What does XSLT do?

Why would you need it?
Refer to the files Instance1.XML and
Output1.html (downloadable from the
class Web site) for this question.

Even though Output1.html and
Instance1.xml are completely
unrelated, you could create a
transform that runs against
Instance1.xml and creates
Output1.html. What would that
transform look like?


What’s the difference between CSS
and XSL? Can you use both?



XPath
What does xPath do?
Google xsl-fo and state what it does

What’s the difference between a
stylesheet and a transform?

The following statement inserts the
value of /files/refs/url into an HTML
href
<a href=”{/files/refs/url}”>link</a>

What would this statement do?

<img src=”{/files/ref/url}”
alt=”{/files/ref/caption}”/>
Why do you need the curly bracket
syntax when you already have a
value-of statement that inserts
elements from XML into HTML?
Refer to the files Instance1.XML and
Output2.html (downloadable from the
class Web site) for this question.

Starting from Instance1.xml, create
the transform that produces
Output2.html

Refer to the Transforms 2 class slide deck (XPATH) and answer the following questions.

For the slide titled “Basic XPATH” fill in the following table:

Number on the        An XPATH statement (starting from the root) that gets to the node
slide                pointed to by the number
1
2
3
4
5
6
7
8


For the slide titled “Add Relativity” fill in the following table:

Number on the        An XPATH statement that gets you to the circled node from the node
slide                pointed to by the number
1
2
3
4
5
6

For the slide titled “Add up” fill in the following table:

Number on the        An XPATH statement that gets from the “from” node to the “to”
slide                node.
1
2
3

For the slide titled “Add anywhere” fill in the following table:

XPATH                Nodes that it finds (of those that are shown on the screenshot)
statement
//title
//item/@id
//yourTags

For the slide titled “Add where” fill in the following table:

XPATH statement                             Nodes that it finds
//title[text()="News Article"]
//item[@id=“naEng”]
//yourTags[../../@id=“i3”]
//image[../../../@id=“naGer”]
//item[yourTags/author=“Contrib 1”]

For the slide titled “Put XPATH together with XSL” fill in the following table:

XSLT Command                                HTML that is written
Value-of commands
If commands
For-each commands



Schemas

What do schemas do?
Why would you need them?

Describe in English the rules specified
in Schema1.xsd

What’s an ID data type? What’s an
IDREF?
How do you make an attribute be an ID
or IDREF data type?
What’s the difference between well
formed and valid instance docs?
Can you load and parse a non well
formed doc? A non valid doc?
What’s the difference between a
schema and a DTD?
Refer to the files Schma1.XML
(downloadable from the class Web site)
for this question.

Describe in English at least 10 of the
rules specified in Schema1.xsd




Thought Provokers
These are questions to get you thinking. Especially if the other questions are not
challenging enough, these ones should get you to some deeper understandings of markup
and XML

      In what sense is there no difference between structural and formatting markup?
      What is the point of white space for humans? For XML parsers?
      How does nesting fundamentally divide XML from relational databases?
      Is markup meaning?
      What do namespaces do? Why are they prevented from accomplishing this?
      Write an xml file that represents a library of class papers (use recursion)
      Why would you use an “xsl:for-each” method vs using template matches to
       produce output?

								
To top