5 <title>Demo slideshow</title>
6 <slide><title>Slide title</title>
7 <point>This is a demo</point>
8 <point>Of a program for processing slides</point>
11 <slide><title>Another demo slide</title>
12 <point>It is important</point>
13 <point>To have more than</point>
14 <point>one slide</point>
19 dom
= xml
.dom
.minidom
.parseString(document
)
21 def getText(nodelist
):
24 if node
.nodeType
== node
.TEXT_NODE
:
28 def handleSlideshow(slideshow
):
30 handleSlideshowTitle(slideshow
.getElementsByTagName("title")[0])
31 slides
= slideshow
.getElementsByTagName("slide")
36 def handleSlides(slides
):
40 def handleSlide(slide
):
41 handleSlideTitle(slide
.getElementsByTagName("title")[0])
42 handlePoints(slide
.getElementsByTagName("point"))
44 def handleSlideshowTitle(title
):
45 print "<title>%s</title>" % getText(title
.childNodes
)
47 def handleSlideTitle(title
):
48 print "<h2>%s</h2>" % getText(title
.childNodes
)
50 def handlePoints(points
):
56 def handlePoint(point
):
57 print "<li>%s</li>" % getText(point
.childNodes
)
59 def handleToc(slides
):
61 title
= slide
.getElementsByTagName("title")[0]
62 print "<p>%s</p>" % getText(title
.childNodes
)