[Libosinfo] [v3 1/3] rng: Allow template inclusion in install scripts
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Tue Feb 26 15:42:46 UTC 2013
On Thu, Feb 21, 2013 at 11:04 AM, Christophe Fergeau
<cfergeau at redhat.com> wrote:
> 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.
Now I did and I get error:
................................!xmllint --xinclude --relaxng
/home/zeenix/checkout/gnome/libosinfo/test/../data/schemas/libosinfo.rng
--noout /home/zeenix/checkout/gnome/libosinfo/test/../data/install-scripts/windows-8-unattend.xml
windows-unattend.xml:20: element template: Relax-NG validity error :
Invalid attribute base for element template
windows-unattend.xml:245: element template: Relax-NG validity error :
Invalid attribute base for element template
/home/zeenix/checkout/gnome/libosinfo/test/../data/install-scripts/windows-8-unattend.xml
fails to validate
The 'base' attribute must be added by xmlXIncludeProcessFlags cause
its not originally there. I tried
XML_PARSE_NOBASEFIX flag with this call but that doesn't seem to help.
Here is the patch I tried: http://paste.fedoraproject.org/3837/
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124
More information about the Libosinfo
mailing list