Thanks Radu, it works now !!!!
On Wed, 30 Aug 2006 Radu Preotiuc-Pietro wrote :
>First, let me assume that your Schema declares "AbstractClass" as the
>substitutionGroup for "classA" and "classB" and not "AbstractElement"
>like stated in your message. Then, you would write the following code:
>
> RootDocument doc = RootDocument.Factory.newInstance();
> RootDocument.Root root = doc.addNewRoot();
> XmlObject xmlObject = root.addNewAbstractClass();
> xmlObject = xmlObject.substitute(
> ClassADocument.type.getDocumentElementName(),
> ClassAType.type);
> // You can now add stuff to xmlObject
>
>Now the "doc" object will contain the document in the format you want.
>
>The idea is that you need to use the method .substitute() to create a
>document that uses substitution groups. XmlBeans doesn't look at the
>fact that the element is abstract or that it has substitutions but
>instead uses the simpler rule that "you need to call .substitute() if
>you want to enable substitutions".
>
>Radu
>
>
>Hi,
>
>Need some help in solving problems of abstract types. I have the
>following elements:
>
><xs:element name="Root">
><xs:complexType>
><xs:sequence>
><xs:element ref="AbstractClass"/>
></xs:sequence>
></xs:complexType>
></xs:element>
>
><element name="AbstractClass" abstract="true">
>
><element name="classA" type="ClassAType"
>substitutionGroup="AbstractElement">
>
><element name="classB" type="ClassBType"
>substitutionGroup="AbstractElement">
>
>I need an output XML of the form
>
><root>
><classA>...........</classA>
></root>
>
>but i get the following:
>
><root>
><AbstractClass>
><classA>...........</classA>
></AbstractClass>
></root>
>
>In the java code i have the following options
>
>a) root.addNewAbstractClass();
>b) root.setAbstractClass(XmlObject xmlObject);
>
>I want to get only the implementation of the "AbstractClass" as the
>sub-element of the "Root" element, how is it possible to achieve this.
>
>Thanks in advance,
>
>Cheers,
>Satish
>
>_______________________________________________________________________
>Notice: This email message, together with any attachments, may contain
>information of BEA Systems, Inc., its subsidiaries and affiliated
>entities, that may be confidential, proprietary, copyrighted and/or
>legally privileged, and is intended solely for the use of the individual
>or entity named in this message. If you are not the intended recipient,
>and have received this message in error, please immediately return this
>by email and then delete it.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
- Abstract Types Satish Kumar
- RE: Abstract Types Radu Preotiuc-Pietro
- Re: RE: Abstract Types Satish Kumar

