First and foremost, if you are submitting a photo for publication to another party such as a newspaper, magazine, or online publication you should follow the policy of that publication. Especially in the case of established newspapers and magazines, they have consulted legal experts regarding the best practice to follow in the jurisdictions their publication serves. If in doubt, contact the legal department of the publication. Most of them have one or can refer you to a legal firm that provides that service to them. If you submit more information than they require or will use, they are always free to not publish the specific names you provided. Often they will require the names of individuals prominent in the photo for their records, even if they don't plan to publish the names. Most publications will not use an image without the name(s) of those prominently displayed in a image.
If you are self publishing then obviously the question becomes more problematic. You need to consult legal counsel with expertise in this area familiar with the laws, rules, and practices of your locale.
In either case, it never hurts to get permission from a parent or legal guardian, even when it is not required. Likewise, it is often wise to not publish details or even the photo itself if the parent objects, even if you have the legal authority to do so.
In the location I live in the Southeastern United States the local newspaper usually publishes both first and last names of children pictured participating in public events. Having stood next to photographers working for the paper on many occasions when they gathered the information, they don't always explicitly ask for permission to publish the photo or name. They do generally ask the adult present and responsible for the child if it is okay to take the child's picture. If they have taken the picture from a distance before approaching the child/adult they will ask, "Is it okay if I use your picture?" By providing the child's name the adult is seen as implicitly giving permission to publish the name. This may or may not be acceptable practice in other areas, so it is always wise to consult competent legal counsel knowledgeable of the laws, rules, and practices for your locale.