Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }