Hi Stéphane,

Le vendredi 02 décembre 2005 à 14:51 +0100, Stephane Bortzmeyer a
écrit :
> I'm trying to write a schema for XML-RPC
> (http://www.xml-rpc.com/). This protocol has been specified a long
> time ago, at the dawn of XML and is described only in natural
> language. An attempt have been made to "reverse specify" it with DTD
> or XSD
> (http://www.cafeconleche.org/books/xmljava/chapters/ch02s05.html). I
> try with RelaxNG.
> 
> My main concern is with the <fault>. A fault has two components,
> faultCode and faultString. They are not elements but values with
> constraints :-(
> 
> I try to:
> 
> stringval = element string {text} 
> integer = element i4 {xsd:int} | element int {xsd:int} 
> 
> fault = element fault {faultvalue}
> faultvalue = element value {faultstruct}
> faultstruct = element struct {faultcode & faultstring}
> faultcode = element member {element name {"faultCode"} &
>                             element value {integer}}
> faultstring = element member {element name {"faultString"} &
>                               element value {stringval | text}}
> 
> But (after translation by trang) this is refused by xsltproc:
> 
> schema.rng:157: element interleave: Relax-NG parser error : Element or text 
> conflicts in interleave

The error message given by Jing is more meaningful:

"E overlapping element names in operands of "interleave""

This is describe in the section called "Limitations on interleave" of my
book:

http://books.xmlschemata.org/relaxng/relax-CHP-15-SECT-2.html#relax-CHP-15-SECT-2.6
 

> I have to change the definition of faultstruct to:
> 
> faultstruct = element struct {faultcode, faultstring}
> 
> to keep it happy. But now, I force faultCode to appear before
> faultString, which is not in the specification.

In fact, if I understand what you want to achieve, you want either
faultcode followed by faultstring or faultstring followed by
faultcode...

Since the number of combinations is limited, you can write:

faultstruct = element struct { (faultcode, faultstring) | (faultstring, 
faultcode) }

That should keep everyone happy :-) ...

> Now, I understand that my schema is non-deterministic but isn't it
> allowed by RelaxNG?

Yes, it is but some restrictions have been introduced to the interleave
pattern to avoid that validation times grow exponentially with some
expressions...

Hope this helps.

Eric
> 
-- 
Carnet web :
           http://eric.van-der-vlist.com/blog?t=category&a=Fran%C3%A7ais
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------



------------------------ Yahoo! Groups Sponsor --------------------~--> 
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/2U_rlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/rng-users/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to