Hi all,

I am new to XmlBeans and when trying it, I found something ambiguous.

For example, I have a schema like this (only a snippet):

<xs:complexType name="MessageId">
  <xs:sequence>
    <xs:element name="SystemId" type="xs:string"/>
    <xs:element name="SequenceNo" type="xs:string" />
  </xs:sequence>
</xs:complexType>

<xs:complexType name = "MessageHeader">
  <xs:sequence>
    <xs:element name = "MessageId" type="MessageId"/>
  </xs:sequence>
</xs:complexType>

<xs:element name="Message">
  <complexType>
    <sequence>
      <xs:element name="Header" type="MessageHeader"/>
      <xs:element name="Body" type="xs:anyType"/>
    </sequence>
  </complexType>
</element>

By using scomp, it generated MessageDocument.

When I use MessageDocument msgDoc = MessageDoucment.Factory.newInstance();
to get a new instance of MessageDocument for Xml composition, I found that
the Message inside is null when I use msgDoc.getMessage(); 

I need to do a addNewMessage() myself.  Same goes to Message->Header, and
Message->Header->MessageId.  However, the SystemId and SequenceNo in
MessageId is generated implicitly, and don't need to be added manually.

I'd like to know what is the rule of such generation of code? My wild guess
is, for complexType elements, it needs to add manually by calling addNewXxx,
while for simple type element, it will be generated implicitly (getXxx can
be called directly without addNew)

I searched the guide, tutorial and some other doucment but seems I cannot
find description on such rule, and I cannot clarify my guess.

By the way, I am using XmlBeans 2.0.0 beta1, with JDK 1.4

Thanks a lot for your help. 

Adrian


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

Reply via email to