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