• Read the w3school article about XML and the try to answer the following questions:
  • What are the required elements of XML file?
  • Does the XML have any predefined tags?
  • Does the XML have any predefined entities?
  • How to define a comment?
  • Is the XML platform dependent?
  • What is a CDATA section in XML file?
  • What is the meaning of the colon within tag name?

Simple hierarchy

  • Using some text editor, define a relation that describes your faculty:
    • Your XML file should contain information about: name_of_the_faculty, group_id, id_of_the_starosts, firstname, lastname, date_of_birth (day, month, year) address, and more…
  • Try to use your own markup and hierarchy.
<faculty name="air">
    <group id="1" starosts="222222">
            <student id="222222">
            <student id="222223">
  • Define at least:
    • two different groups,
    • for each group define at least five members,
    • for each group define the id attribute that contains the id of the starosts.
  • Your file contains some structured information.
    Is it possible to change the structure of your XML into another, which contains the same information.
  • What is an empty element?


  • First read these two articles about:
  • Choose one of these two validation methods and go to the appropriate section: DTD or XSD


  • Using text editor, try to define a DTD definition for your XML syntax.
  • You can define DTD definition inside XML file:
    <?xml version="1.0" ?> 
    <!DOCTYPE root [
    XML content
  • Test your XML against defined DTD using online validator - it requires embedded DTD.
  • You can also test your XML using xmlstarlet command:
    Testing xml file against external DTD definition file use:
    xmlstarlet -e -d file.dtd file.xml

    or when you use embeded DTD definition use:

    xmlstarlet -e -E file.xml


  • Using text editor, try to define a XSD definition for your XML syntax.
  • Test your XML against defined XSD using:


  • Go to here
  • Using your XML try to:
    • find the lastnames of all students,
    • find all lastnames of members from your group,
    • find an address of the second member from your group,
    • find the all cities of all members,
    • find the all students which are older/younger than you,
    • find a lastname of your group starosts.


  • What is the DTD?
  • What is the XSD?
  • Which language (DTD or XSD) is more expressive?
  • What are the drawbacks of DTD in comparison with XSD?
  • How to define an empty element in DTD and XSD?
  • What is the XPath?
  • Does the XPath allow for nested queries?


  • brak elementarnego wprwadzenia
  • brak linków - materiałów
  • brak choć jednego przykładu step-by-step


Z braku lepszego miejsca tutaj studenci wpisują komentarze natury ogólnej do tego lab. 8-)

pl/dydaktyka/piw/2010/sw/xml.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0