Maybe this is a problem someone else has solved?

Is it just hopeless to expect reasonable results from this bastardized
mix of technologies?

I'm trying to allow a URI that references the centerpiece, or an in-line
definition of the centerpiece.

The rng to xml schema step via trang produces this type of structure

RNG 
----------------------------------------
        <choice>
            <element name="CenterpieceURI">
                <data type="anyURI"/>
            </element>
            <group>                
                <element name="Name">
                    <data type="token"/>
                </element>
                <!-- other elements here -->
            </group>
        </choice>
-------------------------------------------------

XMLSchema
__________________________________________________


    <xs:choice>
      <xs:element ref="CenterpieceURI"/>
      <xs:sequence>
        <xs:element name="Name" type="xs:token">
        </xs:element>
        <!-- other elements here -->
      </xs:sequence>
    </xs:choice>

___________________________________________________

which seems reasonable. But xsd.exe (the tool to generate c# code) wigs
out on this type of construct and makes me a nasty class containing an
object array and an unfortunately named enum, "ItemsElementName", to
build it (see below).

/me pukes

I've tried representing the original group as an interleave, but that
ends me up at the same place.
If I remove the choice I get a reasonable output.

Maybe this a problem with xsd.exe (i guess it is), but something tells
me microsoft is not going to care very much.  Anu suggestions?

Mono's xsd.exe just dies on this kind of input.

brad

C# code below:




   [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.42")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace="",
IsNullable=false)]
    public partial class AbstractCenterpiece {
        
        private object[] itemsField;
        
        private ItemsChoiceType2[] itemsElementNameField;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute("AbstractChannel",
typeof(AbstractChannel))]

[System.Xml.Serialization.XmlElementAttribute("CenterpieceReference",
typeof(string), DataType="anyURI")]
        [System.Xml.Serialization.XmlElementAttribute("CenterpieceURI",
typeof(string), DataType="anyURI")]
        [System.Xml.Serialization.XmlElementAttribute("LoadMethod",
typeof(LoadMethod))]
        [System.Xml.Serialization.XmlElementAttribute("MaterialName",
typeof(string), DataType="token")]

[System.Xml.Serialization.XmlElementAttribute("MaterialReference",
typeof(string), DataType="anyURI")]
        [System.Xml.Serialization.XmlElementAttribute("MaxRPM",
typeof(string), DataType="positiveInteger")]
        [System.Xml.Serialization.XmlElementAttribute("MmThick",
typeof(float))]
        [System.Xml.Serialization.XmlElementAttribute("Name",
typeof(string), DataType="token")]
        [System.Xml.Serialization.XmlElementAttribute("NumChannels",
typeof(string), DataType="positiveInteger")]

[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
        public object[] Items {
            get {
                return this.itemsField;
            }
            set {
                this.itemsField = value;
            }
        }



Reply via email to