W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2005

RE: Schema to express fixed length fields within a tag.

From: Michael Kay <mike@saxonica.com>
Date: Wed, 28 Sep 2005 09:31:44 +0100
To: "'kurt steele'" <kurtsteele@yahoo.com>, <xmlschema-dev@w3.org>
Message-ID: <E1EKXM4-0008A5-FU@maggie.w3.org>

> I have an XML document containing this set of fixed-length 
> within a tag:
> <?xml version="1.0"?> 
> <data>8.5  6.54 3.11 6.76 123.0</data>
> These are dew point readings from a sensor, each field is 5 
> bytes long. What would be a schema for this instance?  Can a 
> schema describe untagged data?

You can describe this as a space-separated list of decimals. You might also
be able to devise a pattern that constrains each decimal to occupy five
character positions (not bytes!) but I'm not sure I would bother.
> Right now I let this lite XML to flow over the wireless 
> connection then use XSL to generate a fully tagged document. 
> My schema describes the latter.  Can a reference to a 
> stylesheet be embededded in a schema such as to say, "apply 
> this transform to the data before validating"?

No, but you can write a schema-aware XSLT 2.0 stylesheet that invokes schema
validation on its output.

Michael Kay
Received on Wednesday, 28 September 2005 08:32:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:08 UTC