W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > May 2012

Extending p:log (action A-214-01)

From: Norman Walsh <ndw@nwalsh.com>
Date: Wed, 23 May 2012 06:51:18 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <m2fwargogp.fsf@nwalsh.com>
Good morning,

Here's a sketch for extending p:log. Change the content model as follows:

     port = NCName
     href? = anyURI>
     (p:assert | p:message)*

Where p:message is:

  <p:message> text </p:message>

and p:assert is:

    test = XPathExpression > text </p:assert>

Extend the semantics of p:log as follows: in addition to logging the
document, each p:message and p:assert is evaluated once for each document
in the order they appear as children of p:log.

A p:message simply outputs its text content as a message. That could be
to STDERR or to a dialog box or a log file, implementation defined.

A p:assert evaluates the effective boolean value of the test expression.
If the expression is true, nothing happens. If the expression is false,
the text content of the message is output per p:message and an exception
is raised. (Open question: should it be possible to catch that exception
in a p:try; probably.)

I think this would all be much more useful if it was possible to output
something about the state of the system. I propose that variable references
are interpolated in p:message/p:assert messages. We could go even further
and say that the text is an XPath expression, but that will be a little
weird as you'll have to quote strings and use concat a lot.

And, if we're going to interpolate variable references, I propose that
we define a few magic ones:

  $p:uri - the base URI of the document being logged
  $p:count - the number of the document being logged

Maybe more. We should probably think about what makes the most sense here,
expression or interpolation. I can see both sides, I think.

                                        Be seeing you,

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676

Received on Wednesday, 23 May 2012 10:51:48 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:50 UTC