New Perspectives on XML Tutorial 3 Case

advertisement
<!-New Perspectives on XML
Tutorial 3
Case Problem 2
Current news stories
Author:
Date: 2 Sept 2013
Filename:
headlines.xml
Supporting Files:
-->
<story category="national news" byline="Karen Wheatley">
<headline>President Meets with Congress</headline>
<synopsis><![CDATA[
The President meet with Congressional leaders today in effort to jump-start
faltering budget negotiations. Sources described the mood of the meeting
as "cordial".
]]>
</synopsis>
<article ref="new801" />
<image src="img2071" />
</story>
<story category="international">
<headline>Relief Agencies head to Peru</headline>
<synopsis><![CDATA[
Relief agencies headed to Peru today in wake of yesterday's massive earthquake.
Initial casualty estimates top 8000, in what would be one of the most
devasting earthquakes in the last 5 years.
]]>
</synopsis>
<article ref="news802" />
<images src="img2072" />
<images src="img2073" />
</story>
<story category="national" byline="Andrew Browne">
<headline>Congress Approves Judicial Nominee</headline>
<synopsis><![CDATA[
By a vote of 55-42, the Senate approved controversial judge Sandra Lehman
to the bench of the third circuit court.
]]>
</synopsis>
<article ref="news803" />
<image src="img2074" />
</story>
<story category="sports">
<headline>Bucks grab Series Lead</headline>
<synopsis><![CDATA[
Last night, the Milwaukee Bucks defeated the Los Angles Lakers to take a
3-2 lead in the NBA finals. The series returns to Los Angeles tomorrow night,
where the Lakers have been undefeated in the playoffs.
]]>
</synopsis>
<article ref="news804" />
<image src="img2075" />
</story>
<story category="entertainment" byline="Chandra Parks">
<headline>"The Witness" tops Box Office</headline>
<synopsis><![CDATA[
"The Witness" was the top-ranked movie this week with 18M in sales. Last week's
box champ, "Another Life", fell to second with 11M in sales.
]]>
</synopsis>
<article ref="news805" />
</story>
<!-New Perspectives on XML
Tutorial 3
Case Problem 2
List of news image files
Author:
Date: 2 Sept 2013
Filename:
stories.dtd
Supporting Files:
-->
<!NOTATION JPG SYSTEM "image/jpeg">
<!ENTITY img2071 SYSTEM "img2071.jpg"
<!ENTITY img2072 SYSTEM "img2072.jpg"
<!ENTITY img2073 SYSTEM "img2073.jpg"
<!ENTITY img2074 SYSTEM "img2074.jpg"
<!ENTITY img2075 SYSTEM "img2075.jpg"
NDATA
NDATA
NDATA
NDATA
NDATA
JPG>
JPG>
JPG>
JPG>
JPG>
<!-New Perspectives on XML
Tutorial 3
Case Problem 2
Online news DTD
Author:
Date: 2 Sept 2013
Filename:
news.dtd
Supporting Files:
-->
<!ELEMENT story (headline, synopsis, article, image*)>
<!ATTLIST story category (national | international | sports | entertainment | leisure | weather)
#REQUIRED>
<!ATTLIST story byline CDATA #IMPLIED>
<!ELEMENT headline (#PCDATA)>
<!ELEMENT article EMPTY>
<!ENTITY ref SYSTEM>
<!ELEMENT image EMPTY>
<!ENTITY src SYSTEM>
<!-New Perspectives on XML
Tutorial 3
Case Problem 2
List of news article files
Author:
Date: 2 Sept 2013
Filename:
articles.dtd
Supporting Files:
-->
<!NOTATION HTM SYSTEM "text/html">
<!ENTITY news801 SYSTEM "article801.html"
<!ENTITY news802 SYSTEM "article802.html"
<!ENTITY news803 SYSTEM "article803.html"
<!ENTITY news804 SYSTEM "article804.html"
<!ENTITY news805 SYSTEM "article805.html"
NDATA
NDATA
NDATA
NDATA
NDATA
HTM>
HTM>
HTM>
HTM>
HTM>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!-New Perspectives on XML
Tutorial 3
Case Problem 2
WNS news feed
Author:
Date: 2 Sept 2013
Filename:
wns.xml
Supporting Files: articles.dtd, headlines.xml, images.dtd, news.dtd
-->
<!DOCTYPE news_feed
[
<!ELEMENT story (story+)>
<!ENTITY % articles SYSTEM "articles.dtd">
<!ENTITY % images SYSTEM "images.dtd">
<!ENTITY % news SYSTEM "news.dtd">
%articles;
%images;
%news;
<!ENTITY headlines SYSTEM "headlines.xml">
]>
<news_feed>
</news_feed>
Download