I have the following JAXB .xsd schema file:
  <?xml version="1.0" encoding="UTF-8"?>  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"         xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"         jaxb:version="2.1" xmlns="some.namespace.com"         targetNamespace="some.namespace.com">        <xs:element name="outerModel">          <xs:annotation>              <xs:appinfo>                  <jaxb:class name="OuterModelDto" />              </xs:appinfo>          </xs:annotation>          <xs:complexType>              <xs:sequence>                  <xs:element maxOccurs="unbounded" minOccurs="0" name="innerModel" type="innerModelDto" />              </xs:sequence>          </xs:complexType>      </xs:element>        <xs:complexType name="innerModelDto">          <xs:sequence>              <xs:element name="fullname" type="xs:string" />              <xs:element name="surname" type="xs:string" />          </xs:sequence>          <xs:attribute name="id" type="xs:string" use="required" />      </xs:complexType>  </xs:schema>      This will create an OuterModelDto and an InnerModelDto class. The OuterModelDto is annotated with @XmlRootElement, but the InnerModelDto is not. How can i ensure that InnerModelDto is also annotated with @XmlRootElement?
One solution was to wrap the innerModelDto complexType in an element, which meant that i did end up with @XmlRootElement on both Dtos, but during serialization of OuterModelDto, the namespace information was serialized, which i do not want.
No comments:
Post a Comment