public static void WriteSummary(this MamlWriter writer, DocumentationInfo documentationInfo)
 {
     if (documentationInfo != null && documentationInfo.SummaryNode != null)
     {
         writer.WriteRawContent(documentationInfo.SummaryNode);
     }
 }
        private static void WriteChildrenRows(this MamlWriter writer,
                                              Context context, IEnumerable <ChildEntry> childEntries, int level)
        {
            foreach (var childEntry in childEntries)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                //writer.WriteHtmlIndent(level);
                writer.WriteName(childEntry, context.TopicManager, level);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteOccurrence(childEntry);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteDescription(childEntry, context);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.EndTableRow();

                writer.WriteChildrenRows(context, childEntry.Children, level + 1);
            }
        }
示例#3
0
        private static void WriteJumpTableSection(this MamlWriter writer, Context context,
                                                  IEnumerable <string> namespaces, string title, string address)
        {
            var listItems = ListItemBuilder.Build(context, namespaces);

            writer.WriteJumpTableSection(context, listItems, title, address);
        }
示例#4
0
 public static void WriteRootElementsSection(this MamlWriter writer, Context context, IEnumerable <XmlSchemaObject> rootElements)
 {
     if (context.Configuration.DocumentRootElements)
     {
         writer.WriteJumpTableSection(context, rootElements, "Root Elements", "rootElements");
     }
 }
示例#5
0
 public static void WriteSchemasSection(this MamlWriter writer, Context context, IEnumerable <XmlSchemaObject> schemas)
 {
     if (context.Configuration.DocumentSchemas)
     {
         writer.WriteJumpTableSection(context, schemas, "Schemas", "schemas");
     }
 }
        public static void EndArtItem(this MamlWriter writer)
        {
            //writer.WriteEndElement(); // nobr
            //writer.EndMarkup();

            writer.WriteEndElement();                   //notLocalizable
        }
示例#7
0
        public static void WriteSyntaxSection(this MamlWriter writer, Context context, XmlSchemaObject obj)
        {
            if (!context.Configuration.DocumentSyntax)
            {
                return;
            }

            string sourceCodeAbridged = context.SourceCodeManager.GetSourceCodeAbridged(obj);

            StringBuilder builder = new StringBuilder(sourceCodeAbridged);

            builder.Replace("xmlns=\"http://www.w3.org/2001/XMLSchema\"",
                            String.Empty);
            builder.Replace("xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"",
                            String.Empty);
            builder.Replace("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"",
                            String.Empty);

            writer.StartSection("Syntax", "syntax");
            writer.WriteCode(builder.ToString(), "xml");

            writer.StartParagraph();
            if (context.MoveToTopLink)
            {
                // Create a link to the introduction, it is the top...
                writer.WriteLink("#introduction", "Top");
            }
            writer.EndParagraph();

            writer.EndSection();
        }
        private static void WriteNodes(this MamlWriter writer, Context context, IEnumerable <SimpleTypeStructureNode> children, int level)
        {
            foreach (var childEntry in children)
            {
                if (childEntry.NodeType == SimpleTypeStructureNodeType.NamedType)
                {
                    continue;
                }

                writer.StartTableRow();

                var isSingleRow = GetIsSingleRow(childEntry);
                if (isSingleRow)
                {
                    writer.WriteSingleItemAndFacet(level, context.TopicManager, childEntry);
                }
                else
                {
                    writer.WriteConstructorItemAndFacet(level, context.TopicManager, childEntry);
                }

                writer.StartTableRowEntry();
                writer.WriteSummaryForObject(context, childEntry.Node);
                writer.EndTableRowEntry();

                writer.EndTableRow();

                if (!isSingleRow)
                {
                    writer.WriteNodes(context, childEntry.Children, level + 1);
                }
            }
        }
        public static void WriteChildrenTable(this MamlWriter writer,
                                              Context context, List <ChildEntry> childEntries)
        {
            if (childEntries == null || childEntries.Count == 0)
            {
                return;
            }

            SortAllAndChoiceChildren(childEntries);

            writer.StartTable();
            writer.StartTableHeader();
            writer.StartTableRow();

            writer.WriteRowEntry("Name");
            writer.WriteRowEntry("Occurrences");
            writer.WriteRowEntry("Description");

            writer.EndTableRow();
            writer.EndTableHeader();

            writer.WriteChildrenRows(context, childEntries, 0);

            writer.EndTable();
        }
