Электронный магазин на Java и XML

         

Метод genTerminal (Interpreter.Java)



Листинг 7.18. Метод genTerminal (Interpreter.Java)

// have reached the end of a terminal block // note that a <Terminal>
tag may have an altfile="filepathandname" // that replaces the default established in the file attribute of // the <Questionnaire>
tag for this particular branch private void genTerminal( PrintWriter out, Recorder recordB ){ NodeList nl = ((Element)nowBlock).getElementsByTagName ("Terminal");
int ct = nl.getLength();
String altfile = "" ; writeHead( out );
if( ct == 0 ){ out.println("Thank you for participating.<br>
");
} else { // use text from <Terminal>
...</Terminal>
Element E = (Element)nl.item(0);
// only one <Terminal>
tag out.println( E.getFirstChild().getNodeValue() );
altfile = E.getAttribute("altfile");
} try { recordB.terminal( altfile );
}catch(IOException e ){ out.println("Problem recording results, please notify webmaster");
} }



Содержание раздела