Search engines use an XML schema to define the elements and attributes that can appear in your Sitemap file. For example, you can download the Google schema from the links below:

For Sitemaps: Sitemap schema from SiteMap.org
For Sitemap index files: Sitemap Index schema from SiteMap.org

There are many tools available to help you validate the structure of your Sitemap based on this schema. You can find a list of XML-related tools at each of the following locations:

W3.org XML Schema Tools
XML.com Schema Tools

Be advised that:

If your websites use both HTTPS and HTTP you should not include both versions of your URLs but choose the one you find more appropriate for your content.
It is not recommended to include session IDs in your URLs due to the fact that it might result in incorrect or no crawling of the certain page.
The position of your URLs in your Sitemap does not affect the crawling process in any way.