6

I get an error at 4th line saying: cvc-complex-type.2.4.d: Invalid content was found starting with element 'map'. No child element is expected at this point.

  <util:map id="entirePayTypesMap">
            <entry key="34">
                <value>
                    <map>
                         <entry key="default">
                              <value>
                                 <map  key-type="java.lang.Boolean">
                                     <entry key="true" value="3T" />
                                     <entry key="false" value="3U" />
                                 </map> 
                              </value>
                         </entry>
                     </map> 
                </value>
            </entry>
    </util:map> 

Any suggestions?

2 Answers 2

11

For complex value types, do not nest the map element, instead use value-ref attributes. By default, value elements only accept String values.

The property may be a string, or may be converted to the required type using the JavaBeans PropertyEditor machinery. This makes it possible for application developers to write custom PropertyEditor implementations that can convert strings to arbitrary target objects.

Note that this is recommended for simple objects only. Configure more complex objects by populating JavaBean properties with references to other beans.

Your data will look something like:

<util:map id="mapA" key-type="java.lang.Boolean">
    <entry key="true" value="3T" />
    <entry key="false" value="3U" />
</util:map>
<util:map id="map1">
    <entry key="default" value-ref="mapA"/>
</util:map>

<util:map id="mapB" key-type="java.lang.Boolean">
    <entry key="true" value="4T" />
    <entry key="false" value="4U" />
</util:map>
<util:map id="map2">
    <entry key="default" value-ref="mapB"/>
</util:map>

<util:map id="entirePayTypesMap">
    <entry key="34" value-ref="map1"/>
    <entry key="35" value-ref="map2"/>
</util:map>
Sign up to request clarification or add additional context in comments.

Comments

2
<util:map id="map1" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.util.HashMap">

<entry key="" value-ref="map2">

</util:map>



<util:map id="map2" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.util.HashMap">

<entry key="" value-ref="map3">

</util:map>



<util:map id="map3" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.Boolean">

<entry key="" value="">

</util:map>

1 Comment

Not possible. The value will be the same when true for all map2 entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.