• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Using SimpleXml, having issues with nested nesting collection within a collection

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted this on the Nabble forum that is of simpleXML, but since it is a mailing list it may take some time, so I thought Id post here in the hopes someone would be able to answer sooner...
Here is the post:

So I have my overall collection called MeasurementProjects, which is a collection:



and then MeasurementProject has different variables I declare as @Elements:




So this creates the XML you'd expect:



But I am needing to add a device @ElementList within each <measurementProject>, the XML should come out like this:




SO I started by adding a new variable to the MeasurementProject Class, so now in addition to @Element projectId and @Element name I have added:



Then I created a ProjectDevice class with only one variable @Element deviceId. It looks like this:



There are of course setters and getters for everything.

So now I have a class to set all these variables, and then add the xml to a web service:


Now I would expect this to create the following:




But instead I get:




So as you can see the ID and name are being set, but not the devices list. Here are the three involved classes if you want to spend the time going through it all, but hopefully someone can tell what Im doing wrong just from the above. Here it is:

------------------------------------------------------------------------------------------



------------------------------------------------------------------------------------------



------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------




------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------


maybe I need projectDevice to be @Element and not @Root but this doesnt seem to make sense really...

 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic