You can programmatically create/add content types, but not using XML definition (as far as I'm aware). You have to construct it, add it to a content type collection, and manually add your field references to the field links collection.
A rough example would be:
using (SPSite site = new SPSite("http://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
SPContentType contentType = new SPContentType(web.ContentTypes["Document"], web.ContentTypes, "Financial Document");
web.ContentTypes.Add(contentType);
contentType.Group = "Financial Content Types";
contentType.Description = "Base financial content type";
contentType.FieldLinks.Add(new SPFieldLink(web.Fields.GetField("OrderDate")));
contentType.FieldLinks.Add(new SPFieldLink(web.Fields.GetField("Amount")));
contentType.Update();
}
}
You don't get to control the content type IDs this way though. I prefer using features as per Greg Enslow's response.