XP didn't support SATA. XP didn't support drives over 127GB till XP SP1. Installing XP under such new hardware is pretty well discussed so I won't duplicate the SATA or 127GB issue.
Let's check out drivers for the N5040. OUCH. Could not find any.
Reading http://en.community.dell.com/support-forums/laptop/f/3518/p/19410501/19963061.aspx#19963061 it seems this is not a laptop to choose if you want to run XP.
Bob
<span id="INSERTION_MARKER">Hello, Just bought a Dell Inspiron N5040 Laptop today, I came with Windows 7 but I want to use XP. I have the install disc from my very old Dell. I have used the disc on my wife's and my current dell. ( it had Windows Vista) So here's the deal, when I reboot and have it boot from the CD it will install the driver's and then at the end it says "Setup is starting windows." But I doesn't move from there. I've let it sit for 20 mins. Please help!

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic