public RuleReader(Stream stream)
{
// Take rule filename from stream if it is a file stream
FileStream fileStream = stream as FileStream;
document = XDocument.Load(stream);
if (document.Root.Name != "rules")
{
throw new InvalidDataException("Unexpected root element name");
}
}