The Google Earth Outreach team has a good little tutorial on validating KML as you type in jEdit. Unfortunately, it’s a little bit out-of-date, so here are some pointers for validating against the newer OGC 2.2 schema, using the current version of jEdit.
Follow the video instructions above for setting up jEdit, with the following exception: when you go to dock Sidekick, you click on Sidekick instead of Structure Browser and then, in order to start parsing the document, you need to select XML mode:
Once you have loaded your KML file, replace the root kml entity with the following instead of the older Google schemas, and you will be able to validate against the OGC’s KML and partial Atom schemas as you work:
One odd thing that I noticed in validating my KML. When I placed the <name> entity anywhere other than right after its parent entity (such as Document or Placemark) the parser complained that it was not valid. I don’t know if not having the <name> as the first entity is truly invalid, or if this is just a little quirk of the schema or the parser. The Galdos KML Validator throws the same error.
The main reason I went through setting this up is that I decided that I had to, in good conscience, ignore the part of the OGC KML written standard that constrains Atom relation types to "related". Not specifying the correct type of relationship means that I am contributing to the downfall of society, or at least to a less meaningful GeoWeb. See my previous post and some follow-up at Sean Gillies’ blog for more on this. Using jEdit allows me to ensure that my documents validate against the schema, which gives me at least some level of comfort when ignoring the online validator.