Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
Already signed up?
New to KöMaL?

Problem I. 402. (April 2016)

I. 402. We regularly collect data in XML file format. To help generate well-formed and valid XML files, we include a sample XML file and an XML Schema file (XSD). The validity of the XML file can be verified with the XSD file. An online verification tool is found at http://www.utilities-online.info/xsdvalidation/.

This time however we accidentally deleted the XSD file and we only have the valid XML sample. Your program should reconstruct the XSD file as accurately as possible. For each element you should provide the name, type and—if necessary—the number of occurrences.

Data in the available XML file have at most 4 levels of nesting (this includes the root element). We know that complex types include only sequences, while elementary types include only the following: xs:integer, xs:decimal (for example, 12.34), xs:date (with format yyyy-mm-dd, for example, 2014-01-01) or xs:time (with format hh:mm:ss, for example, 10:30:00). Unrecognized types should be classified as xs:string. If an element appears multiple times, the maximum number of occurrences should be set to infinity; if there is a missing element, the minimum number of occurrences should be set to zero.

You will find some relevant information about this topic on the following pages (but it may be worth looking for some more sources):

  • http://www.inf.unideb.hu/~bodai/31-xml_alk/xmlSchemas.html;
  • http://soci.hu/articles/xml/XmlSema.pdf.

The input file is a well-formed XML file. The characters <, >, and / are only found in tags in the file. The output file should be an XSD file which displays a ``valid'' message for the XML file when using the form on the web page given in the first paragraph of this exercise. (The sample files can be downloaded from our web page.)

The first command-line argument of your program is the name of the input file, and the second argument is the name of the output file.

The source code and a short documentation of your program—containing a brief description of your solution, and the name of the developer environment to compile your code—should be submitted in a compressed file i402.zip.

Downloadable files: zenekar.xml, zenekar.xsd

(10 pont)

Deadline expired on May 10, 2016.


Statistics:

2 students sent a solution.
10 points:Kovács 246 Benedek.
8 points:1 student.

Problems in Information Technology of KöMaL, April 2016