Пример #1
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();
        }
Пример #2
0
        private static void WriteConstraintRow(this MamlWriter writer, Context context, ArtItem artItem, string constrainedType, XmlSchemaIdentityConstraint constraint)
        {
            writer.StartTableRow();

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

            writer.WriteRowEntry(constrainedType);

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

            writer.WriteRowEntry(constraint.Selector.XPath);

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

            writer.EndTableRow();
        }
        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);
            }
        }
        public static void WriteSimpleTypeStrucure(this MamlWriter writer,
                                                   Context context, SimpleTypeStructureNode root)
        {
            if (root == null || root.Children.Count == 0)
            {
                return;
            }

            if (root.Children.Count == 1)
            {
                var node        = root.Children[0];
                var isSingleRow = SimpleTypeStructureNode.GetIsSingleRow(node);
                if (isSingleRow)
                {
                    writer.StartParagraph();
                    writer.WriteSingle(context.TopicManager, node, 0);
                    writer.EndParagraph();

                    return;
                }
            }

            writer.StartTable();

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

            writer.WriteRowEntry("Item");

            //writer.WriteRowEntry("Facet Value");
            writer.StartTableRowEntry();
            writer.StartParagraph();
            writer.WriteStartElement("notLocalizable"); //notLocalizable
            writer.WriteAttributeString("address", writer.GetNextNobrAddress());
            writer.WriteString("Facet Value");
            writer.WriteEndElement();                   //notLocalizable
            writer.EndParagraph();
            writer.EndTableRowEntry();

            writer.WriteRowEntry("Description");

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

            writer.WriteNodes(context, root.Children, 0);

            writer.EndTable();
        }
Пример #5
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();
        }
Пример #6
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();
        }
Пример #7
0
        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();
        }
 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();
 }
 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();
 }
 public static void WriteIntroductionForOverview(this MamlWriter writer, Context context, string namespaceUri)
 {
     writer.StartIntroduction();
     writer.StartParagraph();
     writer.WriteString("The ");
     writer.WriteNamespaceLink(context, namespaceUri);
     writer.WriteString(" namespace exposes the following members.");
     writer.EndParagraph();
     writer.EndIntroduction();
 }
Пример #11
0
 public static void WriteNamespaceInfo(this MamlWriter writer, Context context, string namespaceUri)
 {
     writer.StartParagraph();
     writer.StartBold();
     writer.WriteString("Namespace:");
     writer.EndBold();
     writer.WriteNonBlockingSpace();
     writer.WriteNamespaceLink(context, namespaceUri);
     writer.EndParagraph();
 }
Пример #12
0
 public static void WriteNamespaceInfo(this MamlWriter writer,
                                       Context context, string namespaceUri)
 {
     writer.StartParagraph();
     //writer.StartMarkup();
     //writer.WriteRaw("<b>Namespace:</b> ");
     writer.WriteBold("Namespace: ", true);
     writer.WriteNamespaceLink(context, namespaceUri);
     //writer.WriteRaw("<br/>");
     //writer.EndMarkup();
     writer.EndParagraph();
 }
Пример #13
0
        public static void WriteNamespaceAndSchemaInfo(this MamlWriter writer, Context context, XmlSchemaObject obj)
        {
            var targetNamespace = obj.GetSchema().TargetNamespace;

            writer.WriteNamespaceInfo(context, targetNamespace);

            writer.StartParagraph();
            writer.StartBold();
            writer.WriteString("Schema:");
            writer.EndBold();
            writer.WriteNonBlockingSpace();
            writer.WriteSchemaLink(context, obj);
            writer.EndParagraph();
        }
        private static void WriteSingleItemAndFacet(this MamlWriter writer,
                                                    int level, TopicManager topicManager, SimpleTypeStructureNode node)
        {
            writer.StartTableRowEntry();
            writer.StartParagraph();
            //writer.WriteHtmlIndent(level);
            writer.WriteSingle(topicManager, node, level);
            writer.EndParagraph();
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteParagraph(String.Empty);
            writer.EndTableRowEntry();
        }
        private static void WriteFacet(this MamlWriter writer, int level,
                                       SimpleTypeStructureNode node, string facetType)
        {
            var facetValue = ((XmlSchemaFacet)node.Node).Value;

            writer.StartTableRowEntry();
            writer.StartParagraph();
            //writer.WriteHtmlIndent(level);
            writer.WriteArtItemWithText(ArtItem.Facet, facetType, level);
            writer.EndParagraph();
            writer.EndTableRowEntry();

            writer.WriteRowEntry(facetValue);
        }
