Hi,

  I am trying to implement an abstract element. The abstract element
looks like:
-------------------------------------------------
<xs:element name="class" type="xs:string"
substitutionGroup="rules:abstractClass"/>
  :
  :
<xs:element name="abstractClass" type="xs:anyType" abstract="true"/>
--------------------------------------------------
And my implementation is:

<xs:element name = "root">
           <xs:complexType>
               <xs:sequence maxOccurs="unbounded">
                  <xs:element ref = "a:abstractClass"/>
                </xs:sequence>
           </xs:complexType>
        </xs:element>
        
        <xs:element name="Cat" substitutionGroup="a:abstractClass">
                <xs:complexType>
                        
                                        <xs:attribute name="kittyName"
type="xs:string" />
                                        <xs:attribute name="age"
type="xs:int" />
                                        <xs:attribute name="weight"
type="xs:int" />
                        
             </xs:complexType>
        </xs:element>
-----------------------------------------------------
  Then in the main code, I try to add a Cat to parameter, but run into
problems:

  XmlObject class0 = parameter.addNewAbstractClass();
        Cat meow1 = (Cat)class0.changeType(Cat.type);
        meow1.setAge(2);
        meow1.setWeight(10);
        meow1.setKittyName("mimi");
          
  I want to addNewCat to parameter ... but the above way doesn't work.
Should I use "substitute" instead of "changeType" ? If so, how to use
"substitute"? or any other way to addNewCat to "parameter" ? Thanks!




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to