Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Updated Solution - using the schema solution that we were debating. This gets you to your answer:</p> <p>Sample Schema:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Sport" xmlns:tns="http://www.example.org/Sport" elementFormDefault="qualified" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"&gt; &lt;complexType name="sportType"&gt; &lt;attribute name="type" type="string" /&gt; &lt;attribute name="gender" type="string" /&gt; &lt;/complexType&gt; &lt;element name="sports"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="sport" minOccurs="0" maxOccurs="unbounded" type="tns:sportType" /&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; </code></pre> <p></p> <p>Code Generated</p> <p>SportType:</p> <pre><code>package org.example.sport; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "sportType") public class SportType { @XmlAttribute protected String type; @XmlAttribute protected String gender; public String getType() { return type; } public void setType(String value) { this.type = value; } public String getGender() { return gender; } public void setGender(String value) { this.gender = value; } } </code></pre> <p>Sports:</p> <pre><code>package org.example.sport; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "sport" }) @XmlRootElement(name = "sports") public class Sports { protected List&lt;SportType&gt; sport; public List&lt;SportType&gt; getSport() { if (sport == null) { sport = new ArrayList&lt;SportType&gt;(); } return this.sport; } } </code></pre> <p>Output class files are produced by running xjc against the schema on the command line</p>
    singulars
    1. This table or related slice is empty.
    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. 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.
 

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