Пример #16
0
        public static void WriteIntroductionForNamespace(this MamlWriter writer,
                                                         Context context, string targetNamespace)
        {
            var documentationInfo =
                context.DocumentationManager.GetNamespaceDocumentationInfo(targetNamespace);

            writer.StartIntroduction();
            writer.WriteSummary(documentationInfo);
            if (context.Configuration.IncludeAutoOutline)
            {
                writer.StartParagraph();
                writer.WriteToken("autoOutline");
                writer.EndParagraph();
            }
            writer.WriteObsoleteInfo(context, targetNamespace);
            writer.EndIntroduction();
        }
Пример #17
0
        public static void WriteBaseTypeSection(this MamlWriter writer, Context context, XmlSchemaComplexType complexType)
        {
            // Test for empty contents...
            writer.StartFragment();
            writer.WriteTypeName(context.TopicManager, complexType.BaseXmlSchemaType);
            writer.EndFragment();

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

            writer.StartSection("Base Type", "baseType");
            writer.StartParagraph();
            writer.WriteTypeName(context.TopicManager, complexType.BaseXmlSchemaType);
            writer.EndParagraph();
            writer.EndSection();
        }
Пример #18
0
        public static void WriteIntroductionForSchema(this MamlWriter writer,
                                                      Context context, XmlSchema schema)
        {
            var documentationInfo =
                context.DocumentationManager.GetObjectDocumentationInfo(schema);

            writer.StartIntroduction();
            writer.WriteSummary(documentationInfo);
            if (context.Configuration.IncludeAutoOutline)
            {
                writer.StartParagraph();
                writer.WriteToken("autoOutline");
                writer.EndParagraph();
            }
            writer.WriteObsoleteInfo(context, schema);
            writer.WriteNamespaceInfo(context, schema.TargetNamespace);
            writer.EndIntroduction();
        }
Пример #19
0
        public static void WriteChildrenSection(this MamlWriter writer, Context context, List <ChildEntry> children)
        {
            if (children == null || children.Count == 0)
            {
                return;
            }

            writer.StartSection("Children", "children");
            writer.WriteChildrenTable(context, children);

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

            writer.EndSection();
        }
Пример #20
0
        public static void WriteAttributesSection(this MamlWriter writer, Context context, AttributeEntries attributeEntries)
        {
            if (attributeEntries.Attributes.Count == 0 && attributeEntries.AnyAttribute == null)
            {
                return;
            }

            writer.StartSection("Attributes", "attributes");
            writer.WriteAttributeTable(context, attributeEntries);

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

            writer.EndSection();
        }
Пример #21
0
        private static void WriteConstraintFieldList(this MamlWriter writer, XmlSchemaObjectCollection fields)
        {
            if (fields.Count == 1)
            {
                var field = (XmlSchemaXPath)fields[0];
                writer.WriteString(field.XPath);
                return;
            }

            writer.StartList(ListClass.Ordered);

            foreach (XmlSchemaXPath field in fields)
            {
                writer.StartListItem();
                writer.StartParagraph();
                writer.WriteString(field.XPath);
                writer.EndParagraph();
                writer.EndListItem();
            }

            writer.EndList();
        }
        private static void WriteConstructor(this MamlWriter writer, int level, TopicManager topicManager,
                                             SimpleTypeStructureNode node, ArtItem constructionArtItem, string constructName)
        {
            writer.StartTableRowEntry();
            writer.StartParagraph();
            //writer.WriteHtmlIndent(level);
            writer.StartArtItem(constructionArtItem, level);
            if (ContainsNamedTypes(node.Children))
            {
                writer.WriteTypeNamesMarkup(topicManager, node.Children);
            }
            else
            {
                writer.WriteString(constructName);
            }
            writer.EndArtItem();
            writer.EndParagraph();
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteParagraph(String.Empty);
            writer.EndTableRowEntry();
        }
        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 = SimpleTypeStructureNode.GetIsSingleRow(childEntry);
                if (isSingleRow)
                {
                    writer.WriteSingleItemAndFacet(level, context.TopicManager, childEntry);
                }
                else
                {
                    writer.WriteConstructorItemAndFacet(level, context.TopicManager, childEntry);
                }

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

                writer.EndTableRow();

                if (!isSingleRow)
                {
                    writer.WriteNodes(context, childEntry.Children, level + 1);
                }
            }
        }
        public static void WriteAttributeTable(this MamlWriter writer, Context context, AttributeEntries attributeEntries)
        {
            if (attributeEntries.Attributes.Count == 0 && attributeEntries.AnyAttribute == null)
            {
                return;
            }

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

            writer.WriteRowEntry("Name");
            writer.WriteRowEntry("Type");
            writer.WriteRowEntry("Required");
            writer.WriteRowEntry("Description");

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

            var sortedAttributes = from a in attributeEntries.Attributes
                                   orderby a.QualifiedName.Name
                                   select a;

            foreach (var attribute in sortedAttributes)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteAttributeTopicLink(context.TopicManager, attribute,
                                               false, 0);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteType(context, attribute.AttributeSchemaType);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteRequiredText(attribute.Use);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteSummaryForObject(context, attribute);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            if (attributeEntries.AnyAttribute != null)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteArtItemWithText(ArtItem.AnyAttribute, "Any");
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteParagraph(String.Empty);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteParagraph(String.Empty);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteSummaryForObject(context, attributeEntries.AnyAttribute);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            var sortedExtensionAttributes = from a in attributeEntries.ExtensionAttributes
                                            orderby a.QualifiedName.Name
                                            select a;

            foreach (var attribute in sortedExtensionAttributes)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                //writer.WriteHtmlIndent(1);
                writer.WriteAttributeTopicLink(context.TopicManager, attribute,
                                               true, 1);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteType(context, attribute.AttributeSchemaType);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteRequiredText(attribute.Use);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteSummaryForObject(context, attribute);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            writer.EndTable();
        }
