[sane-devel] XML-Schema instead of DTD (was: SANE 1.1.0 Release discussion)
Volker Grabsch
vog at notjusthosting.com
Wed May 7 10:08:32 UTC 2008
On Tue, May 06, 2008 at 07:24:47PM +0200, Julien BLACHE wrote:
> Alessandro Zummo <azummo-lists at towertech.it> wrote:
>
> > that was the only part with a spec, the whole dtd/document/page model
> > yet has to be defined.
>
> Propose a standard DTD if you wish, but do not restrict the frame type
> to this DTD.
I strongly recommend to use XML-Schema instead of DTD.
XML-Schema may look more compicated, but the advantages are
really worth it. For example, all values have types, so you
can specify that some attribute must be a number in a certain
range, or that it must be a timestamp. You can also force it
to match a certain regular expression, or give an enumeration
of all allowed values (e.g. "yes", "no", "filenotfound" ;-)).
Or any combination of all this. For the structural description
XML-Schema has also some more possibilities that DTDs.
Using XML-Schema saves a /lot/ of hand-written validation
code, and it enables you to write really precise specs.
/libxml2/ has some very good and fast XML-Schema support.
I wrote some example code that shows how to do XML-Schema
validation with libxml2:
http://wiki.njh.eu/XML-Schema_validation_with_libxml2
Greets,
Volker
--
Volker Grabsch
---<<(())>>---
Administrator
NotJustHosting GbR
More information about the sane-devel
mailing list