<br><tt><font size=2>Daniel Veillard <veillard@redhat.com> wrote
on 04/06/2010 09:10:11 AM:<br>
<br>
</font></tt>
<br><tt><font size=2>> <br>
> Please respond to veillard</font></tt>
<br><tt><font size=2>> <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 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.</font></tt>
<br>
<br><tt><font size=2>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. </font></tt>
<br><tt><font size=2>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.</font></tt>
<br>
<br><tt><font size=2><br>
> <br>
> [...]<br>
> > Index: libvirt-acl/docs/schemas/domain.rng<br>
> > ===================================================================<br>
> > --- libvirt-acl.orig/docs/schemas/domain.rng<br>
> > +++ libvirt-acl/docs/schemas/domain.rng<br>
> > @@ -894,6 +894,11 @@<br>
> > <optional><br>
> > <ref name="address"/><br>
> > </optional><br>
> > + <optional><br>
> > + <element name="filterref"><br>
> > + <ref name="filterref-node-attributes"/><br>
> > + </element><br>
> > + </optional><br>
> > </interleave><br>
> > </define><br>
> > <!--
> @@ -1577,6 +1582,22 @@<br>
> > </element><br>
> > </define><br>
> > <br>
> > + <define name="filterref-node-attributes"><br>
> > + <attribute name="filter"><br>
> > + <data type="NCName"/><br>
> > + </attribute><br>
> > + <optional><br>
> > + <element name="parameter"><br>
> > + <attribute name="name"><br>
> > + <ref name="parameter-name"/><br>
> > + </attribute><br>
> > + <attribute name="value"><br>
> > + <ref name="parameter-value"/><br>
> > + </attribute><br>
> > + </element><br>
> > + </optional><br>
> > + </define><br>
> > +<br>
> > <!--
> Type library<br>
> > <br>
> > @@ -1737,4 +1758,14 @@<br>
> > <param name="pattern">[a-zA-Z0-9_\.\+\-/]+</param><br>
> > </data><br>
> > </define><br>
> > + <define name="parameter-name"><br>
> > + <data type="string"><br>
> > + <param name="pattern">[a-zA-Z0-9_]+</param><br>
> > + </data><br>
> > + </define><br>
> > + <define name="parameter-value"><br>
> > + <data type="string"><br>
> > + <param name="pattern">[a-zA-Z0-9_\.:]+</param><br>
> > + </data><br>
> > + </define><br>
> > </grammar><br>
> <br>
> I just find parameter-name/parameter-value a bit too generic names,<br>
> if you could make them more specific to the task, like<br>
> filter-param-name / filter-param-value<br>
> <br>
> but it's minor, and it's good to have updated schema and augmented<br>
> testing</font></tt>
<br>
<br><tt><font size=2>Ok, so I will rename those two to the names you suggest.
Should I post again before pushing it to the repository?</font></tt>
<br>
<br><tt><font size=2> Stefan</font></tt>
<br>
<br><tt><font size=2><br>
> <br>
> ACK<br>
> <br>
> Daniel<br>
> <br>
> -- <br>
> Daniel Veillard | libxml Gnome XML XSLT toolkit
</font></tt><a href=http://xmlsoft.org/><tt><font size=2>http://xmlsoft.org/</font></tt></a><tt><font size=2><br>
> daniel@veillard.com | Rpmfind RPM search engine </font></tt><a href=http://rpmfind.net/><tt><font size=2>http://rpmfind.net/</font></tt></a><tt><font size=2><br>
> </font></tt><a href=http://veillard.com/><tt><font size=2>http://veillard.com/</font></tt></a><tt><font size=2>
| virtualization library </font></tt><a href=http://libvirt.org/><tt><font size=2>http://libvirt.org/</font></tt></a><tt><font size=2><br>
</font></tt>