Daniel Veillard <veillard(a)redhat.com> wrote on 04/06/2010 11:40:02 AM:
Please respond to veillard
On Tue, Apr 06, 2010 at 09:21:50AM -0400, Stefan Berger wrote:
> Daniel Veillard <veillard(a)redhat.com> wrote on 04/06/2010 09:10:11 AM:
>
>
> >
> > Please respond to veillard
> >
> > On Mon, Apr 05, 2010 at 12:53:19PM -0400, Stefan Berger wrote:
> > > This patch adds a relaxng nwfilter schema along with a test that
> > > verifies all the test output XML against the schema. The input
XMLs
> > > contain a lot of intentional out-of-range values that
make them
fail
> the
> > > schema verification, so I am not verifying against those.
> > >
> > > Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
> > > Signed-off-by: Gerhard Stenzel <gerhard.stenzel(a)de.ibm.com>
> > >
> > > ---
> > > docs/schemas/Makefile.am | 3
> > > docs/schemas/domain.rng | 31 +
> > > docs/schemas/nwfilter.rng | 783
> > > ++++++++++++++++++++++++++++++++++++++++++++++
> > > libvirt.spec.in | 1
> > > tests/Makefile.am | 4
> > > tests/nwfilterschematest | 11
> > > 6 files changed, 831 insertions(+), 2 deletions(-)
> > >
> > [...]
> > > + <define name="addrMAC">
> > > + <choice>
> > > + <!-- variable -->
> > > + <data type="string">
> > > + <param
name="pattern">[\\$]{1}[a-zA-Z0-9_]+</param>
> > > + </data>
> > > +
> > > + <data type="string">
> > > + <param
> > >
name="pattern">([a-fA-F0-9]{1,2}:){5}[a-fA-F0-9]{1,2}</param>
> > > + </data>
> > > + </choice>
> > > + </define>
> >
> > Hum, can you explain why you get apparently 2 completely different
> > format values ranges here (and in a number of other types), I'm a
bit
> > lost.
>
> Every item in the network filter xml can be a variable like $MAC or
$IP.
> So for the schema to validate a srcmacaddr="$MAC" I
needed to add the
> above 'variable' pattern.
Ah, okay, I understand now !
> I had a lot of problems finding a way to require a $ as first letter
and I
> ended up having to use the [\\$]{1} construct. Also I could not
find a
> switch for non-case-sensitive string comparison like other
regexes
have
> (?i) or \i for example... I suppose there is none.
right. We are using XML Schemas datatype here, and the regexps are
defined in this appendix
http://www.w3.org/TR/xmlschema-2/#regexs
character $ has no special meaning in XML so doesn't need any escaping
http://www.w3.org/TR/xmlschema-2/#nt-SingleCharEsc
<param name="pattern">$[a-zA-Z0-9_]+</param>
should just work fine I think, can you try ? If yes that's worth fixing
before the push :-)
My mistake. I could replace it everywhere and it works fine. I'll push
this fix.
- <param name="pattern">[\\$]{1}[a-zA-Z0-9_]+</param>
+ <param name="pattern">$[a-zA-Z0-9_]+</param>
Stefan