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