“well-formed” XML document instances obey the constraints of well-formedness like:
<img align=top>
)“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.zip offers a solution.
xml2xml_solution.zip contains an Eclipse project based reference implementation.
book2Html_solution.zip contains an Eclipse project based reference implementation.
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.
saxmemo2html_solution.zip contains an Eclipse project based reference implementation.
jdomtable_solution.zip contains a Maven reference implementation.
XmlSchema2RdbmsSchema.zip contains a reference implementation.
rdbmsStudents2xml_solution.zip contains an Eclipse project based reference implementation.