[relaxng-user] FW: Jing & Trang errors when processing RNC grammar

Bob Foster bob at objfac.com
Tue Apr 27 19:34:44 ICT 2004


This fix removes the occurrence of oneOrMore//group//attribute by 
changing all the groups to choices. This certainly has pedagogic value 
and works in the sense that it gets rid of the error message, but one 
can't be sure it's what the author meant. Why is the platform attribute 
optional and the name attribute not? Both are optional in the revised 
version. It is possible the following would be a more faithful fix:

namespace rng = "http://relaxng.org/ns/structure/1.0"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

start = element ConfigRoot  { ConfigGroup* }

NamedElementAttributes =
    attribute name { text },
    attribute platform { text }?

StringValue = element StringValue { xsd:string }
IntValue = element IntValue { xsd:integer }
FloatValue = element FloatValue { xsd:float }
BooleanValue = element BooleanValue { xsd:boolean }
PrimitiveValue = (StringValue | IntValue | FloatValue | BooleanValue)

Map = element Map { (MapEntry)* }
MapEntry = element MapEntry { PrimitiveValue }
Array = element Array { (PrimitiveValue)* }

ConfigValue =  ( PrimitiveValue | Map | Array )

ConfigGroupEntry = (ConfigGroup |  ConfigValue)

ConfigGroup =  element ConfigGroup {
    ConfigGroupEntry*,
    NamedElementAttributes
}

Bob

MURATA Makoto (FAMILY Given) wrote:
 > This works.
 >
 > Cheers,
 >
 > Makoto
 >
 > 
-------------------------------------------------------------------------------------
 > namespace rng = "http://relaxng.org/ns/structure/1.0"
 > datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
 >
 > start = element ConfigRoot  { ConfigGroup* }
 >
 > NamedElementAttributes =
 >    attribute name { text } |
 >    attribute platform { text }?
 >
 > StringValue = element StringValue { xsd:string }
 > IntValue = element IntValue { xsd:integer }
 > FloatValue = element FloatValue { xsd:float }
 > BooleanValue = element BooleanValue { xsd:boolean }
 > PrimitiveValue = (StringValue | IntValue | FloatValue | BooleanValue)
 >
 > Map = element Map { (MapEntry)* }
 > MapEntry = element MapEntry { PrimitiveValue }
 > Array = element Array { (PrimitiveValue)* }
 >
 > ConfigValue =  ( PrimitiveValue | Map | Array ) | NamedElementAttributes
 >
 > ConfigGroupEntry = (ConfigGroup |  ConfigValue)
 >
 > ConfigGroup =  element ConfigGroup {
 >    ConfigGroupEntry*
 > }




More information about the relaxng-user mailing list