示例#10
0
        public static void WriteConstraintTable(this MamlWriter writer, Context context, XmlSchemaObjectCollection constraints)
        {
            if (constraints.Count == 0)
            {
                return;
            }

            writer.StartTable();
            writer.StartTableHeader();
            writer.StartTableRow();

            writer.WriteRowEntry(String.Empty);

            writer.WriteRowEntry("Type");

            writer.WriteRowEntry("Description");

            writer.WriteRowEntry("Selector");

            writer.WriteRowEntry("Fields");

            writer.EndTableRow();
            writer.EndTableHeader();

            var rowBuilder = new ConstraintRowWriter(writer, context);

            rowBuilder.Traverse(constraints);

            writer.EndTable();
        }
示例#11
0
        public static void WriteTypeSection(this MamlWriter writer, Context context, XmlSchemaElement element)
        {
            var isSimpleType = element.ElementSchemaType is XmlSchemaSimpleType;

            if (isSimpleType)
            {
                return;
            }

            // Test for empty contents...
            writer.StartFragment();
            writer.WriteTypeName(context.TopicManager, element.ElementSchemaType);
            writer.EndFragment();

            if (String.IsNullOrEmpty(writer.Framement))
            {
                return;
            }

            writer.StartSection("Type", "type");
            writer.StartParagraph();
            writer.WriteTypeName(context.TopicManager, element.ElementSchemaType);
            writer.EndParagraph();
            writer.EndSection();
        }
        private static void WriteName(this MamlWriter writer, ChildEntry entry, TopicManager topicManager)
        {
            switch (entry.ChildType)
            {
            case ChildType.Element:
            case ChildType.ElementExtension:
                var element     = (XmlSchemaElement)entry.Particle;
                var isExtension = (entry.ChildType == ChildType.ElementExtension);
                writer.WriteElementLink(topicManager, element, isExtension);
                break;

            case ChildType.Any:
                writer.WriteHtmlArtItemWithText(ArtItem.AnyElement, "Any");
                break;

            case ChildType.All:
                writer.WriteHtmlArtItemWithText(ArtItem.All, "All");
                break;

            case ChildType.Choice:
                writer.WriteHtmlArtItemWithText(ArtItem.Choice, "Choice");
                break;

            case ChildType.Sequence:
                writer.WriteHtmlArtItemWithText(ArtItem.Sequence, "Sequence");
                break;

            default:
                throw ExceptionBuilder.UnhandledCaseLabel(entry.ChildType);
            }
        }
 private static void WriteDescription(this MamlWriter writer, ChildEntry entry, Context context)
 {
     if (entry.Particle != null)
     {
         writer.WriteSummaryForObject(context, entry.Particle);
     }
 }
        public static void WriteNamespaceAndSchemaInfo(this MamlWriter writer, Context context, XmlSchemaObject obj)
        {
            var targetNamespace = obj.GetSchema().TargetNamespace;

            //writer.StartParagraph();
            //writer.StartMarkup();
            //writer.WriteRaw("<b>Namespace:</b> ");
            //writer.WriteBold("Namespace:", true);
            //writer.WriteHtmlNamespaceLink(context, targetNamespace);
            //writer.WriteRaw("<br/>");
            //writer.WriteRaw("<b>Schema:</b> ");
            //writer.WriteHtmlSchemaLink(context, obj);
            //writer.WriteRaw("<br/>");
            //writer.EndMarkup();
            //writer.EndParagraph();

            writer.StartParagraph();
            writer.WriteBold("Namespace: ", true);
            writer.WriteNamespaceLink(context, targetNamespace);
            //writer.EndParagraph();
            //writer.WriteRaw(NonBlockingSpaceEntityName);
            writer.WriteToken("lineBreak");
            //writer.WriteRaw(NonBlockingSpaceEntityName);
            //writer.StartParagraph();
            writer.WriteBold("Schema: ", true);
            writer.WriteSchemaLink(context, obj);
            writer.EndParagraph();
        }
        public static void WriteLinksForObject(this MamlWriter writer,
                                               XmlSchemaObject obj, Context context)
        {
            var root = obj.GetRoot();

            if (root != null && root != obj)
            {
                var rootItemTopic = context.TopicManager.GetTopic(root);
                if (rootItemTopic != null)
                {
                    writer.WriteTopicLink(rootItemTopic);
                }
            }

            var targetNamespace      = obj.GetSchema().TargetNamespace;
            var targetNamespaceTopic = context.TopicManager.GetNamespaceTopic(targetNamespace);

            if (targetNamespaceTopic != null)
            {
                writer.WriteTopicLink(targetNamespaceTopic);
            }

            var info = context.DocumentationManager.GetObjectDocumentationInfo(obj);

            if (info != null && info.RelatedTopicsNode != null)
            {
                writer.WriteRawContent(info.RelatedTopicsNode);
            }
        }
        public static void StartArtItem(this MamlWriter writer,
                                        ArtItem artItem, int indentLevel)
        {
            //writer.StartMarkup();
            //writer.WriteStartElement("nobr", String.Empty);
            //writer.WriteStartElement("artLink");
            //writer.WriteAttributeString("target", artItem.Id);
            //writer.WriteEndElement();
            //writer.WriteRaw(NonBlockingSpaceEntityName);

            writer.WriteStartElement("notLocalizable"); //notLocalizable
            writer.WriteAttributeString("address", writer.GetNextNobrAddress());

            if (indentLevel > 0)
            {
                writer.WriteIndent(indentLevel);
            }

            // Write the inline-image...
            writer.WriteMediaLinkInline(artItem.Id);
            // Write a white space...
            //writer.WriteStartElement("phrase"); //phrase
            //writer.WriteRaw(NonBlockingSpaceEntityName);
            //writer.WriteEndElement();           //phrase
        }
