Validation error

Shaun McCance <shaunm at gnome.org>
Wed Feb 22 14:16:09 EST 2017

On Tue, 2017-02-21 at 21:59 +0100, Sascha Manns wrote:
> Hello Shaun,
> 
> Am Dienstag, den 21.02.2017, 12:32 -0500 schrieb Shaun McCance:
> > On Sat, 2017-02-18 at 14:07 +0100, Sascha Manns wrote:
> > > 
> > > Hello list,
> > > 
> > > i have prepared a Mallard file like that one: http://pastebin.com
> > > /dy9
> > > jig2j .
> > > 
> > > The problem is, if i'm using yelp-check validate ThatPage.page
> > > i'm
> > > getting:
> > > 
> > > 
> > > sascha at sascha-desktop:~/RiderProjects/PublicanCreators/help/C$
> > > yelp-
> > > check validate app-config.page 
> > > app-config.page:2: element page: Relax-NG validity error :
> > > Expecting
> > > a namespace for element page
> > > app-config.page fails to validate
> > Short answer: Change xmlns:mal= to just xmlns= on line 2.
> > 
> > Explanation: XML namespaces are funny things. When you declare a
> > namespace prefix with xmlns:mal, you are binding the prefix "mal"
> > to a
> > namespace, so that any element you write like mal:link uses that
> > namespace. But elements without prefixes are still in the default
> > namespace.
> > 
> > To set the default namespace, you use just xmlns, not xmlns: with a
> > prefix. This allows you to write elements without prefixes that are
> > still in a namespace.
> > 
> > You could, if you wanted, just use xmlns:mal, and then write out
> > all
> > your elements names as mal:page, mal:info, mal:p, etc. But that
> > would
> > get pretty tiresome.
> The remove of mal fixes that validation error.
> Currently i'm getting just that issue:
> 
> sascha at sascha-desktop:~/RiderProjects/PublicanCreators/help/C$ yelp-
> check validate app-config.page 
> app-config.page:3: element page: Relax-NG validity error : Expecting
> element title, got info
> app-config.page:3: element page: Relax-NG validity error : Element
> page failed to validate content
> 
> A example page is that one: https://github.com/saigkill/PublicanCreat
> ors/blob/master/help/C/builder.page .
> 
> As far as i know it expects <title> before <info>. But in the
> documentation under "Another guide" is it written so.

So, a few things:

* <title> comes after <info>, if there's an <info>.

* "Expecting element title, got info" is one of the most infuriatingly
common unhelpful error messages from yelp-check. If you get that error,
it means that something somewhere inside <info> is wrong. The error is
dumb because of the way libxml2 does RNG validation.

* In builder.page, the page is missing a <title> element.

* You need to write <homepage> and <license> with the doap namespace
prefix, <doap:homepage> and <doap:license>.

* There is no <copyright> element in Mallard. You record copyrights
with the <credit> element, like this:

<credit type="copyright">
  <name>Sascha Manns</name>
  <years>2017</years>
</credit>

Note that you can put multiple strings in the type attribute, so you
can stop typing so much and just write this:

<credit type="author editor copyright">
  <name>Sascha Manns</name>
  <email>Sascha.Manns at mailbox.org</email>
  <years>2017</years>
</credit>

--
Shaun