You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jason Berk <jb...@purduefed.com> on 2011/09/12 19:50:35 UTC

Using "get" after "set"

I need to do something like this:

BookDoc booksDoc = BooksDoc.Factory.parse(xml, validationOptions);
Book book = bookDoc.getBook();
for (Author author:book.getAuthors()) {
	book.setMyCustomNumber(5);
	// how do I "save" this so the save method below gets a book
object where the myCustomNumber field is set?
}
bookDao.save(book.getAuthors());  //book.getAuthors() is returning books
without a custom number

what do I need to do so get()'s return the values I just set()....

is this even possible?

Jason

This is a transmission from Purdue Federal Credit Union (Purdue Federal) and is intended solely for its authorized recipient(s), and may contain information that is confidential and or legally privileged. If you are not an addressee, or the employee or agent responsible for delivering it to an addressee, you are hereby notified that any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this transmission in error, please notify us by telephoning (765)497-3328 or returning the email. You are then instructed to delete the information from your computer. Thank you for your cooperation.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Using "get" after "set"

Posted by Cezar Andrei <ce...@oracle.com>.
Jason,

If you're schema contains 'myCustomNumber' element that your Book class
should have get/add/set methods for it and you just use them
accordingly.

If it doesn't you can still add it, it's a little more complicated, you
need to use the XmlCursor interface. See following link for how to use
XmlCursors:
http://xmlbeans.apache.org/docs/2.0.0/guide/conNavigatingXMLwithCursors.html .

Cezar

On Mon, 2011-09-12 at 13:50 -0400, Jason Berk wrote:
> I need to do something like this:
> 
> BookDoc booksDoc = BooksDoc.Factory.parse(xml, validationOptions);
> Book book = bookDoc.getBook();
> for (Author author:book.getAuthors()) {
> 	book.setMyCustomNumber(5);
> 	// how do I "save" this so the save method below gets a book
> object where the myCustomNumber field is set?
> }
> bookDao.save(book.getAuthors());  //book.getAuthors() is returning books
> without a custom number
> 
> what do I need to do so get()'s return the values I just set()....
> 
> is this even possible?
> 
> Jason
> 
> This is a transmission from Purdue Federal Credit Union (Purdue Federal) and is intended solely for its authorized recipient(s), and may contain information that is confidential and or legally privileged. If you are not an addressee, or the employee or agent responsible for delivering it to an addressee, you are hereby notified that any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this transmission in error, please notify us by telephoning (765)497-3328 or returning the email. You are then instructed to delete the information from your computer. Thank you for your cooperation.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org