Fix Feature TDI-18966: when setting optional on the input loop node, then the loop nodes can be unavailable in the source file.

http://jira.talendforge.org/browse/TDI-18966

git-svn-id: http://talendforge.org/svn/tos/trunk@80240 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
wliu
2012-03-21 11:07:21 +00:00
parent 44c0e87df5
commit bb69995bc7
2 changed files with 7 additions and 11 deletions

View File

@@ -52,8 +52,7 @@ public class DocumentToFlat {
if(this.isOptional && nodes.size() == 0 && !top) {
setParentAsLoop();
flat();
}
if (nodes !=null ) {
} else if (nodes !=null ) {
//reset relative paths
if(currentLoop != originalLoop) {//not point to the same string
for(int i=0;i<currentRelativePathMappings.length;i++) {
@@ -182,20 +181,17 @@ public class DocumentToFlat {
this.xpathToPatternMap = xpathToPatternMap;
}
public void flatForLookup() {
public void flatForLookup(boolean isOptionalLoop) {
XPath loopXpath = doc.createXPath(currentLoop);
loopXpath.setNamespaceURIs(xmlNameSpaceMap);
nodes = loopXpath.selectNodes(doc);
if(isOptional && nodes.size() == 0 && !top) {
if(isOptionalLoop && nodes.size() == 0 && !top) {
setParentAsLoop();
flatForLookup();
}
if(currentLoop != originalLoop) {//not point to the same string
flatForLookup(isOptionalLoop);
} else if(currentLoop != originalLoop) {//not point to the same string
loopChanged = true;
reset();
}
}
private void reset() {