If you connect to the Internet through a router, that can be the centre of your network of two computers - or a much higher nuber if you add any more. Once you made the connection - either using the advice above or through a router - you need to make some settings changes. Both machines need to be in the same Workgroup - check it Control Panel>System?Computer Name in the XP system and Control Panel>System>Advanced Settings in Windows 7. Both may already be WORKGROUP but if not, change accordingly.
Then in XP, simply run the Network Setup Wizard in Control Panel and in Windows 7 go to Control Panel>Network and Sharing Centre. Ignore the Homegroup option and go to Network. Click to share files and printers and change the setting requiring every computer to have a password.