Here's a DTD to go along with the relaxng schema. The DTD is less restrictive, but still provides basic validation.<div><br></div><div>This would go along with a DOCTYPE definition on the protocol document. Perhaps something like this:</div>
<div><br></div><div><div><!DOCTYPE protocol PUBLIC "-//freedesktop//DTD Wayland 1.0//EN" "<a href="http://wayland.freedesktop.org/wayland-1.0.dtd">http://wayland.freedesktop.org/wayland-1.0.dtd</a>"></div>
<div><br></div><div>-Jeremy</div><br><div class="gmail_quote">On Thu, Jan 27, 2011 at 1:28 PM, Casey Dahlin <span dir="ltr"><<a href="mailto:cdahlin@redhat.com">cdahlin@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Jan 27, 2011 at 11:35:17AM -0500, Jeremy Volkman wrote:<br>
> Sure. xmllint, which comes with libxml2 (libxml2-utils in Ubuntu), supports<br>
> RELAX NG these days.<br>
><br>
> scout:protocol jvolkman$ xmllint --noout --relaxng schema.xml wayland.xml<br>
> wayland.xml validates<br>
><br>
> -Jeremy<br>
><br>
<br>
</div>The only issue is there's no way to link a relaxng schema from the file,<br>
so there's no sure path to find the documentation given the file itself.<br>
I think a DTD in addition to the schema would solve that.<br>
<br>
--CJD<br>
<div><div></div><div class="h5"><br>
> 2011/1/27 Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>><br>
><br>
> > On Wed, Jan 26, 2011 at 5:09 PM, Jeremy Volkman <<a href="mailto:jvolkman@gmail.com">jvolkman@gmail.com</a>><br>
> > wrote:<br>
> > > Here's my stab at a Wayland schema written in RELAX NG. It can be<br>
> > converted<br>
> > > to a W3C schema if preferred, but RELAX NG provides more functionality.<br>
> > For<br>
> > > example, the schema is able to require an "interface" attribute for an<br>
> > > argument only if the argument type is "object" or "new_id".<br>
> > > -Jeremy<br>
> ><br>
> > Is there a tool that can verify the protocol against the schema?<br>
> ><br>
> > Kristian<br>
> ><br>
> > > 2011/1/26 Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>><br>
> > >><br>
> > >> 2011/1/26 Casey Dahlin <<a href="mailto:cdahlin@redhat.com">cdahlin@redhat.com</a>>:<br>
> > >> > On Wed, Jan 26, 2011 at 01:40:25PM -0500, Kristian Høgsberg wrote:<br>
> > >> >> 2011/1/26 Josh Leverette <<a href="mailto:coder543@gmail.com">coder543@gmail.com</a>>:<br>
> > >> >> > I'm not certain, but I think there could eventually be enough<br>
> > >> >> > variation for that to be needed. However, even if there isn't,<br>
> > parsing an<br>
> > >> >> > XML file might be a better long term solution that weakly linked<br>
> > functions<br>
> > >> >> > and things like that. Perhaps we could modify his idea about an XML<br>
> > profile<br>
> > >> >> > structure to allow you to delve into each supported profile and<br>
> > find out<br>
> > >> >> > more about what it supports without having to hard code acceptable<br>
> > version<br>
> > >> >> > numbers into a program. The only problem I foresee is how to modify<br>
> > the XML<br>
> > >> >> > file. It's not going to be the end user's job.. but if any program<br>
> > could<br>
> > >> >> > modify it there needs to be a fallback system to prevent a rogue<br>
> > program<br>
> > >> >> > from deleting other profile advertisements written in by the system<br>
> > or other<br>
> > >> >> > programs.<br>
> > >> >><br>
> > >> >> The XML file isn't used at runtime. It's just a convenient mechanism<br>
> > >> >> to describe the interface. The way it works is that a client<br>
> > connects<br>
> > >> >> to the server and the server will then advertise all the global<br>
> > >> >> objects available by giving their object id, interface name and<br>
> > >> >> version. A client can then look through the list to see what's<br>
> > >> >> available and adjust its behaviour accordingly.<br>
> > >> >><br>
> > >> >> Kristian<br>
> > >> >><br>
> > >> ><br>
> > >> > Does the XML file have a particular schema?<br>
> > >> ><br>
> > >> > It might be useful to install it in /usr/share so it could be used by<br>
> > >> > tools. I'm thinking mostly of a d-feet style introspection tool for<br>
> > the<br>
> > >> > Wayland protocol (we could even go as far as dynamically adaptable<br>
> > >> > bindings for languages like Ruby or Python).<br>
> > >><br>
> > >> I didn't actually write a schema for it, but if somebody with the<br>
> > >> right XML-fu could do that that would be nice. It's a good point that<br>
> > >> dynamic languages probably just want to parse the XML directly and<br>
> > >> generate the bindings on the fly and for that we would need to install<br>
> > >> the XML. As for introspection/logging/xscope, that's built into the<br>
> > >> server side library: set WAYLAND_DEBUG=1 and watch the requests and<br>
> > >> events fly by.<br>
> > >><br>
> > >> Kristian<br>
> > >> _______________________________________________<br>
> > >> wayland-devel mailing list<br>
> > >> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> > >> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > wayland-devel mailing list<br>
> > > <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> > > <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
> > ><br>
> > ><br>
> ><br>
<br>
> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>