Re: [Simple-support] Reading a list of elements
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-08-02 09:46:28
|
@ElementList(name = "Content", required = true, inline = true) will work, the inline attribute is needed.
--- On Mon, 1/8/11, Courtney, Phil <Phi...@sr...> wrote:
From: Courtney, Phil <Phi...@sr...>
Subject: [Simple-support] Reading a list of elements
To: sim...@li...
Received: Monday, 1 August, 2011, 11:14 AM
I am in the process of converting from JAXB generated classes (which we have used on workstations and servers) to Simple for use in an Android application (since JAXB is not supported on Android). I have tried to follow the tutorial for Reading a list of elements. An excerpt of the document’s root element is below: @Root@Order( elements = { "providerInformation", "contents", "constraints", "dependencies", "installableComponents", "configurationInformation", "maintenanceInformation", "modificationInformation", "uninstallInformation"})public class SolutionPackageDeploymentType extends UniversallyIdentifiedType{ … @Element(name = "Contents", required = true) protected ContentsType contents; …} The ContentsType class with an ElementList is below: @Rootpublic class ContentsType { @ElementList(name = "Content", required = true) protected
List<ContentType> content; public List<ContentType> getContent() { if (content == null) { content = new ArrayList<ContentType>(); } return this.content; }} An excerpt of the Content class for the element contained in the list is below: @Rootpublic class ContentType { @Attribute(required = true) protected String uuid; @Attribute(required = true) protected String pathName; @Attribute(required = true) protected String purpose; @Attribute(required = false) protected BigInteger length; @Attribute(required = false) protected String digestMethod; @Attribute(required = false) protected String digestValue; …} An excerpt of the example XML is below: <spd:SolutionPackageDeployment … xsi:schemaLocation="http://www.sra.com/rtapp/spdd SolutionPackageDeploymentV0.xsd"
xmlns:spd="http://www.sra.com/rtapp/spdd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> … <spd:Contents> <spd:Content uuid="34d00b71-ba29-11e0-962b-0800200c9a66" purpose="DATA_FILE" pathName="F1"/> <spd:Content uuid="34d00b72-ba29-11e0-962b-0800200c9a66" purpose="DATA_FILE" pathName="F2"/> </spd:Contents> …</spd:SolutionPackageDeployment> When I attempt to read the XML document, I get the following error message: Element 'Content' declared twice at line 10 Any suggestions on how to resolve the error would be greatly appreciated.Phil
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|