private Schema ParseSchema(XElement xSchema, Uri fileName)
        {
            var targetNamespaceDeclaration = GetTargetNamespaceDeclaration(xSchema, fileName);
            var schema = new Schema(fileName, targetNamespaceDeclaration);

            var xElements = xSchema
                            .Elements(ElementXNames.Element)
                            .ToList();

            foreach (var xElement in xElements)
            {
                var item = new Item(xElement, targetNamespaceDeclaration.Value);
                schema.AddItem(item);
            }

            var roleTypeElements = xSchema
                                   .Descendants()
                                   .Where(e => e.Name == RoleTypeXNames.RoleType);

            foreach (var roleTypeElement in roleTypeElements)
            {
                var roleType = new RoleType(roleTypeElement);
                schema.AddRoleType(roleType);
            }

            return(schema);
        }
Exemplo n.º 2
0
        private Schema CreateSchema(Uri entryPoint)
        {
            var schema = new Schema(entryPoint, _targetNamespaceDeclaration);

            foreach (var extensionItem in ExtensionItems)
            {
                var item = CreateItem(extensionItem);
                schema.AddItem(item);
            }

            return(schema);
        }