From c0257aba9bae0687d21e48ef463b4bae783de747 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 28 Jul 2011 11:14:26 +0000 Subject: [PATCH] accepts description subelement within map entry as well (as per the XSD; SPR-8563) --- .../factory/xml/BeanDefinitionParserDelegate.java | 9 ++++++--- .../beans/factory/xml/collections.xml | 12 ++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java index bf96dd93518..9a80487e075 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1176,7 +1176,10 @@ public class BeanDefinitionParserDelegate { } else { // Child element is what we're looking for. - if (valueEle != null) { + if (nodeNameEquals(candidateEle, DESCRIPTION_ELEMENT)) { + // the element is a -> ignore it + } + else if (valueEle != null) { error(" element must not contain more than one value sub-element", entryEle); } else { @@ -1422,7 +1425,7 @@ public class BeanDefinitionParserDelegate { /** * Determine whether the name of the supplied node is equal to the supplied name. *

The default implementation checks the supplied desired name against both - * {@link Node#getNodeName()) and {@link Node#getLocalName()}. + * {@link Node#getNodeName()} and {@link Node#getLocalName()}. *

Subclasses may override the default implementation to provide a different * mechanism for comparing node names. * @param node the node to compare diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml index 33d2f20698b..9d772d3fd54 100644 --- a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collections.xml @@ -155,6 +155,18 @@ + + + + + + A map entry with a description + v1 + + + + +