• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble adding unique elements

 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much! Problem resolved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic