Gentoo Archives: gentoo-dev

From: Michael Orlitzky <mjo@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New schema language for metadata validation?
Date: Wed, 27 Jan 2016 14:21:33
Message-Id: 56A8D25E.2080501@gentoo.org
In Reply to: Re: [gentoo-dev] New schema language for metadata validation? by Dirkjan Ochtman
1 On 01/27/2016 04:22 AM, Dirkjan Ochtman wrote:
2 > On Tue, Jan 26, 2016 at 9:52 PM, Michael Orlitzky <mjo@g.o> wrote:
3 >> I would appreciate examples of some common tasks like validating
4 >> projects.xml, but since we don't have those now, it's not critical.
5 >> This used to be kinda straightforward with xmllint,
6 >>
7 >> $ xmllint --valid --noout projects.xml && echo "OK"
8 >
9 > The closest equivalent for this is just:
10 >
11 > xmllint --relaxng metadata.rng --noout metadata.xml && echo "OK"
12 >
13
14 Ok, so basically the same situation we have now. You have to figure out
15 where to get the rng and supply it manually...
16
17
18 > I.e., you have to specify the schema file manually (also, as mentioned
19 > before, libxml2 does not support RNC natively, so you have to convert
20 > to RNG first -- but we can keep those around). You can use a non-HTTPS
21 > URL for --relaxng, as well.
22 >
23 > There is a standard to link an XML file to a RELAX NG (XML or compact
24 > syntax) schema, here:
25 >
26 > http://www.w3.org/TR/xml-model/
27
28 Nice! I was looking for this.
29
30
31 > But libxml2 does not seem to support it; that is, substituting the
32 > DOCTYPE for an xml-model processing instruction and then using xmllint
33 > --valid does not do the right thing (it complains there's no DOCTYPE).
34
35 But does it /complain/ about the xml-model? Is it safe to add that to
36 our XML files (in terms of tooling and stability of the spec)? If so, I
37 can at least script the validation: parse the href from xml-model, fetch
38 it somehow, run it through rnc2rng, and then pass it to xmllint.
39
40 Or we could even generate the rng files automatically and host them like
41 we do the DTDs to skip a step.

Replies

Subject Author
Re: [gentoo-dev] New schema language for metadata validation? Dirkjan Ochtman <djc@g.o>