I was having a similar problem. First my tab would get the red X when I plugged it in, then one day I accidentally drained the battery completely and it would not charge when I plugged it in. The screen would light up momentarily with the battery and the little star-like loading symbol in the middle of it, then it would begin to "fill" with the blue that usually indicates it's charging (when powered off), then the screen would immediately turn off and start the process all over again.
I finally fixed the problem!
1. after unplugging the charger, I removed the back cover (carefully!)
2. I unhooked the battery connection to the motherboard (you can see what that looks like here Samsung Galaxy Tab Teardown Step 8, third picture -it's for an older device but the connection is nearly identical)
3. Then, I unhooked the connections for the touchscreen and the display (see step 11 on the teardown link above, it will outline what those connections look like)
4. I then re-connected the battery-to-motherboard connection
5. I plugged my charger cable into my computer's USB port, then into my tab and left my computer on (not in sleep mode) so that my battery would get a "trickle charge" (from my research, this is necessary when the battery has become completely drained. It's very slow, but you only need to leave it charging on your computer for an hour or so)
5. I came back after an hour and reconnected the touchscreen and display connections, then gently pressed the power button (not holding it down to turn it on, but just pressing it to see if the screen would display the battery status)
6. My tab finally showed the battery and the charging status without continually turning off! I then removed the cable from my computer and plugged it back into the outlet charger. It's charging a-ok now!
For anyone who's still reading, I thought to do this because it seemed that the trickle charge wouldn't work when the screen kept turning on and off. It seemed to drain what little charge the battery was getting each time it cycled, so I hoped that by unplugging the display, it would allow the battery to charge up enough to successfully overcome the constant drain/charge pattern. I don't know if this is why it worked, but it worked, so I'm gonna go with that :)