fix Bug TDI-18475: tXMLMap can not manage transformationof two independence xml file.

git-svn-id: http://talendforge.org/svn/tos/trunk@75362 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
wwang
2011-12-27 06:06:06 +00:00
parent 0405fb26de
commit f033309e64
2 changed files with 23 additions and 21 deletions

View File

@@ -66,26 +66,28 @@ public class Document {
for (org.dom4j.tree.AbstractNode node : nodes) {
boolean reject = false;
// lookup action
for (String xpath : lookupInfo.keySet()) {
Object lookupValue = lookupInfo.get(xpath);
org.dom4j.XPath xpathObjectForLookup = node.createXPath(xpath);
xpathObjectForLookup.setNamespaceURIs(nsMapping);
Node nodeOfLookup = xpathObjectForLookup.selectSingleNode(node);
//parse action
String text = (nodeOfLookup == null ? null : xpathObjectForLookup.valueOf(node));
String pattern = xpathToPatternMap.get(xpath);
String javaType = xpathToTypeMap.get(xpath);
Object value = ParserUtils.parse(text, javaType, pattern);
if(lookupValue == null && value == null) {
//do nothing(null==null)
} else {
if(value == null || !value.equals(lookupValue)) {
reject = true;
break;
}
}
if(!"ALL_ROWS".equals(matchingMode)) {
for (String xpath : lookupInfo.keySet()) {
Object lookupValue = lookupInfo.get(xpath);
org.dom4j.XPath xpathObjectForLookup = node.createXPath(xpath);
xpathObjectForLookup.setNamespaceURIs(nsMapping);
Node nodeOfLookup = xpathObjectForLookup.selectSingleNode(node);
//parse action
String text = (nodeOfLookup == null ? null : xpathObjectForLookup.valueOf(node));
String pattern = xpathToPatternMap.get(xpath);
String javaType = xpathToTypeMap.get(xpath);
Object value = ParserUtils.parse(text, javaType, pattern);
if(lookupValue == null && value == null) {
//do nothing(null==null)
} else {
if(value == null || !value.equals(lookupValue)) {
reject = true;
break;
}
}
}
}
// generate result action
if (reject) {