Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have too many <code>XmlRootElements</code>, you generally want to use this with the top element only. What you want to do is label the children as <code>XmlElement</code>.</p> <p>Remove the <code>XmlRootElement</code> annotation from all but your root element (i.e. <code>RtSuperQuickMetadata</code>), and label them with <code>XmlElement</code> <em>in the class from which they will be loaded</em>.</p> <p>So, as an example, here is how your <code>RtSuperQuickMetadata</code> class should look:</p> <pre><code>@XmlRootElement(name = "contentFiles") class RtSuperQuickMetadata { private List&lt;RtSuperQuickMetadataItem&gt; rtSuperQuickMetadataItems; public RtSuperQuickMetadata() { rtSuperQuickMetadataItems = new ArrayList&lt;RtSuperQuickMetadataItem&gt;(); } @XmlElement(name = "contentFile") public List&lt;RtSuperQuickMetadataItem&gt; getRtSuperQuickMetadataItems() { return rtSuperQuickMetadataItems; } public void setRtSuperQuickMetadataItems( List&lt;RtSuperQuickMetadataItem&gt; rtSuperQuickMetadataItems) { this.rtSuperQuickMetadataItems = rtSuperQuickMetadataItems; } } </code></pre> <p>Transfer this principle to <code>alternateDocNumbers</code> and <code>citesAffected</code> as well.</p> <hr> <p>If you want to see an example of how the <code>Unmarshaller</code> thinks your XML is formatted based off your annotations, you can create your structure in code and use the <code>Marshaller</code>. Here is a quick and ugly example:</p> <pre><code>RtSuperQuickMetadata rtSuperQuickMetadata = new RtSuperQuickMetadata(); List&lt;RtSuperQuickMetadataItem&gt; rtSuperQuickMetadataItems = new ArrayList&lt;RtSuperQuickMetadataItem&gt;(); rtSuperQuickMetadata.setRtSuperQuickMetadataItems(rtSuperQuickMetadataItems); RtSuperQuickMetadataItem item = new RtSuperQuickMetadataItem(); rtSuperQuickMetadataItems.add(item); ArrayList&lt;Cite&gt; cites = new ArrayList&lt;Cite&gt;(); Cite cite = new Cite(); cite.setCiteStr("MyCite"); cites.add(cite); item.setCitesAffected(cites); Marshaller m = jaxbContext.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(rtSuperQuickMetadata, System.out); </code></pre> <p>This will output the result to <code>System.out</code>. You can put this in a file instead, whatever suits your needs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload