On 9/11/2015 20:39 , Auke Booij wrote:
On 6 November 2015 at 11:26, Pekka Paalanen <ppaala...@gmail.com> wrote:
On Fri, 6 Nov 2015 09:47:03 +1000
Peter Hutterer <peter.hutte...@who-t.net> wrote:

On Thu, Nov 05, 2015 at 04:58:09PM +0200, Pekka Paalanen wrote:
On Mon, 19 Oct 2015 11:30:47 +1000
Peter Hutterer <peter.hutte...@who-t.net> wrote:

On Fri, Oct 16, 2015 at 11:42:21AM +0300, Pekka Paalanen wrote:

If the original objection to a DTD was because it required manually
writing a lint phase in every project build system using the XML files,
then having wayland-scanner invoke the check automatically solves that.

the question that remains though is: the dtd must be an external file for
extensions to be validated. Which means we need to either pass the dtd as
argument to the scanner (requires makefile changes everywhere), or we
hardcode the path into wayland-scanner (issues with running the scanner from
within the source tree) or we add it as variable to pkgconfig (requires
makefile changes again). any other solutions to fix this are welcome.
even if all we do is call out to xmllint we still run into that issue.

Or, hopefully we can embed the DTD file into the scanner binary - is
there no way to let libxml2 read it as a plain string?

yep, just tested it here, it's a 3-line change to the patch to load from a
string.

Cool.

I used the following trick to embed some files in Wesgr:
https://github.com/ppaalanen/wesgr/commit/02a840cb7db7eeb80071a353f66865d729738ae5

nice one. though if we're going for the embedded route anyway, we could just
have it a const char in the scanner.c file. The dtd isn't really expected to
change and when it does, the scanner needs to change too. Maybe we should
just go for the easy route?

I'll let you pick the way. Should be easy to change it later if needed anyway.

Would it be bad if wayland-scanner embedded the DTD and in addition we
installed the DTD as a file too? So scanner used only its internal
copy. I'd probably try that if someone wants the DTD as a separate file
for their own use. In that case the trick would be handy.


Thanks,
pq

That sounds like the scanner will become confusing to use ("wait, so
where DOES it get the DTD from, if not this file?"), unless you'd
actually read the source code. Or this should be very clearly
documented.

commenting in the code - sure. but communicating this to the user isn't needed IMO, it's not really different to the normal scanner behaviour of failing when there's something it doesn't expect (though unfortunately right now the scanner also ignores things where IMO it should just fail).

Cheers,
  Peter
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to