Went thru it as a child (5 yo) then did it to my kids at about the same age. That was 15 years ago. When I divorced I used my expereince as a child as a go by for what not to do.
If you cannot work things out with the spouse then end it, if you try to prolong it the kids will suffer. Once it is over try to stay close, it is hard because you don't want to be around the ex but it really helps the kids. Try not to be negative about the ex around the kids, this can only hurt them in the long run. Be truthful with the kids.
Good Luck!