示例#17
0
        private static void WriteJumpTableSection(this MamlWriter writer, Context context,
                                                  IEnumerable <XmlSchemaObject> rows, string title, string address)
        {
            var listItems = ListItemBuilder.Build(context, rows);

            writer.WriteJumpTableSection(context, listItems, title, address);
        }
示例#18
0
        public static void WriteUsagesSection(this MamlWriter writer, Context context, IEnumerable <XmlSchemaObject> usages)
        {
            // Test for empty list...
            IList <ListItem> listItems = ListItemBuilder.Build(context, usages);

            if (listItems == null || listItems.Count == 0)
            {
                return;
            }

            writer.StartSection("Usages", "usages");
            writer.StartParagraph();
            writer.WriteList(context, listItems);
            writer.EndParagraph();

            writer.StartParagraph();
            if (context.MoveToTopLink && listItems.Count > 15)
            {
                // Create a link to the introduction, it is the top...
                writer.WriteLink("#introduction", "Top");
            }
            writer.EndParagraph();

            writer.EndSection();
        }
        private static void WriteTypeNamesMarkup(this MamlWriter writer,
                                                 TopicManager topicManager, IEnumerable <SimpleTypeStructureNode> children)
        {
            var isFirst = true;

            foreach (var node in children)
            {
                if (node.NodeType != SimpleTypeStructureNodeType.NamedType)
                {
                    continue;
                }

                if (isFirst)
                {
                    isFirst = false;
                }
                else
                {
                    writer.WriteString(", ");
                }

                var simpleType = (XmlSchemaSimpleType)node.Node;
                var topic      = topicManager.GetTopic(simpleType);

                if (topic != null)
                {
                    writer.WriteTopicLink(topic);
                }
                else
                {
                    writer.WriteString(simpleType.QualifiedName.Name);
                }
            }
        }
        public static void WriteArtItemWithTopicLink(this MamlWriter writer,
                                                     ArtItem artItem, Topic topic, int indentLevel)
        {
            //writer.StartHtmlArtItem(artItem);
            //writer.WriteHtmlTopicLink(topic);
            //writer.EndHtmlArtItem();
            writer.WriteStartElement("notLocalizable"); //notLocalizable
            writer.WriteAttributeString("address", writer.GetNextNobrAddress());

            if (indentLevel > 0)
            {
                writer.WriteIndent(indentLevel);
            }

            // Write the inline-image...
            writer.WriteMediaLinkInline(artItem.Id);
            // Write a white space...
            //writer.WriteStartElement("phrase"); //phrase
            //writer.WriteRaw(NonBlockingSpaceEntityName);
            //writer.WriteEndElement();           //phrase
            // Write the line...
            writer.WriteLink(topic.Id, topic.LinkTitle);

            writer.WriteEndElement();                   //notLocalizable
        }
        private static void WriteType(this MamlWriter writer, Context context,
                                      XmlSchemaSimpleType type)
        {
            var typeNameWriter = new AttributeTypeNameWriter(writer, context);

            typeNameWriter.Traverse(type);
        }
        private static void WriteSingle(this MamlWriter writer, TopicManager topicManager, SimpleTypeStructureNode node)
        {
            switch (node.NodeType)
            {
            case SimpleTypeStructureNodeType.Any:
                writer.WriteString("Any");
                break;

            case SimpleTypeStructureNodeType.Mixed:
                writer.WriteString("Mixed");
                break;

            case SimpleTypeStructureNodeType.NamedType:
                writer.WriteTypeName(topicManager, (XmlSchemaType)node.Node);
                break;

            case SimpleTypeStructureNodeType.List:
                writer.StartHtmlArtItem(ArtItem.List);
                writer.WriteTypeNamesMarkup(topicManager, node.Children);
                writer.EndHtmlArtItem();
                break;

            case SimpleTypeStructureNodeType.Union:
                writer.StartHtmlArtItem(ArtItem.Union);
                writer.WriteTypeNamesMarkup(topicManager, node.Children);
                writer.EndHtmlArtItem();
                break;

            default:
                throw ExceptionBuilder.UnhandledCaseLabel(node.NodeType);
            }
        }
