You do need to break the news to your children if you decide to get divorced. You do need to answer their questions, and be honest with them. That's a conversation you and your spouse want to prepare for.
That said, you do not need to confide in them. You don't need to put them in the middle of everything. You don't need to give them all of the details. Most of all, you do not want to try to force them to pick sides, choosing between you and your spouse.