Instead of

  book.setTitle(rs.getString("title"));

do

  TitleType title = book.addNewTitle();
  title.setStringValue(rs.getString("title"));

Then, if you want to set the "lost" attribute, you'll do:

  title.setLost(true);

Radu

On Thu, 2008-04-03 at 08:35 +0100, Andrew Mansfield wrote:
> Use the factory method.
>  
> Thanks,
> Andy
>         -----Original Message-----
>         From: Steven Crosley [mailto:[EMAIL PROTECTED]
>         Sent: 02 April 2008 21:55
>         To: user@xmlbeans.apache.org
>         Subject: How do I set a string element of a type object?
>         
>         
>         Hi, 
>         
>         
>         I'm trying to set an element value that is a complex type, but
>         I had to add an attribute to the element so I can no longer
>         call it like this:
>         
>         
>         book.setTitle(rs.getString("title"));
>         
>         
>         I now get this message:
>         
>         
>         The method setTitle(TitleType) in the type Book is 
>          not applicable for the arguments (String)
>         
>         
>         So, how do I convert the String to the TitleType object?
>         
>         
>         My XSD looks something like this:
>         
>         
>         <xs:element type="tns:titleType" name="title"/>
>         
>         
>         
>         
>            <xs:complexType name="titleType">
>              <xs:simpleContent>
>                <xs:extension base="xs:string">
>                  <xs:attribute type="xs:boolean" name="lost"/>
>                </xs:extension>
>              </xs:simpleContent>
>            </xs:complexType>  
>         
>         
>         
>         
>         Thanks,
>         Steven
>         
>         

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]

Reply via email to