users@jaxb.java.net

xml - java: not generating setters for <xs:element> complex types

From: infinity2heaven <infinity2heaven_at_gmail.com>
Date: Tue, 8 Dec 2009 10:43:36 -0800 (PST)

Here's my schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
        <xs:complexType name="type-property">
                <xs:attribute name="name" type="xs:string" use="required"/>
                <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
        <xs:simpleType name="type-mime-type">
                <xs:restriction base="xs:string">
                        <xs:enumeration value="text/plain"/>
                        <xs:enumeration value="text/html"/>
                        <xs:enumeration value="text/xml"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:complexType name="type-content">
                <xs:simpleContent>
                        <xs:extension base="xs:string">
                                <xs:attribute name="mime-type" type="type-mime-type"/>
                        </xs:extension>
                </xs:simpleContent>
        </xs:complexType>
        <xs:complexType name="type-content-item">
                <xs:sequence>
                        <xs:element name="property" type="type-property" minOccurs="0"
maxOccurs="unbounded"/>
                        <xs:element name="content" type="type-content"/>
                </xs:sequence>
                <xs:attribute name="id" type="xs:string" use="required"/>
                <!-- Shared content or "widget" id. -->
        </xs:complexType>

        <xs:element name="page">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="property" type="type-property" minOccurs="0"
maxOccurs="unbounded"/>
                                <xs:element name="content-item" type="type-content-item" minOccurs="0"
maxOccurs="unbounded"/>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:string" use="required"/>
                        <!-- Shared page id. -->
                </xs:complexType>
        </xs:element>
</xs:schema>

When I generate jaxb representations, the java classes do not have a setters
generated for any xs:element type. In the example above, I get

class Page {
     id
     contentItem
     Property

    getId()
    setId()
    getContentItem()
    getProperty()

}

Is there anything I need to do to generate setters by default?

Also, how do I change the default name for a collection to end with an "s".
In the example above, I'd like to have contentItems instead of contentItem.
-- 
View this message in context: http://old.nabble.com/xml---java%3A-not-generating-setters-for-%3Cxs%3Aelement%3E-complex-types-tp26698648p26698648.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.