public static XRoot Load(TextReader textReader) {
     XRoot root = new XRoot();
     root.doc = XDocument.Load(textReader);
     XTypedElement typedRoot = XTypedServices.ToXTypedElement(root.doc.Root, LinqToXsdTypeManager.Instance);
     if ((typedRoot == null)) {
         throw new LinqToXsdException("Invalid root element in xml document.");
     }
     root.rootObject = typedRoot;
     return root;
 }
 public static XRoot Parse(string text, LoadOptions options) {
     XRoot root = new XRoot();
     root.doc = XDocument.Parse(text, options);
     XTypedElement typedRoot = XTypedServices.ToXTypedElement(root.doc.Root, LinqToXsdTypeManager.Instance);
     if ((typedRoot == null)) {
         throw new LinqToXsdException("Invalid root element in xml document.");
     }
     root.rootObject = typedRoot;
     return root;
 }