COAP:COAP-2180/week7: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 42: Line 42:
Exchanger can validate the following kind of XML/XSD (as explained [http://edutechwiki.unige.ch/en/XSD_tutorial_-_Basics#Association_of_XSD_with_XML.2C_Solution_2 in the XSD tutorial])
Exchanger can validate the following kind of XML/XSD (as explained [http://edutechwiki.unige.ch/en/XSD_tutorial_-_Basics#Association_of_XSD_with_XML.2C_Solution_2 in the XSD tutorial])


XML file fragment
XML file fragment:
<source lang="XML">
<your_root
<your_root
   xmlns="http://myrecipes.org/"
   xmlns="http://myrecipes.org/"
Line 48: Line 49:
   xsi:schemaLocation="http://myrecipes.org/ recipe.xsd">
   xsi:schemaLocation="http://myrecipes.org/ recipe.xsd">
  ...
  ...
XSD fragment
<your_root>
</source>
XSD fragment:
<source lang="XML">
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://myrecipes.org/"  
    targetNamespace="http://myrecipes.org/"  
Line 54: Line 58:
    elementFormDefault="qualified">
    elementFormDefault="qualified">
   ...
   ...
</xs:schema>
</source>


* If you are not able to get this to work, then remove all DTD and Schema-related information from your XML and just tell Exchanger where to find the Schema file ...
If you are not able to get this to work, then you can try to remove all DTD and Schema-related information from your XML and just tell Exchanger where to find the Schema file when you hit the validation button.


To translated a DTD to an XSD, use Menu '''Schema->Convert Schema'''.
To translate a DTD to an XSD, use Menu '''Schema->Convert Schema'''.


'''Deadline and submission:'''
'''Deadline and submission:'''

Revision as of 01:03, 6 December 2010

Week 7 COAP 2180

Week seven includes three topics:

  1. XML Schema, a more powerful document type definition (gramar) language
  2. XSLT Q/R if necessary. Prepare questions for Friday
  3. Almost final touches to the term project. Each student should a have a good DTD by the end of the week !

WARNING/REMINDER

  • The Wednesday week 7 lesson is canceled. Make-up class is scheduled for next Friday (December 10) at 12.00h .

Teaching materials

Textbook chapters

  • Ray, Learning XML, Second Edition, Chapter 4, Quality Control with Schemas (ok explanation by example, but a bit too short)
  • Harold, XML in a Nutshell, Chapter 17, XML Schema (this text is not too easy to understand, but useful reading anyhow)
  • Harold, XML in a Nutshell, Chapter 22, Schemas reference (For reference, in particular for full-time CS students)

Classroom activities

  • Translate your "best" DTD to XSD
  • Start on hw7
  • Discuss term project

Homework 7

Task

  • Take the DTD from your term project or homework 4/5.
  • Create an XSD from the DTD
  • Add extra constraints that are appropriate with respect to your project. Typically you may constrain the number of child elements and add data types for element and/or attribute contents.

Tips:

  • Look at examples (includes ones that could be found on the Internet). e.g. you can google something like "XSD datatypes example"

Exchanger can validate the following kind of XML/XSD (as explained in the XSD tutorial)

XML file fragment:

<your_root
  xmlns="http://myrecipes.org/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://myrecipes.org/ recipe.xsd">
 ...
<your_root>

XSD fragment:

 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	    targetNamespace="http://myrecipes.org/" 
	    xmlns="http://myrecipes.org/" 
	    elementFormDefault="qualified">
  ...
 </xs:schema>

If you are not able to get this to work, then you can try to remove all DTD and Schema-related information from your XML and just tell Exchanger where to find the Schema file when you hit the validation button.

To translate a DTD to an XSD, use Menu Schema->Convert Schema.

Deadline and submission:

  • Monday week 8 (before start of class)
  • Use the world classroom: https://webster.blackboard.edu/
  • Submit the *.xsd, the *.xml test files, and an optional optional report file (see below)

Evaluation criteria (roughly)

Work considered as weak:

  • Pure translation without any extra hand editing

Work considered as minimalistic:

  • Minimal changes, e.g. a single extra constraint with respect to the number of child elements

Good work and excellent work (B to A-) may include one or several of the following:

  • Inserted comments in the XSD that explain some (not all) of the schema
  • A report (e.g. in HTML, word, PDF etc.)
  • All possible sorts of extra constraints you could reasonably use for your problem

Brilliant work (A)

  • Does all of the above, i.e. produces a result that could be used in real life.