示例#23
0
        private static void WriteConstraintRow(this MamlWriter writer, Context context, ArtItem artItem, string constrainedType, XmlSchemaIdentityConstraint constraint)
        {
            writer.StartTableRow();

            writer.StartTableRowEntry();
            writer.WriteArtItemInline(artItem);
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteString(constrainedType);
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteSummaryForObject(context, constraint);
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteString(constraint.Selector.XPath);
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteConstraintFieldList(constraint.Fields);
            writer.EndTableRowEntry();

            writer.EndTableRow();
        }
 private static void WriteObsoleteInfo(this MamlWriter writer)
 {
     writer.StartAlert(AlertClass.Note);
     writer.StartParagraph();
     writer.WriteString("This XML entity is now obsolete.");
     writer.EndParagraph();
     writer.EndAlert();
 }
        public static void WriteIntroductionForSchemaSet(this MamlWriter writer, Context context)
        {
            var documentationInfo = context.DocumentationManager.GetSchemaSetDocumentationInfo();

            writer.StartIntroduction();
            writer.WriteSummary(documentationInfo);
            writer.EndIntroduction();
        }
示例#26
0
        public static void EndHtmlArtItem(this MamlWriter writer)
        {
            // See comments about <nobr> in StartHtmlArtItem().
            //
            // writer.WriteEndElement(); // nobr

            writer.EndMarkup();
        }
示例#27
0
        private static void WriteExamplesSection(this MamlWriter writer, DocumentationInfo documentationInfo)
        {
            if (documentationInfo == null || documentationInfo.ExamplesNode == null)
            {
                return;
            }

            writer.WriteSection("Examples", "examples", documentationInfo.ExamplesNode);
        }
 private static void WriteObsoleteInfo(this MamlWriter writer, Topic topic)
 {
     writer.StartAlert(AlertClass.Note);
     writer.StartParagraph();
     writer.WriteString("This XML entity is now obsolete. The non-obsolete alternative is ");
     writer.WriteTopicLink(topic);
     writer.EndParagraph();
     writer.EndAlert();
 }
示例#29
0
        private static void WriteRemarksSection(this MamlWriter writer, DocumentationInfo documentationInfo)
        {
            if (documentationInfo == null || documentationInfo.RemarksNode == null)
            {
                return;
            }

            writer.WriteSection("Remarks", "remarks", documentationInfo.RemarksNode);
        }
 private static void WriteSingleItemAndFacet(this MamlWriter writer, int level, TopicManager topicManager, SimpleTypeStructureNode node)
 {
     writer.StartTableRowEntry();
     writer.WriteHtmlIndent(level);
     writer.WriteSingle(topicManager, node);
     writer.EndTableRowEntry();
     writer.StartTableRowEntry();
     writer.EndTableRowEntry();
 }
示例#31
0
        private static string GetSummaryMarkup(Context context, XmlSchemaObject schemaObject)
        {
            using (var stringWriter = new StringWriter())
            {
                using (var mamlWriter = new MamlWriter(stringWriter))
                    mamlWriter.WriteSummaryForObject(context, schemaObject);

                return stringWriter.ToString();
            }
        }
示例#32
0
        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();
            }
        }
 public AttributeTypeNameWriter(MamlWriter writer, Context context)
 {
     _writer = writer;
     _context = context;
 }
