|
|
|
Makes perfect sense to me. Apllied a NPE aware trim in my local source copy, tests work fine.
Others: Any objections adding this to the codebase? We got same issue before, please note that adding trim only resolves the multiple line TextNode issue, CDATA is still an issue. Suggest to reference springframework's xml parser method:
protected String getTextValue(Element ele, String beanName) { StringBuffer value = new StringBuffer(); NodeList nl = ele.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node item = nl.item(i); if (item instanceof org.w3c.dom.CharacterData) { if (!(item instanceof Comment)) { value.append(item.getNodeValue()); } } else { throw new BeanDefinitionStoreException( this.resource, beanName, "<value> element is just allowed to have text and comment nodes, not: " + item.getClass().getName()); } } return value.toString(); } Makes sense to me. Rene, I think you can safely apply the fix.
./alex -- .w( the_mindstorm )p. Taking Quake's comment into account, I created a textvalue processing method based on the latest version of the described method in Spring (in DomUtils) , which is also responsible for trimming. Added testcase too..
We should have a look into our configuration processing, the said method could be valuable in other places too. Basically, it provides much better handling for character data nodes, ignoring xml comments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
String paramValue = paramElement.getFirstChild().getNodeValue();
We could and trim() method,
String paramValue = paramElement.getFirstChild().getNodeValue().trim();
to trim embracing white space around expression.