private void GenerateComplexTypeTopic(Topic topic) { var complexType = (XmlSchemaComplexType)topic.SchemaObject; var usages = _context.SchemaSetManager.GetTypeUsages(complexType); var simpleTypeStructureRoot = _context.SchemaSetManager.GetSimpleTypeStructure(complexType); var children = _context.SchemaSetManager.GetChildren(complexType); var attributeEntries = _context.SchemaSetManager.GetAttributeEntries(complexType); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { writer.StartTopic(topic.Id); writer.WriteIntroductionForObject(_context, complexType); writer.WriteBaseTypeSection(_context, complexType); writer.WriteContentTypeSection(_context, simpleTypeStructureRoot); writer.WriteUsagesSection(_context, usages); writer.WriteChildrenSection(_context, children); writer.WriteAttributesSection(_context, attributeEntries); writer.WriteRemarksSectionForObject(_context, complexType); writer.WriteExamplesSectionForObject(_context, complexType); writer.WriteSyntaxSection(_context, complexType); writer.WriteRelatedTopics(_context, complexType); writer.EndTopic(); } }
private void GenerateElementTopic(Topic topic) { var element = (XmlSchemaElement)topic.SchemaObject; var parents = _context.SchemaSetManager.GetObjectParents(element); var simpleTypeStructureRoot = _context.SchemaSetManager.GetSimpleTypeStructure(element.ElementSchemaType); var children = _context.SchemaSetManager.GetChildren(element); var attributeEntries = _context.SchemaSetManager.GetAttributeEntries(element); var constraints = element.Constraints; using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { writer.StartTopic(topic.Id); writer.WriteIntroductionForObject(_context, element); writer.WriteTypeSection(_context, element); writer.WriteContentTypeSection(_context, simpleTypeStructureRoot); writer.WriteParentsSection(_context, parents); writer.WriteChildrenSection(_context, children); writer.WriteAttributesSection(_context, attributeEntries); writer.WriteConstraintsSection(_context, constraints); writer.WriteRemarksSectionForObject(_context, element); writer.WriteExamplesSectionForObject(_context, element); writer.WriteSyntaxSection(_context, element); writer.WriteRelatedTopics(_context, element); writer.EndTopic(); } }
private void GenerateNamespaceTopic(Topic topic) { var contentFinder = new NamespaceContentFinder(_context.SchemaSetManager, topic.Namespace); contentFinder.Traverse(_context.SchemaSetManager.SchemaSet); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { writer.StartTopic(topic.Id); writer.WriteIntroductionForNamespace(_context, topic.Namespace); writer.WriteRemarksSectionForNamespace(_context, topic.Namespace); writer.WriteExamplesSectionForNamespace(_context, topic.Namespace); writer.WriteRootSchemasSection(_context, _context.SchemaSetManager.GetNamespaceRootSchemas(topic.Namespace)); writer.WriteRootElementsSection(_context, _context.SchemaSetManager.GetNamespaceRootElements(topic.Namespace)); writer.WriteSchemasSection(_context, contentFinder.Schemas); writer.WriteElementsSection(_context, contentFinder.Elements); writer.WriteAttributesSection(_context, contentFinder.Attributes); writer.WriteGroupsSection(_context, contentFinder.Groups); writer.WriteAttributeGroupsSection(_context, contentFinder.AttributeGroups); writer.WriteSimpleTypesSection(_context, contentFinder.SimpleTypes); writer.WriteComplexTypesSection(_context, contentFinder.ComplexTypes); writer.EndTopic(); } }
private void GenerateOverviewTopic(Topic topic) { var contentFinder = new NamespaceContentFinder(_context.SchemaSetManager, topic.Namespace); contentFinder.Traverse(_context.SchemaSetManager.SchemaSet); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { writer.StartTopic(topic.Id); writer.WriteIntroductionForOverview(_context, topic.Namespace); switch (topic.TopicType) { case TopicType.RootSchemasSection: writer.WriteRootSchemasSection(_context, _context.SchemaSetManager.GetNamespaceRootSchemas(topic.Namespace)); break; case TopicType.RootElementsSection: writer.WriteRootElementsSection(_context, _context.SchemaSetManager.GetNamespaceRootElements(topic.Namespace)); break; case TopicType.SchemasSection: writer.WriteSchemasSection(_context, contentFinder.Schemas); break; case TopicType.ElementsSection: writer.WriteElementsSection(_context, contentFinder.Elements); break; case TopicType.AttributesSection: writer.WriteAttributesSection(_context, contentFinder.Attributes); break; case TopicType.AttributeGroupsSection: writer.WriteAttributeGroupsSection(_context, contentFinder.AttributeGroups); break; case TopicType.GroupsSection: writer.WriteGroupsSection(_context, contentFinder.Groups); break; case TopicType.SimpleTypesSection: writer.WriteSimpleTypesSection(_context, contentFinder.SimpleTypes); break; case TopicType.ComplexTypesSection: writer.WriteComplexTypesSection(_context, contentFinder.ComplexTypes); break; default: throw ExceptionBuilder.UnhandledCaseLabel(topic.TopicType); } writer.EndTopic(); } }
private void GenerateNamespaceTopic(Topic topic) { var contentFinder = new NamespaceContentFinder(_context.SchemaSetManager, topic.Namespace); contentFinder.Traverse(_context.SchemaSetManager.SchemaSet); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { if (_includeTopicTag) { writer.StartTopic(topic.Id); } else { writer.StartDocument(); } if (_configuration.IncludeMoveToTop) { _context.MoveToTopLink = true; } writer.WriteIntroductionForNamespace(_context, topic.Namespace); writer.WriteRemarksSectionForNamespace(_context, topic.Namespace); writer.WriteExamplesSectionForNamespace(_context, topic.Namespace); writer.WriteRootSchemasSection(_context, _context.SchemaSetManager.GetNamespaceRootSchemas(topic.Namespace)); writer.WriteRootElementsSection(_context, _context.SchemaSetManager.GetNamespaceRootElements(topic.Namespace)); writer.WriteSchemasSection(_context, contentFinder.Schemas); writer.WriteElementsSection(_context, contentFinder.Elements); writer.WriteAttributesSection(_context, contentFinder.Attributes); writer.WriteGroupsSection(_context, contentFinder.Groups); writer.WriteAttributeGroupsSection(_context, contentFinder.AttributeGroups); writer.WriteSimpleTypesSection(_context, contentFinder.SimpleTypes); writer.WriteComplexTypesSection(_context, contentFinder.ComplexTypes); _context.MoveToTopLink = false; if (_includeTopicTag) { writer.EndTopic(); } else { writer.EndDocument(); } } }
private void GenerateSchemaTopic(Topic topic) { var schema = (XmlSchema)topic.SchemaObject; var contentFinder = new SchemaContentFinder(schema); contentFinder.Traverse(schema); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { if (_includeTopicTag) { writer.StartTopic(topic.Id); } else { writer.StartDocument(); } if (_configuration.IncludeMoveToTop) { _context.MoveToTopLink = true; } writer.WriteIntroductionForSchema(_context, schema); writer.WriteRemarksSectionForObject(_context, schema); writer.WriteExamplesSectionForObject(_context, schema); writer.WriteElementsSection(_context, contentFinder.Elements); writer.WriteAttributesSection(_context, contentFinder.Attributes); writer.WriteGroupsSection(_context, contentFinder.Groups); writer.WriteAttributeGroupsSection(_context, contentFinder.AttributeGroups); writer.WriteSimpleTypesSection(_context, contentFinder.SimpleTypes); writer.WriteComplexTypesSection(_context, contentFinder.ComplexTypes); _context.MoveToTopLink = false; if (_includeTopicTag) { writer.EndTopic(); } else { writer.EndDocument(); } } }
private void GenerateAttributeGroup(Topic topic) { var attributeGroup = (XmlSchemaAttributeGroup)topic.SchemaObject; var usages = _context.SchemaSetManager.GetObjectParents(attributeGroup); var attributeEntries = _context.SchemaSetManager.GetAttributeEntries(attributeGroup); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { writer.StartTopic(topic.Id); writer.WriteIntroductionForObject(_context, attributeGroup); writer.WriteUsagesSection(_context, usages); writer.WriteAttributesSection(_context, attributeEntries); writer.WriteRemarksSectionForObject(_context, attributeGroup); writer.WriteExamplesSectionForObject(_context, attributeGroup); writer.WriteSyntaxSection(_context, attributeGroup); writer.WriteRelatedTopics(_context, attributeGroup); writer.EndTopic(); } }
private void GenerateSchemaTopic(Topic topic) { var schema = (XmlSchema)topic.SchemaObject; var contentFinder = new SchemaContentFinder(schema); contentFinder.Traverse(schema); using (var stream = File.Create(topic.FileName)) using (var writer = new MamlWriter(stream)) { writer.StartTopic(topic.Id); writer.WriteIntroductionForSchema(_context, schema); writer.WriteRemarksSectionForObject(_context, schema); writer.WriteExamplesSectionForObject(_context, schema); writer.WriteElementsSection(_context, contentFinder.Elements); writer.WriteAttributesSection(_context, contentFinder.Attributes); writer.WriteGroupsSection(_context, contentFinder.Groups); writer.WriteAttributeGroupsSection(_context, contentFinder.AttributeGroups); writer.WriteSimpleTypesSection(_context, contentFinder.SimpleTypes); writer.WriteComplexTypesSection(_context, contentFinder.ComplexTypes); writer.EndTopic(); } }