示例#34
0
        private static string GetSummaryMarkup(Context context, string namspaceUri)
        {
            using (var stringWriter = new StringWriter())
            {
                using (var mamlWriter = new MamlWriter(stringWriter))
                {
                    var doc = context.DocumentationManager.GetNamespaceDocumentationInfo(namspaceUri);
                    mamlWriter.WriteSummary(doc);
                }

                return stringWriter.ToString();
            }
        }
示例#35
0
        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();
            }
        }
示例#36
0
        private void GenerateAttributeTopic(Topic topic)
        {
            var attribute = (XmlSchemaAttribute)topic.SchemaObject;
            var parents = _context.SchemaSetManager.GetObjectParents(attribute);
            var simpleTypeStructureRoot = _context.SchemaSetManager.GetSimpleTypeStructure(attribute.AttributeSchemaType);

            using (var stream = File.Create(topic.FileName))
            using (var writer = new MamlWriter(stream))
            {
                writer.StartTopic(topic.Id);
                writer.WriteIntroductionForObject(_context, attribute);
                writer.WriteContentTypeSection(_context, simpleTypeStructureRoot);
                writer.WriteParentsSection(_context, parents);
                writer.WriteRemarksSectionForObject(_context, attribute);
                writer.WriteExamplesSectionForObject(_context, attribute);
                writer.WriteSyntaxSection(_context, attribute);
                writer.WriteRelatedTopics(_context, attribute);
                writer.EndTopic();
            }
        }
示例#37
0
        private void GenerateGroupTopic(Topic topic)
        {
            var group = (XmlSchemaGroup)topic.SchemaObject;
            var parents = _context.SchemaSetManager.GetObjectParents(group);
            var children = _context.SchemaSetManager.GetChildren(group);

            using (var stream = File.Create(topic.FileName))
            using (var writer = new MamlWriter(stream))
            {
                writer.StartTopic(topic.Id);
                writer.WriteIntroductionForObject(_context, group);
                writer.WriteUsagesSection(_context, parents);
                writer.WriteChildrenSection(_context, children);
                writer.WriteRemarksSectionForObject(_context, group);
                writer.WriteExamplesSectionForObject(_context, group);
                writer.WriteSyntaxSection(_context, group);
                writer.WriteRelatedTopics(_context, group);
                writer.EndTopic();
            }
        }
 public ConstraintRowWriter(MamlWriter writer, Context context)
 {
     _writer = writer;
     _context = context;
 }
示例#39
0
        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();
            }
        }
示例#40
0
        private void GenerateSchemaSetTopic(Topic topic)
        {
            if (_context.Configuration.NamespaceContainer)
            {
                using (var stream = File.Create(topic.FileName))
                using (var writer = new MamlWriter(stream))
                {
                    writer.StartTopic(topic.Id);
                    writer.WriteIntroductionForSchemaSet(_context);
                    writer.WriteRemarksSectionForSchemaSet(_context);
                    writer.WriteExamplesSectionForSchemaSet(_context);
                    writer.WriteNamespacesSection(_context, _context.SchemaSetManager.GetNamespaces());
                    writer.EndTopic();
                }
            }
            else
            {
                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.WriteIntroductionForSchemaSet(_context);
                    writer.WriteRemarksSectionForSchemaSet(_context);
                    writer.WriteExamplesSectionForSchemaSet(_context);
                    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();
                }
            }
        }
示例#41
0
        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();
            }
        }
示例#42
0
        private void GenerateSimpleTypeTopic(Topic topic)
        {
            var simpleType = (XmlSchemaSimpleType)topic.SchemaObject;
            var usages = _context.SchemaSetManager.GetTypeUsages(simpleType);
            var simpleTypeStructureRoot = _context.SchemaSetManager.GetSimpleTypeStructure(simpleType.Content);

            using (var stream = File.Create(topic.FileName))
            using (var writer = new MamlWriter(stream))
            {
                writer.StartTopic(topic.Id);
                writer.WriteIntroductionForObject(_context, simpleType);
                writer.WriteContentTypeSection(_context, simpleTypeStructureRoot);
                writer.WriteUsagesSection(_context, usages);
                writer.WriteRemarksSectionForObject(_context, simpleType);
                writer.WriteExamplesSectionForObject(_context, simpleType);
                writer.WriteSyntaxSection(_context, simpleType);
                writer.WriteRelatedTopics(_context, simpleType);
                writer.EndTopic();
            }
        }