0% found this document useful (0 votes)
68 views2 pages

Lab05 2024 Boustil DSS

This document discusses programming XML in Python. It introduces Python and provides exercises on using DOM, SAX and ElementTree to work with XML. It also describes a project to build a web application that searches an XML file for artist information and displays details about artists and their albums.

Uploaded by

specaccdz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views2 pages

Lab05 2024 Boustil DSS

This document discusses programming XML in Python. It introduces Python and provides exercises on using DOM, SAX and ElementTree to work with XML. It also describes a project to build a web application that searches an XML file for artist information and displays details about artists and their albums.

Uploaded by

specaccdz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Université de M’hamed Bouguerra Boumerdès

University of M'hamed Bouguerra Boumerdès


Faculty of Sciences - Department of Computer Science
Sector: L3 (ISIL+SI)
Year: 2023-2024
Module: DSS

Lab No. 5: XML in Python


Objective: Program XML in Python.
Noticed: Python.

Introduction to Python
• Write a function that checks if a number is prime and display the first 10 prime numbers.
• Create the dictionary dict={"nom":"firgani","ville":"annaba","site": "http://firgani.dz"}
• Create a list containing the keys of this dictionary.
• Create a list containing the values of this dictionary.
• Create a list containing the key-value pairs.
Exercise 1 (Python and DOM)

Using DOM, display the list of all artists, their cities, and their biographies.

Exercise 2 (Python and SAX)

Using Sax, display in an HTML page the list of all album titles and their release years.

Exercise 3 (Python and ElementTree)

<?xml version="1.0" encoding="UTF-8"?>


<graphe xmlns:xsl="http://www.graphe.org" nbs="3">
<sommet setiq="a01" marqué="oui"/>
<sommet setiq="b01" marqué="oui"/>
<sommet setiq="b02" marqué="non"/>
<arc sommet="a01" sbut="b01">
<aetiq>32</aetiq>
<cout>400</cout>
</arc>
<arc sommet="a01" sbut="b02" >
<aetiq>40</aetiq>
<cout>200</cout>
</arc>
<arc sommet="b01" sbut="b02" >
<aetiq>13</aetiq>
<cout>340</cout>
</arc>
</graphe>
Using the ElementTree API, write the code to display the sum of weights and the number of outgoing arcs
for vertices marked "yes":
Example
3 b01
destination nbre d'acrs somme poids
a01 2 43
3
b01 1 3 a01 40
b02
Part 2 of the project to be submitted

Description:
Develop an application Web in Python allowing users to search for information about musical artists and their
albums from a predefined XML file. The application should load data from the XML file, allow users to
search for artists by their name, display detailed information about the artist including their name, city of
origin, biography, and website (if available), display details of albums associated with the artist including
album title, release year, and list of songs.

Expected Features:
• Load data from an XML file containing information about artists and their albums.
• Allow users to search for an artist by their name.
• Display detailed information about the found artist, including their name, city of origin, biography, and
website (if available).
• Display details of albums associated with the artist, including the album title, release year, and list of
songs.
• Provide a simple command-line interface for user interaction.
• Allow the user to quit the application at any time.

Technical Constraints:
Use the ElementTree library for XML file processing.

You might also like