[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] XRC format schema
From: |
Vaclav Slavik |
Subject: |
[lmi] XRC format schema |
Date: |
Fri, 18 Oct 2013 17:32:05 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 |
Hi,
wxWidgets repository now contains RELAX NG schema for the XRC format,
which can be used to validate the resources. It is in the
$WXWIN/misc/schema/ directory (you can see it here:
http://trac.wxwidgets.org/browser/wxWidgets/trunk/misc/schema) and also
available at http://www.wxwidgets.org/wxxrc
wxrc integrates validation with --validate and --validate-only options,
but you'll probably be more interested in using Jing directly as is
already done in test_schemata.sh, because it's more flexible.
In particular, the schema was designed to be easy to extend with custom
controls. Adding support for InputSequenceEntry and RoundingButtons
controls used by LMI was very simple -- here's the entire schema needed
to validate LMI's resource files:
#
# RELAX NG schema for LMI's XRC files.
#
# Support for custom LMI-specific XRC handlers is included.
#
default namespace = "http://www.wxwidgets.org/wxxrc"
namespace xrc = "http://www.wxwidgets.org/wxxrc"
include "http://www.wxwidgets.org/wxxrc" {
customClasses = RoundingButtons | InputSequenceEntry
}
RoundingButtons =
element object {
attribute class { "RoundingButtons" } &
stdObjectNodeAttributes &
stdWindowProperties
}
InputSequenceEntry =
element object {
attribute class { "InputSequenceEntry" } &
stdObjectNodeAttributes &
stdWindowProperties &
[xrc:p="o"] element title {_, t_text }*
}
Even thought LMI's files validate with stock wxWidgets schema as well,
it wouldn't catch any errors in user-defined content such as the two
classes above. By extending the schema like this, we can run strict
validation on everything.
The schema has already proven its worth, I'll post a patch in separate
email.
Regards,
Vaclav
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi] XRC format schema,
Vaclav Slavik <=