Test solutions

Test 3

Well-formed and valid

“well-formed” XML document instances obey the constraints of well-formedness like:

“valid” XML document instances are “well-formed” and in addition conform to a grammar being expressed as e.g. XML Schema, RelaxNG or DTD.

Doodle poll XML data

doodle.zip offers a solution.

Test 4

xml2xml_solution.zip contains an Eclipse project based reference implementation.

Test 5

book2Html_solution.zip contains an Eclipse project based reference implementation.

XML book instances

Test 6

Printing element names

The implemented method startElement has got wrong signature. According to the Java 1.7 API documentation startElement should have org.xml.sax.Attributes as its last argument. But in the given code the last argument is of type java.util.jar.Attributes. Hence the handler does not redefine the corresponding parent class method startElement but instead adds an overloaded method. At runtime the SAX parser will call the (dummy) method being defined in the parent class DefaultHandler thus completely ignoring the intended implementation.

Replacing import java.util.jar.Attributes by import org.xml.sax.Attributes solves the problem.

An @Override annotation would have flagged this apparent mistake as a Java compile time error.

SAX html creation (2 parts)

saxmemo2html_solution.zip contains an Eclipse project based reference implementation.

Test 7

Jdom tables, 2 parts

jdomtable_solution.zip contains a Maven reference implementation.

Test 8

XmlSchema2RdbmsSchema.zip contains a reference implementation.

Test 10

rdbmsStudents2xml_solution.zip contains an Eclipse project based reference implementation.