Restoring Oracle XE database
Make a backup of the:


existing datafiles (SYSTEM01.DBF, SYSAUX01.DBF, UNDOTBS01.DBF, USERS01.DBF or similar) and tempfile (TEMP01.DBF - actually its not really needed, but keep it simple...)
controlfiles (CONTROL01.CTL, CONTROL02.CTL, or similar)
redo logs (REDO01.LOG, REDO02.LOG, etc..)
and the database parameterfile (ORACLE_HOME/database/initXE.ora or    spfileXE.ora)


Note the path of these files, as you should copy them back to their original path if you want to make it simple for yourself.
You can simply move/rename the whole existing Oracle directory if you want.

Install the new operating system, install Oracle 10g XE again at the same directory (so delete the previous installation after making backup of the above), let it create a new database and listener. When its done, stop the database and the belonging service at Windows Services by stopping the OracleServiceXE service. Now copy back the above files at their original place, and start the database by starting the OracleServiceXE service. The database should start and open after performing a crash recovery if your computer was shut down uncleanly earlier.

Note that, this is and oversimplified example of a way more complex process, and it assumes that you put everything to the place where they originally were.