Exemple #1
0
        public static XRootNamespace Load(TextReader textReader, LoadOptions options)
        {
            var root = new XRootNamespace {
                _doc = XDocument.Load(textReader, options)
            };
            var 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);
        }
Exemple #2
0
        public static XRootNamespace Parse(string text)
        {
            var root = new XRootNamespace {
                _doc = XDocument.Parse(text)
            };
            var 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);
        }