Пример #25
0
        public static void WriteIntroductionForObject(this MamlWriter writer,
                                                      Context context, XmlSchemaObject obj)
        {
            DocumentationInfo documentationInfo =
                context.DocumentationManager.GetObjectDocumentationInfo(obj);

            writer.StartIntroduction();
            writer.WriteSummary(documentationInfo);
            if (context.Configuration.IncludeAutoOutline)
            {
                XmlSchemaAttribute      attribute;
                XmlSchemaElement        element;
                XmlSchemaGroup          group;
                XmlSchemaAttributeGroup attributeGroup;
                XmlSchemaSimpleType     simpleType;
                XmlSchemaComplexType    complexType;

                if (Casting.TryCast(obj, out element))
                {
                    bool isSimpleType = element.ElementSchemaType is XmlSchemaSimpleType;
                    if (!isSimpleType)
                    {
                        writer.StartParagraph();
                        writer.WriteToken("autoOutline");
                        writer.EndParagraph();

                        context.MoveToTopLink = true;
                    }
                }
                else if (Casting.TryCast(obj, out attribute))
                {
                }
                else if (Casting.TryCast(obj, out group))
                {
                    XmlSchemaGroupBase compositor = group.Particle;
                    if (compositor != null)
                    {
                        XmlSchemaObjectCollection items = compositor.Items;
                        if (items != null && items.Count > 3)
                        {
                            writer.StartParagraph();
                            writer.WriteToken("autoOutline");
                            writer.EndParagraph();

                            context.MoveToTopLink = true;
                        }
                    }
                }
                else if (Casting.TryCast(obj, out attributeGroup))
                {
                }
                else if (Casting.TryCast(obj, out simpleType))
                {
                }
                else if (Casting.TryCast(obj, out complexType))
                {
                    if (complexType.ContentType != XmlSchemaContentType.Empty &&
                        complexType.ContentType != XmlSchemaContentType.TextOnly)
                    {
                        writer.StartParagraph();
                        writer.WriteToken("autoOutline");
                        writer.EndParagraph();

                        context.MoveToTopLink = true;
                    }
                }
            }
            writer.WriteObsoleteInfo(context, obj);
            writer.WriteNamespaceAndSchemaInfo(context, obj);
            writer.EndIntroduction();
        }
Пример #26
0
        private static void WriteJumpTableSection(this MamlWriter writer,
                                                  Context context, ICollection <ListItem> listItems,
                                                  string title, string address)
        {
            if (listItems.Count == 0)
            {
                return;
            }

            writer.StartSection(title, address);

            writer.StartTable();

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

            //writer.WriteRowEntry(String.Empty);
            writer.StartTableRowEntry();
            writer.StartParagraph();
            writer.WriteToken("iconColumn");
            writer.EndParagraph();
            writer.EndTableRowEntry();

            if (title.EndsWith("s", StringComparison.Ordinal))
            {
                if (title.IndexOf(' ') < 0)  // if it is a single word...
                {
                    writer.WriteRowEntry(title.Remove(title.Length - 1));
                }
                else
                {
                    // Write non-breaking title text...
                    writer.StartTableRowEntry();
                    writer.StartParagraph();
                    writer.WriteStartElement("notLocalizable"); //notLocalizable
                    writer.WriteAttributeString("address", writer.GetNextNobrAddress());
                    writer.WriteString(title.Remove(title.Length - 1));
                    writer.WriteEndElement();                   //notLocalizable
                    writer.EndParagraph();
                    writer.EndTableRowEntry();
                }
            }
            else
            {
                writer.WriteRowEntry("Element");
            }
            writer.WriteRowEntry("Description");

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

            foreach (var listItem in listItems)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteArtItemInline(listItem.ArtItem);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteTopicLink(listItem.Topic);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.StartParagraph();
                writer.WriteRaw(listItem.SummaryMarkup);
                writer.EndParagraph();
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            writer.EndTable();

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

            writer.EndSection();
        }