cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CXF-2699) MapType does not output XML that matches the generated schema
Date Thu, 18 Mar 2010 17:20:27 GMT

     [ https://issues.apache.org/jira/browse/CXF-2699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Kulp updated CXF-2699:
-----------------------------

    Assignee: Daniel Kulp
     Summary: MapType does not output XML that matches the generated schema  (was: MapType
does not set value to nillable)

> MapType does not output XML that matches the generated schema
> -------------------------------------------------------------
>
>                 Key: CXF-2699
>                 URL: https://issues.apache.org/jira/browse/CXF-2699
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.2.6
>         Environment: windows xp, java 5
>            Reporter: alistair
>            Assignee: Daniel Kulp
>             Fix For: 2.2.7
>
>
> The MapType class (in org.apache.cxf.aegis.type.collection) creates the schema element
for maps. It does not set nillable for the value in the entry.
> It is legal to have 
> HashMap<String, Object> myMap containing {myKey->null} and to return such a
map from a call to a web method. 
> The following wsdl is generated : 
> ...
> <xsd:element name="myMap" nillable="true" type="string2anyTypeMap" /> 
> ...
> <xsd:complexType name="string2anyTypeMap"> 
> <xsd:sequence> 
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="entry"> 
> <xsd:complexType> 
> <xsd:sequence> 
> <xsd:element minOccurs="0" name="key" type="xsd:string" /> 
> <xsd:element minOccurs="0" name="value" type="xsd:anyType" /> 
> </xsd:sequence> 
> </xsd:complexType> 
> On a query that retrieves myMap I can get 
> ...
>    <entry>
>                            <key>myKey</key>
>                            <value ns6:nil="true" xmlns:ns6="http://www.w3.org/2001/XMLSchema-instance"/>
>    </ns1:entry>
> which does not conform to the generated schema.
> In type MapType createElement should probably be renamed to createKeyElement and a new
createValueElement method that sets nillable to the result of type.isNillable().
> Current method:
>   /**
>      * Creates a element in a sequence for the key type and the value type.
>      */
>     private void createElement(XmlSchemaSequence seq, QName name, Type type) {
>         XmlSchemaElement element = new XmlSchemaElement();
>         seq.getItems().add(element);
>         element.setName(name.getLocalPart());
>         element.setSchemaTypeName(type.getSchemaType());
>         element.setMinOccurs(0);
>         element.setMaxOccurs(1);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message