XML, XSD (JAXB, SAX, DOM, STAX)
Reading Materials
Exercise:
We want to be able to read program parameters from an XML file instead
of getting it from the user (through the console).
And we want to print the run results to an XML file.
·
We shall
implement this functionality in 3 different ways: DOM, SAX, JAXB.
o 3 different classes should be created for the 3
methods.
·
The writing
will be performed through JAXB only.
·
An example
for an input file is given in the end of this document (this is only an
example. You may choose a different format).
·
Add a
validation option with XSD of the XML. You will write the XSD.
Emphasis:
·
Read about
the xjc command. What can it do?
·
The classes
should implement interfaces. This should improve flexibility and allow
integration in our code
XML configuration
example:
<ProcessSettings>
<Algorithm>DoubleShiftUp</Algorithm>
<KeyPath>c:\temp\encryptor</KeyPath>
<SourceDirectory>c:\temp\encryptor\source</SourceDirectory>
<SourceFileName>c:\temp\encryptor\file.txt</SourceFileName>
</ProcessSettings>
No comments:
Post a Comment