atom feed23 messages in org.oasis-open.lists.relax-ng-commentRE: [relax-ng-comment] Mixing pattern...
FromSent OnAttachments
Daniel PragerSep 26, 2002 7:48 pm 
Michael FitzgeraldSep 27, 2002 10:34 am 
Michael FitzgeraldSep 27, 2002 5:02 pm 
Michael FitzgeraldSep 28, 2002 11:31 pm 
Daniel PragerSep 29, 2002 6:41 pm 
Eddie RobertssonSep 29, 2002 7:16 pm 
Daniel PragerSep 29, 2002 8:37 pm 
Rick JelliffeSep 29, 2002 9:11 pm 
Daniel PragerSep 29, 2002 9:41 pm 
Rick JelliffeSep 30, 2002 2:04 am 
Yonekura KojiSep 30, 2002 3:28 am 
Robert KobergOct 7, 2002 11:05 am 
didier demanyOct 8, 2002 1:35 am 
Robert KobergOct 8, 2002 1:45 am 
Robert KobergOct 8, 2002 1:48 am 
Kohsuke KAWAGUCHIOct 8, 2002 6:32 am 
Robert KobergOct 9, 2002 11:50 am 
MURATA Makoto (FAMILY Given)Oct 9, 2002 5:26 pm 
Eddie RobertssonOct 14, 2002 4:24 pm 
Robert KobergDec 3, 2002 6:52 am 
Michael FitzgeraldDec 3, 2002 8:43 am 
James ClarkDec 3, 2002 8:57 pm 
Robert KobergDec 4, 2002 3:09 am 
Subject:RE: [relax-ng-comment] Mixing patterns and (empty) tags
From:Michael Fitzgerald (mi@wyeast.net)
Date:Sep 27, 2002 10:34:34 am
List:org.oasis-open.lists.relax-ng-comment

Hmmm. This is what I got.

C:\Rng\Examples>cat mixed.xml <?xml version="1.0"?> <example>The quick <a/> brown fox <b/> jumped over the lazy dog 5 times.<c/></example>

C:\Rng\Examples>cat mixed.rng <element name="example" xmlns="http://relaxng.org/ns/structure/1.0"> <interleave> <text/> <element name="a"><empty/></element> <element name="b"><empty/></element> <element name="c"><empty/></element> </interleave> </element>

C:\Rng\Examples>java -jar c:\lib\jing.jar mixed.rng mixed.xml

C:\Rng\Examples>java -jar c:\lib\msv.jar mixed.rng mixed.xml start parsing a grammar. validating mixed.xml the document is valid.

C:\Rng\Examples>

One problem I saw in your instance was that you probably intended </b> to be <b/>.

Hope it helps,

Mike

P.S. This also works. It's syntax sugar for <interleave><text/> pattern </interleave>

<element name="example" xmlns="http://relaxng.org/ns/structure/1.0"> <mixed> <element name="a"><empty/></element> <element name="b"><empty/></element> <element name="c"><empty/></element> </mixed> </element>

-----Original Message----- From: Daniel Prager [mailto:dani@deakin.edu.au] Sent: Thursday, September 26, 2002 7:48 PM To: relax-ng Subject: [relax-ng-comment] Mixing patterns and (empty) tags

How do you mix restricted text patterns with empty elements (used to represent escaped text)?

<example> The quick <a/> brown fox </b> <a/> jumped <c/> over the lazy dog 5 times. <c/> </example>

I've tried variants on

<element name="example"> <zeroOrMore> <choice> <list> <oneOrMore> <data type="token"> <param name="pattern">[a-zA-Z0-9]+</param> </data> </oneOrMore> </list>

<element name="a"> <empty/> </element> <element name="b"> <empty/> </element> <element name="c"> <empty/> </element> </zeroOrMore> </element>

and with <interleave>, but both MSV and Jing give cryptic error messages.

[ For extra gratitude can anyone tell me whether XSD can cope with this? ]

Thanks in advance

Phone: +61 3 9251 7484 Web: www.deakin.edu.au/~danielp