* @param resourceNode 代表resource信息的XML Node
* @return resource的值
* @throws ResourceBundleCreateException 解析错误
*/
protected Object getMapResource(String id, Node resourceNode) throws ResourceBundleCreateException {
ListMap map = new ArrayHashMap();
for (Iterator i = resourceNode.selectNodes(ResourceBundleConstant.XPATH_RESOURCES).iterator(); i.hasNext(); ) {
Node mapItemNode = (Node) i.next();
Object mapKey = mapItemNode.selectObject(ResourceBundleConstant.XPATH_RESOURCE_ID);
if (map.containsKey(id)) {
throw new ResourceBundleCreateException(ResourceBundleConstant.RB_DUPLICATED_MAP_RESOURCE_KEY,
new Object[] { mapKey, id }, null);
}
String mapItemType = mapItemNode.getName();
Object value = null;
if (ResourceBundleConstant.RB_RESOURCE_TYPE_MESSAGE.equals(mapItemType)) {
value = getMessageResource(id, mapItemNode);
} else if (ResourceBundleConstant.RB_RESOURCE_TYPE_MAP.equals(mapItemType)) {
value = getMapResource(id, mapItemNode);
} else if (ResourceBundleConstant.RB_RESOURCE_TYPE_LIST.equals(mapItemType)) {
value = getListResource(id, mapItemNode);
}
map.put(mapKey, value);
}
return Collections.unmodifiableMap(map);
}