<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>FW: [relaxng-user] FW: Jing & Trang errors when processing RNC grammar</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: John Cowan [<A HREF="mailto:cowan@ccil.org">mailto:cowan@ccil.org</A>] </FONT>
<BR><FONT SIZE=2>Sent: Wednesday, 28 April 2004 12:35:pm</FONT>
<BR><FONT SIZE=2>To: Ben.Hutchison@sensis.com.au</FONT>
<BR><FONT SIZE=2>Subject: Re: [relaxng-user] FW: Jing & Trang errors when processing RNC</FONT>
<BR><FONT SIZE=2>grammar</FONT>
</P>
<BR>
<P><FONT SIZE=2>[If you don't mind, forward this to relaxng-user; it's rejecting my</FONT>
<BR><FONT SIZE=2>postings right now.]</FONT>
</P>
<P><FONT SIZE=2>Hutchison, Ben scripsit:</FONT>
</P>
<P><FONT SIZE=2>> I have developed a grammar by reading the RelaxNG tutorial, but when I</FONT>
<BR><FONT SIZE=2>> attempt to validate it using Jing (within OxygenXML) I get an brief error</FONT>
<BR><FONT SIZE=2>> message I cannot understand: E "oneOrMore" contains "group" contains</FONT>
<BR><FONT SIZE=2>> "attribute" </FONT>
</P>
<P><FONT SIZE=2>You bumped up against one of the few restrictions of RELAX NG: you can't</FONT>
<BR><FONT SIZE=2>have an iteration (either + or *, they produce the same message) that</FONT>
<BR><FONT SIZE=2>contains a sequence (or interleave, same thing in this case) of attributes.</FONT>
</P>
<P><FONT SIZE=2>What you have written is tantamount to requesting an attribute sequence</FONT>
<BR><FONT SIZE=2>like attribute foo, attribute bar, attribute foo, attribute bar ....</FONT>
<BR><FONT SIZE=2>be allowed. This makes no sense, given that there can only be one</FONT>
<BR><FONT SIZE=2>attribute of a given name in a given element.</FONT>
</P>
<P><FONT SIZE=2>Fortunately, the problem is easily cured by removing the first</FONT>
<BR><FONT SIZE=2>reference to NamedElementAttribute. </FONT>
</P>
<P><FONT SIZE=2>> When I use the inbuilt Trang tool, I can successfully convert the compact</FONT>
<BR><FONT SIZE=2>> grammar to XML form, but a conversion on to XML Schema results in a message</FONT>
<BR><FONT SIZE=2>> like "Choice between attributes and children cannot be presented;</FONT>
<BR><FONT SIZE=2>> approximating", but no schema object is produced.</FONT>
</P>
<P><FONT SIZE=2>You can't expect correct results when applying Trang to a schema that</FONT>
<BR><FONT SIZE=2>Jing rejects. The corrected version does convert to a plausible XSD schema.</FONT>
</P>
<P><FONT SIZE=2>> Any general advice on how to "debug" a RelexNG grammar would also be</FONT>
<BR><FONT SIZE=2>> appreciated.</FONT>
</P>
<P><FONT SIZE=2>Try to avoid creating sequences/interleaves that contain both attributes</FONT>
<BR><FONT SIZE=2>and data. They tend to be problematic.</FONT>
</P>
<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Work hard, John Cowan</FONT>
<BR><FONT SIZE=2>play hard, jcowan@reutershealth.com</FONT>
<BR><FONT SIZE=2>die young, <A HREF="http://www.reutershealth.com" TARGET="_blank">http://www.reutershealth.com</A></FONT>
<BR><FONT SIZE=2>rot quickly. <A HREF="http://www.ccil.org/~cowan" TARGET="_blank">http://www.ccil.org/~cowan</A></FONT>
</P>
</BODY>
</HTML><table><tr><td bgcolor=#ffffff><font color=#000000><pre>www.sensis.com.au
A leading Australian advertising, information
and directories business.
www.yellowpages.com.au
www.whitepages.com.au
www.citysearch.com.au
www.whereis.com.au
www.telstra.com.au
This email and any attachments are intended only for the use of the recipient and may be confidential and/or legally privileged.
Sensis Pty Ltd disclaims liability for any errors, omissions, viruses, loss and/or damage arising from using, opening or transmitting this email.
If you are not the intended recipient you must not use, interfere with, disclose, copy or retain this email and you should notify the sender immediately by return email or by contacting Sensis Pty Ltd by telephone on [+61 3 9201 4888]
</pre></font></td></tr></table>