====== XML ====== * [[http://www.w3schools.com/xml/xml_whatis.asp|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. Jan Kowalski
Krakow
Zbigniew Nowak
Wadowice
* 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? ===== DTD vs. XSD ===== * First read these two articles about: * [[http://www.w3schools.com/dtd/default.asp|DTD]] \\ and * [[http://www.w3schools.com/schema/default.asp|XSD]] * Choose one of these two validation methods and go to the appropriate section: [[#DTD]] or [[#XSD]] ==== DTD ==== * Using text editor, try to define a DTD definition for your XML syntax. * You can define DTD definition inside XML file: \\ XML content * Test your XML against defined DTD using [[http://www.xmlvalidation.com/index.php|online validator]] - **it requires embedded DTD**. \\ or * 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 ==== XSD ==== * Using text editor, try to define a XSD definition for your XML syntax. * Test your XML against defined XSD using: * [[http://tools.decisionsoft.com/schemaValidate|XSD online validator]] \\ or * [[http://www.xmlme.com/Validator.aspx|XML Schema Validator]] \\ or * using //xmlstarlet// command: xmlstarlet -e -s file.xsd file.xml ===== XPath ===== * [[http://www.w3schools.com/xpath/default.asp|Read the w3school article about XPath]] * Go to [[http://www.xmlme.com/XpathTool.aspx|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. ===== Summary ===== * 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? ===== Uwagi ===== * brak elementarnego wprwadzenia * brak linków - materiałów * brak choć jednego przykładu step-by-step ===== Komentarze ===== Z braku lepszego miejsca tutaj studenci wpisują komentarze natury ogólnej do tego lab. 8-)