when i am setting movingwindow flag on nested iterators the 2nd getNextIterator is throwing error saying it should be only true when iterating on nodes. :shock:
Ex: xml structure is like xmltag1->xmltag2. Passing tag1’s iterable node to tag2’s getNextIterator causes this error.
Does any one have faced this situation and resolved it? :roll:
Hi Vijay,
Are you talking about “pub.xml:getXMLNodeIterator” service.
If so,then I think you no need to pass movingWindow values.If you have more then one node then pass criteria.Then use “pub.xml:getNextXMLNode” in some repeated step to get the next node.
Please let us know if you face any difficulty in implementing the same or you can pass your exact xml structure.
The file is huge and cannnot attach, I can give a sample example as below
<rootnode>
<nodeparent>
<parentname>ParentOfNode_1_2</parentname>
<childnode>
<name>Node 1</name>
<price>100</price>
</childnode>
<childnode>
<name>Node 2</name>
<price>23</price>
</childnode>
</nodeparent>
<nodeparent>
<parentname>ParentOfNode_3_4</parentname>
<childnode>
<name>Node 3</name>
<price>100</price>
</childnode>
<childnode>
<name>Node 4</name>
<price>23</price>
</childnode>
</nodeparent>
<childnode>
<name>Node 5</name>
<price>4353</price>
</childnode>
<childnode>
<name>Node 6</name>
<price>23.4</price>
</childnode>
<childnode>
<name>Node 7</name>
<price>12.4</price>
<resources>
<resource type="test">This will be in the output</resource>
<resource type="test1">This won't be in the output</resource>
</resources>
</childnode>
</rootnode>
As can be seen above, the nodeparent tag is repeating and I want to iterate on this and subsequently get the iterator of childnode under it and process each childnode individually.
However for the service getXMLNodeIterator if I give criteria nodeparent and childnode then it loads all “childnode” under each “nodeparent” while iterating on nodeparent, which doesn’t make sense as I am telling to iterate on childnode also but it loads all childnode at once while iterating on nodeparent. So I have to explicitly get each iterator one by one by calling getXMLNodeIterator twice using parent child relationship.
During the first call of getXMLNodeIterator with criteria nodeparent and movingWindow to true, I get first node of this iterator and pass it to get the second iterator with criteria childnode and movingWindow set to true again then it throws an error saying that this flag can only be used once.
The file is huge and cannnot attach, I can give a sample example as below
<rootnode>
<nodeparent>
<parentname>ParentOfNode_1_2</parentname>
<childnode>
<name>Node 1</name>
<price>100</price>
</childnode>
<childnode>
<name>Node 2</name>
<price>23</price>
</childnode>
</nodeparent>
<nodeparent>
<parentname>ParentOfNode_3_4</parentname>
<childnode>
<name>Node 3</name>
<price>100</price>
</childnode>
<childnode>
<name>Node 4</name>
<price>23</price>
</childnode>
</nodeparent>
<childnode>
<name>Node 5</name>
<price>4353</price>
</childnode>
<childnode>
<name>Node 6</name>
<price>23.4</price>
</childnode>
<childnode>
<name>Node 7</name>
<price>12.4</price>
<resources>
<resource type="test">This will be in the output</resource>
<resource type="test1">This won't be in the output</resource>
</resources>
</childnode>
</rootnode>
As can be seen above, the nodeparent tag is repeating and I want to iterate on this and subsequently get the iterator of childnode under it and process each childnode individually.
However for the service getXMLNodeIterator if I give criteria nodeparent and childnode then it loads all “childnode” under each “nodeparent” while iterating on nodeparent, which doesn’t make sense as I am telling to iterate on childnode also but it loads all childnode at once while iterating on nodeparent. So I have to explicitly get each iterator one by one by calling getXMLNodeIterator twice using parent child relationship.
During the first call of getXMLNodeIterator with criteria nodeparent and movingWindow to true, I get first node of this iterator and pass it to get the second iterator with criteria childnode and movingWindow set to true again then it throws an error saying that this flag can only be used once.
The file is huge and cannnot attach, I can give a sample example as below
<rootnode>
<nodeparent>
<parentname>ParentOfNode_1_2</parentname>
<childnode>
<name>Node 1</name>
<price>100</price>
</childnode>
<childnode>
<name>Node 2</name>
<price>23</price>
</childnode>
</nodeparent>
<nodeparent>
<parentname>ParentOfNode_3_4</parentname>
<childnode>
<name>Node 3</name>
<price>100</price>
</childnode>
<childnode>
<name>Node 4</name>
<price>23</price>
</childnode>
</nodeparent>
<childnode>
<name>Node 5</name>
<price>4353</price>
</childnode>
<childnode>
<name>Node 6</name>
<price>23.4</price>
</childnode>
<childnode>
<name>Node 7</name>
<price>12.4</price>
<resources>
<resource type="test">This will be in the output</resource>
<resource type="test1">This won't be in the output</resource>
</resources>
</childnode>
</rootnode>
As can be seen above, the nodeparent tag is repeating and I want to iterate on this and subsequently get the iterator of childnode under it and process each childnode individually.
However for the service getXMLNodeIterator if I give criteria nodeparent and childnode then it loads all “childnode” under each “nodeparent” while iterating on nodeparent, which doesn’t make sense as I am telling to iterate on childnode also but it loads all childnode at once while iterating on nodeparent. So I have to explicitly get each iterator one by one by calling getXMLNodeIterator twice using parent child relationship.
During the first call of getXMLNodeIterator with criteria nodeparent and movingWindow to true, I get first node of this iterator and pass it to get the second iterator with criteria childnode and movingWindow set to true again then it throws an error saying that this flag can only be used once.
It’s just a sample file to explain abt the issue . Don’t worry too much about the semantics of the file. If you really could solve the issue email me the code to kalyan.cdev@gmail.com I will take a look at it.
Thanks for sharing the code…the 3 steps just after the first branch will consume memory and will not work in my case. I have attached the scrshot for ur reference.