Java - Mutually function calls

Commayday

New Member
I am using LibGDX lightweight \[code\]XmlReader\[/code\] class for parsing xml template. The xml template is something like below: \[code\]<A TYPE="0" > <ANGLE VALUE="http://stackoverflow.com/questions/14523253/50" FRAME="0"/> <B HANDLE_X="0" HANDLE_Y="0"> <C VALUE="http://stackoverflow.com/questions/14523253/0" FRAME="0"/> <D VALUE="http://stackoverflow.com/questions/14523253/30" FRAME="0"/> <A TYPE="0"> <ANGLE VALUE="http://stackoverflow.com/questions/14523253/0" FRAME="0"/> <B HANDLE_X="61" HANDLE_Y="121"> <C VALUE="http://stackoverflow.com/questions/14523253/10" FRAME="1"/> <D VALUE="http://stackoverflow.com/questions/14523253/3" FRAME="0"/> </B> <B HANDLE_X="61" HANDLE_Y="121" > <C VALUE="http://stackoverflow.com/questions/14523253/10" FRAME="1"/> <D VALUE="http://stackoverflow.com/questions/14523253/3" FRAME="0"/> </B> </A></B></A>\[/code\]So I have 2 functions which load xml template. One of them calls the other and vice versa. Here is sample:\[code\]public static void MainFunc(){ XmlReader xmlReader = new XmlReader(); Element element = xmlReader.parse(Gdx.files.internal(filename)); A a = Load_A_XMLTree(element);}public static A Load_A_XMLTree(Element child){ for(int i=0; i<child.getChildCount(); i++){ Element child2= child.getChild(i); //parsing some xml... if(child2.getName().equals("B")){ B b = Load_B_XMLTree(child2); } } //parsing some xml...} public static B Load_B_XMLTree(Element child){ for(int i=0; i<child.getChildCount(); i++){ Element child2= child.getChild(i); //parsing some xml... if(child2.getName().equals("A")){ A a = Load_A_XMLTree(child2); //THIS LOG IS NOT SHOWN if(a!=null) Gdx.app.log("A", "not null"); else Gdx.app.log("A", "null"); } //parsing some xml... } //THIS LOG IS SHOWN Gdx.app.log("AFTER", "AFTER");}\[/code\]Seems to me \[code\]Load_B_XMLTree\[/code\] doesn't invoke \[code\]Load_A_XMLTree\[/code\]! The behaviour is very strange. The console shows only \[code\]AFTER: AFTER\[/code\] and it freezes. How to solve this problem?
 
Back
Top