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

         

Метод toXML (DateTime.java)...



Листинг 6.36. Метод toXML (DateTime.java)

public void toXML( XMLWriter writer ) throws IOException { writer.writeln( "<onsale_date>
" );
writer.indent();
if( dayOfWeek != null ) writer.writeln( "<day_of_week>
" + dayOfWeek + "</day_of_week>
" );
if( month != null ) writer.writeln( "<month>
" + month + "</month>
" );
if( dayOfMonth != null ) writer.writeln( "<day_of_month>
" + dayOfMonth + "</day_of_month>
" );
if( year != null ) writer.writeln( "<year>
" + year + "</year>
" );
if( hour != null ) writer.writeln( "<hour>
" + hour + "</hour>
" );
if( minute != null ) writer.writeln( "<minute>
" + minute + "</minute>
" );
if( seconds != null ) writer.writeln( "<seconds>
" + seconds + "</seconds>
" );
writer.unindent();
writer.writeln( "</onsale_date>
" );
} }

 



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