PDA

View Full Version : Commenting out blocks of code


antun
06-19-2003, 03:58 PM
Often when debugging, you find yourself commenting out sections of code. Regular XML comments (<!-- and -->) are usually fine for this, except when you already have XML comments in your code (it's illegal to nest XML comments within XML comments).

A good way around this is to use XML processing instructions, which are of the form:


<?ignore

?>


So to comment out the blue and green views below:


<canvas>
<simplelayout />

<!-- This is a red view -->
<view bgcolor="red" width="100" height="20" />
<?ignore
<!-- This is a blue view -->
<view bgcolor="blue" width="100" height="20" />
<!-- This is a green view -->
<view bgcolor="green" width="100" height="20" />
?>
<!-- This is a yellow view -->
<view bgcolor="yellow" width="100" height="20" />
</canvas>


Enjoy!