[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: [relax-ng-comment] Regular expressions?
At 2002-02-10 14:56 -0600, J. David Eisenberg wrote: >I need to know how to specify a regular expression as a datatype for an >element content or attribute value. See below for an example using the non-XML syntax. >I'll be using jing as a validator, >and it appears to have a regex parser in it. I don't think jing does yet ... I've been successfully using MSV in my XML modelling course material to demonstrate the support of patterns. I'm *very* impressed with MSV. >(I also need this to validate an XML data file that I maintain; one of its >attribute values must be built from the letters KCJOW - in that order; the >Perl pattern would be m/K?C?J?O?W?/) I hope the example below helps. .................... Ken T:\ftemp>type david.rnx datatypes x = "http://www.w3.org/2001/XMLSchema-datatypes" start = element test { x:string { pattern = "K?C?J?O?W?" } } T:\ftemp>type david.xml <?xml version="1.0" encoding="iso-8859-1"?> <test>KCJW</test> T:\ftemp>type david2.xml <?xml version="1.0" encoding="iso-8859-1"?> <test>KJCW</test> T:\ftemp>rngnx david.rnx 1>david.rng T:\ftemp>call msv david.rng david.xml T:\ftemp>call msv david.rng david2.xml start parsing a grammar. validating david2.xml Error at line:2, column:18 of file:/T:/ftemp/david2.xml the value does not match the regular expression "K?C?J?O?W?". the document is NOT valid. T:\ftemp> -- Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO - Feb 18-22, 2002 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/r/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) ISBN 0-13-065196-6 Definitive XSLT & XPath ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-07-1 Practical Formatting Using XSLFO XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed), articles, training(instructor-live,Internet-live,web/CD,licensed) Next public training: 02-02-11,12,14,15,18,21,03-04,05,06,08,11, - 04-08,09,10,12,05-14,15,06-04,07
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC