[Libosinfo] [v3 1/3] rng: Allow template inclusion in install scripts

Christophe Fergeau cfergeau at redhat.com
Thu Feb 21 09:04:19 UTC 2013


On Wed, Feb 20, 2013 at 11:59:58PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> Sometimes we'll have a lot in common between rather long templates of
> different OSs. To be able to share the templates, we need a way to
> include templates from one XML file to another.
> 
> XInclude[1] is the way we achieve that.
> 
> http://www.w3.org/TR/xinclude/
> ---
>  data/schemas/libosinfo.rng | 27 ++++++++++++++++++---------
>  osinfo/osinfo_loader.c     |  9 +++++++++
>  2 files changed, 27 insertions(+), 9 deletions(-)
> 
> diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
> index 90b0dfb..5852652 100644
> --- a/data/schemas/libosinfo.rng
> +++ b/data/schemas/libosinfo.rng
> @@ -579,15 +579,24 @@
>              <ref name='bool'/>
>            </element>
>          </optional>
> -        <element name='template'>
> -          <choice>
> -            <group>
> -              <attribute name="uri"/>
> -              <empty/>
> -            </group>
> -            <ref name="customElement"/>
> -          </choice>
> -        </element>
> +        <choice>
> +          <element name='template'>
> +            <choice>
> +              <group>
> +                <attribute name="uri"/>
> +                <empty/>
> +              </group>
> +              <ref name="customElement"/>
> +            </choice>
> +          </element>
> +          <element name='xi:include' xmlns:xi="http://www.w3.org/2001/XInclude">
> +            <interleave>
> +              <attribute name="href"/>
> +              <attribute name="parse"/>
> +              <attribute name="xpointer"/>
> +            </interleave>
> +          </element>
> +        </choice>
>          <ref name='product-attr'/>
>          <ref name='product-rel'/>
>        </interleave>

Did you try
diff --git a/test/test-xml-validate b/test/test-xml-validate
index a2d20b4..9fb8534 100755
--- a/test/test-xml-validate
+++ b/test/test-xml-validate
@@ -16,7 +16,7 @@ do
   for xml in `echo "$XML" | sort`
   do
     n=`expr $n + 1`
-    cmd="xmllint --relaxng $SCHEMA --noout $xml"
+    cmd="xmllint --xinclude --relaxng $SCHEMA --noout $xml"
     result=`$cmd 2>&1`
     ret=$?

plus adding a call to xmlXIncludeProcessFlags in
tests/osinfo-db-validate.c:parse_file?
This would seem better to me as this would validates the document with the
XInclude substituted.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20130221/3d507eac/attachment.sig>


More information about the Libosinfo mailing list