

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in org.apache.xmlbeans.userRe: RE: Abstract Types| From | Sent On | Attachments |
|---|---|---|
| Radu Preotiuc-Pietro | Aug 30, 2006 9:32 am | |
| Satish Kumar | Aug 31, 2006 12:50 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: RE: Abstract Types | Actions... |
|---|---|---|
| From: | Satish Kumar (sati...@rediffmail.com) | |
| Date: | Aug 31, 2006 12:50:04 am | |
| List: | org.apache.xmlbeans.user | |
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.







