aspose file tools
The moose likes XML and Related Technologies and the fly likes Trouble adding unique elements Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Trouble adding unique elements" Watch "Trouble adding unique elements" New topic
Author

Trouble adding unique elements

Dan Grindstaff
Ranch Hand

Joined: Sep 24, 2006
Posts: 135
Hello, I am trying to add a group of elements that must be individually named. I have written the code below:


What I get for xml results is the exact number of fields I need but they are all named "ManufacturerPartNumber". Any help greatly appreciated. Thanks!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

You have a Field object. (A GoDataFeed.Fields.Field object to be specific.) You repeatedly call its setName() method. So presuming that setName does something like setting the value of a private "name" variable inside that object, at the end of all your posted code that "name" variable is going to have the value it was last given.

So my guess is that you should create a new Field object for each field, rather than trying to reuse a single Field object.
Dan Grindstaff
Ranch Hand

Joined: Sep 24, 2006
Posts: 135
Thank you very much! Problem resolved.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Trouble adding unique elements
 
Similar Threads
How I can edit 'java.util.Set' DynaValidatorForm form-property
how to convert a result set into a xml file
what is synthetic members in java
Are you man enough to answer this question?
server side javascript and Mouseover?