0% found this document useful (0 votes)
32 views

Lab1 - Introduction XML

This document summarizes 5 exercises from a university computer science lab on introduction to XML. The exercises include: 1) creating an XML document with a person's name and professions, 2) modifying the document to use attributes, 3) checking well-formedness of XML documents and correcting errors, 4) identifying namespaces of attributes and elements in an XML document, and 5) correcting errors in a non-well-formed XML document and identifying namespaces.

Uploaded by

raniach
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Lab1 - Introduction XML

This document summarizes 5 exercises from a university computer science lab on introduction to XML. The exercises include: 1) creating an XML document with a person's name and professions, 2) modifying the document to use attributes, 3) checking well-formedness of XML documents and correcting errors, 4) identifying namespaces of attributes and elements in an XML document, and 5) correcting errors in a non-well-formed XML document and identifying namespaces.

Uploaded by

raniach
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

University of Laghouat Semi-Structured Data

Department of computer science academic year: 2023/2024


3rd year License Lab Exercise 1: introduction to XML

Exercise 1:
1. Give an xml document (by not using attributes), which includes the
information that the first name of a person is Lakhdar, his last name is
Kachna, and his professions are computer scientist, mathematician, and
cryptographer.
2. Modify the document given in question1, such the first and the last are
the attributes of the name element.

Exercise 2:
Create a well-formed XML document containing details of a car like: id,
company name, model, engine and mileage.

Exercise 3:
1. Check well-formedness property for the following XML document and
state the reasons in case of not well formed:

<?xml version="1.0"?>
<!-- this is a note -->
<note date=3 janvier>
<to>Bob</To>
<from>Alice</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<note date="january 5" <!-- this is another note --> >
<to>Alice</to>
<from>Bob
<body>No problem & see you soon</body>
</note>
<note />

2. Correct the following XML document to be well-formed (hint: use the XML
editor):

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


<movies>
<movie id=”56225”>
<title>Love Story</title>
<title></title>
<year>1980</year>
<_director name='Coppola'></_director>
<comment text="Five start” text=”Average"/>
<xml>Introduce XML content</xml>
<newcomment text="An <important> text">Oscar</newcomment>
<comment lang=de>&copy; 1980 Warner Bros.</comment>
<!-- Famous movie of the --80s -->
</Movie>
</movies>

-1-
University of Laghouat Semi-Structured Data
Department of computer science academic year: 2023/2024
3rd year License Lab Exercise 1: introduction to XML
Exercise 4: Given the XML document below, What are the namespaces of
each attribute and element:

<category xmlns="http://macollection.com">
<name >
Category <em xmlns="http://www.w3.org/1999/xhtml">A</em>
</name>
<category>
<name >B</name>
<category xmlns:xhtml="http://www.w3.org/1999/xhtml">
<name ><xhtml:em >C</xhtml:em></name>
</category>
</category>
<coll:category xmlns="http://www.w3.org/1999/xhtml"
xmlns:coll="http://macollection.com">
<coll:name ><b >D</b></coll:name>
<category >
<coll:name >E</coll:name>
</category>
</coll:category>
</category>

Exercise 5 :
1. Correct the mistakes in the following (not well-formed) XML document:
<?xml version="1.0"?>
<?DOCTYPE "eth" SYSTEM "eth.dtd"?>
<eth xmlns="http://www.ethz.ch"
xmlns:xmldb="http://www.dbis.ethz.ch"
date="11.11.2006"
xmldb:date="12.11.2006">
<date>13.11.2006</date>
<president number="1">Empty<president>
<Rektor>Name 2</rektor>
</Doc>

2. What are the namespaces of each attribute and element?

-2-

You might also like