• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Schema.XmlSchemaAnnotation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Schema.XmlSchemaAnnotation的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAnnotation类的具体用法?C# XmlSchemaAnnotation怎么用?C# XmlSchemaAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlSchemaAnnotation类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaAnnotation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SchemaDocumentation

 public SchemaDocumentation(XmlSchemaAnnotation annotation)
 {
     this.annotation = annotation;
     if (annotation != null) {
         ReadDocumentationFromAnnotation(annotation.Items);
     }
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:SchemaDocumentation.cs


示例2: ProcessAnnotation

        private static string ProcessAnnotation(XmlSchemaAnnotation schemaAnnotation)
        {
            StringBuilder result = new StringBuilder();
            if (schemaAnnotation == null)
                return result.ToString();

            foreach (XmlSchemaObject schemaObject in schemaAnnotation.Items)
            {
                if (schemaObject is XmlSchemaAppInfo)
                    result.Append(ProcessAppInfo((XmlSchemaAppInfo)schemaObject));
                else if (schemaObject is XmlSchemaDocumentation)
                    result.Append(ProcessDocumentation((XmlSchemaDocumentation)schemaObject));
                else
                    result.AppendLine(string.Format("Unsupported annotation type: {0}", schemaObject));
            }

            return result.ToString();
        }
开发者ID:stephenwelsh,项目名称:msiext,代码行数:18,代码来源:Program.cs


示例3: ImportEnum

        static WebServiceEnumData ImportEnum(string typeName, string typeNamespace, XmlQualifiedName typeQualifiedName, XmlSchemaSimpleTypeRestriction restriction, XmlSchemaAnnotation annotation) {
            // CheckIfEnum has already checked if baseType of restriction is string 
            XmlQualifiedName baseTypeName = ImportActualType(annotation, new XmlQualifiedName("int", XmlSchema.Namespace), typeQualifiedName);
            Type baseEnumType = _nameToType[baseTypeName];
            bool isULong = (baseEnumType == typeof(ulong));
            List<string> enumNames = new List<string>();
            List<long> enumValues = new List<long>();
            foreach (XmlSchemaFacet facet in restriction.Facets) {
                XmlSchemaEnumerationFacet enumFacet = facet as XmlSchemaEnumerationFacet;
                Debug.Assert(enumFacet != null);
                Debug.Assert(enumFacet.Value != null);

                string valueInnerText = GetInnerText(typeQualifiedName, ImportAnnotation(enumFacet.Annotation, EnumerationValueAnnotationName));
                long value;
                if (valueInnerText == null) {
                    // ASP .NET AJAX doesn't honor the Flags nature of Flags enums
                    // If it were to, we would assign Math.Pow(2, nameValues.Count) for Flags enums instead.
                    value = enumNames.Count;
                }
                else {
                    if (isULong) {
                        value = (long)ulong.Parse(valueInnerText, NumberFormatInfo.InvariantInfo);
                    }
                    else {
                        value = long.Parse(valueInnerText, NumberFormatInfo.InvariantInfo);
                    }
                }

                enumNames.Add(enumFacet.Value);
                enumValues.Add(value);
            }

            return new WebServiceEnumData(typeName, typeNamespace, enumNames.ToArray(), enumValues.ToArray(), isULong);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:WebServiceTypeData.cs


示例4: Write5_XmlSchemaAnnotation

 void Write5_XmlSchemaAnnotation(XmlSchemaAnnotation o) {
     if ((object)o == null) return;
     WriteStartElement("annotation");
     
     WriteAttribute(@"id", @"", ((System.String)[email protected]));
     WriteAttributes((XmlAttribute[])[email protected], o);
     System.Xml.Schema.XmlSchemaObjectCollection a = (System.Xml.Schema.XmlSchemaObjectCollection)[email protected];
     if (a != null) {
         for (int ia = 0; ia < a.Count; ia++) {
             XmlSchemaObject ai = (XmlSchemaObject)a[ia];
             if (ai is XmlSchemaAppInfo) {
                 Write7_XmlSchemaAppInfo((XmlSchemaAppInfo)ai);
             }
             else if (ai is XmlSchemaDocumentation) {
                 Write6_XmlSchemaDocumentation((XmlSchemaDocumentation)ai);
             }
         }
     }
     WriteEndElement();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:20,代码来源:SchemaObjectWriter.cs


示例5: AddAnnotation

 internal override void AddAnnotation(XmlSchemaAnnotation annotation)
 {
     this.annotation = annotation;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:XmlSchemaInclude.cs


示例6: AddXmlnsAnnotation

 private void AddXmlnsAnnotation(XmlSchemaComplexType type, string xmlnsMemberName)
 {
     XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
     XmlSchemaAppInfo item = new XmlSchemaAppInfo();
     XmlDocument document = new XmlDocument();
     XmlElement element = document.CreateElement("keepNamespaceDeclarations");
     if (xmlnsMemberName != null)
     {
         element.InsertBefore(document.CreateTextNode(xmlnsMemberName), null);
     }
     item.Markup = new XmlNode[] { element };
     annotation.Items.Add(item);
     type.Annotation = annotation;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:XmlSchemaExporter.cs


示例7: HandleAnnotations

		private void HandleAnnotations (XmlSchemaAnnotation an, bool nested)
		{
			foreach (XmlSchemaObject content in an.Items) {
				XmlSchemaAppInfo ai = content as XmlSchemaAppInfo;
				if (ai != null) {
					foreach (XmlNode n in ai.Markup) {
						XmlElement el = n as XmlElement;
						if (el != null && el.LocalName == "Relationship" && el.NamespaceURI == XmlConstants.MsdataNamespace)
							HandleRelationshipAnnotation (el, nested);
					}
				}
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:13,代码来源:XmlSchemaDataImporter.cs


示例8: GetDocumentation

		static string GetDocumentation(XmlSchemaAnnotation annotation)
		{
			return new SchemaDocumentation(annotation).ToString();
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:4,代码来源:XmlSchemaCompletion.cs


示例9: GetMarkup

 static string GetMarkup(XmlSchemaAnnotation ann, string filter, string language)
 {
     StringBuilder sb = new StringBuilder();
     foreach (XmlSchemaObject o in ann.Items) {
         // for xs:documentation nodes
         if (o is XmlSchemaDocumentation) {
             XmlSchemaDocumentation d = (XmlSchemaDocumentation)o;
             if (string.IsNullOrEmpty(language) || d.Language == language)
             {
                 XmlNode[] ma = d.Markup;
                 if (ma != null)
                 {
                     // if we only have the xs:documentation node (no markup)...
                     foreach (XmlNode n in ma)
                     {
                         if (!string.IsNullOrEmpty(filter))
                         {
                             if (string.Compare(filter, n.LocalName, StringComparison.InvariantCultureIgnoreCase) == 0)
                             {
                                 sb.Append(n.InnerText);
                             }
                         }
                         else
                         {
                             sb.Append(n.InnerText);
                         }
                     }
                 }
             }
         }
     }
     return sb.ToString();
 }
开发者ID:dbremner,项目名称:xmlnotepad,代码行数:33,代码来源:SchemaCache.cs


示例10: GetDocumentation

		/// <summary>
		/// Gets the documentation from the annotation element.
		/// </summary>
		/// <remarks>
		/// All documentation elements are added.  All text nodes inside
		/// the documentation element are added.
		/// </remarks>
		string GetDocumentation(XmlSchemaAnnotation annotation)
		{
			string documentation = String.Empty;
			
			if (annotation != null) {
				StringBuilder documentationBuilder = new StringBuilder();
				foreach (XmlSchemaObject schemaObject in annotation.Items) {
					XmlSchemaDocumentation schemaDocumentation = schemaObject as XmlSchemaDocumentation;
					if (schemaDocumentation != null) {
						foreach (XmlNode node in schemaDocumentation.Markup) {
							XmlText textNode = node as XmlText;
							if (textNode != null) {
								if (textNode.Data != null) {
									if (textNode.Data.Length > 0) {
										documentationBuilder.Append(textNode.Data);
									}
								}
							}
						}
					}
				}
				
				documentation = documentationBuilder.ToString();
			}
			
			return documentation;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:34,代码来源:XmlSchemaCompletionData.cs


示例11: AddElement

		/// <summary>
		/// Adds an element completion data to the collection if it does not 
		/// already exist.
		/// </summary>
		void AddElement(XmlCompletionDataCollection data, string name, string prefix, XmlSchemaAnnotation annotation)
		{
			// Get any annotation documentation.
			string documentation = GetDocumentation(annotation);
			
			AddElement(data, name, prefix, documentation);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:11,代码来源:XmlSchemaCompletionData.cs


示例12: AddAttributeValue

		/// <summary>
		/// Adds an attribute value to the completion data collection.
		/// </summary>
		void AddAttributeValue(XmlCompletionDataCollection data, string valueText, XmlSchemaAnnotation annotation)
		{
			string documentation = GetDocumentation(annotation);
			XmlCompletionData completionData = new XmlCompletionData(valueText, documentation, XmlCompletionData.DataType.XmlAttributeValue);
			data.Add(completionData);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:9,代码来源:XmlSchemaCompletionData.cs


示例13: setAnnotation

 private void setAnnotation( AbstractDef def,
                             XmlSchemaAnnotation annotation )
 {
     if ( annotation != null ) {
         string desc = string.Empty;
         foreach ( XmlSchemaObject o in annotation.Items ) {
             XmlSchemaDocumentation description = o as XmlSchemaDocumentation;
             if ( description != null ) {
                 foreach ( XmlNode node in description.Markup ) {
                     desc += node.OuterXml;
                 }
             }
             else {
                 XmlSchemaAppInfo appinfo = o as XmlSchemaAppInfo;
                 if ( o != null ) {
                     def.SetFlags( appinfo.Markup[0].InnerText );
                 }
             }
         }
         def.Desc = desc;
     }
 }
开发者ID:rafidzal,项目名称:OpenADK-csharp,代码行数:22,代码来源:SifSchema.cs


示例14: GetDescription

        /// <summary>
        /// Get the description from an xml schema object.
        /// </summary>
        /// <param name="annotation">The xml schema object.</param>
        /// <returns>The description of the object.</returns>
        private static string GetDescription(XmlSchemaAnnotation annotation)
        {
            StringBuilder documentation = new StringBuilder();

            // retrieve the documentation nodes
            foreach (XmlSchemaObject obj in annotation.Items)
            {
                XmlSchemaDocumentation doc = obj as XmlSchemaDocumentation;

                if (doc != null)
                {
                    foreach (XmlNode node in doc.Markup)
                    {
                        if (node is XmlText)
                        {
                            documentation.Append(((XmlText)node).OuterXml);
                        }
                        else if (node is XmlElement)
                        {
                            documentation.Append(((XmlElement)node).OuterXml);
                        }
                    }
                }
            }

            documentation.Replace("\t", String.Empty);
            documentation.Replace(String.Concat(Environment.NewLine, Environment.NewLine), "<br/><br/>");
            documentation.Replace(Environment.NewLine, " ");
            return htmlPrefix.Replace(documentation.ToString(), String.Empty);
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:35,代码来源:XmlSchemaCompiler.cs


示例15: Check

		public virtual void Check (ConformanceCheckContext ctx, XmlSchemaAnnotation value) {}
开发者ID:nobled,项目名称:mono,代码行数:1,代码来源:ConformanceChecker.cs


示例16: AddXmlnsAnnotation

        void AddXmlnsAnnotation(XmlSchemaComplexType type, string xmlnsMemberName) {
            XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
            XmlSchemaAppInfo appinfo = new XmlSchemaAppInfo();

            XmlDocument d = new XmlDocument();
            XmlElement e = d.CreateElement("keepNamespaceDeclarations");
            if (xmlnsMemberName != null)
                e.InsertBefore(d.CreateTextNode(xmlnsMemberName), null);
            appinfo.Markup = new XmlNode[] {e};
            annotation.Items.Add(appinfo);
            type.Annotation = annotation;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:12,代码来源:XmlSchemaExporter.cs


示例17: BuildSchema

        ///<summary>Generate XML schema for the given types
        ///</summary>
        ///<param name="ns">Default namespace</param>
        ///<param name="types">Types to include into schema</param>
        ///<param name="root">Root element</param>
        ///<param name="interfaces">Interface types</param>
        ///<returns>Built schema</returns>
        public static XmlSchema BuildSchema(string ns, Type[] types, Type root, Type[] interfaces)
        {
            XmlSchema xmlSchema = new XmlSchema();
            xmlSchema.Namespaces.Add("xsd", "http://www.w3.org/2001/XMLSchema");
            xmlSchema.Namespaces.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
            xmlSchema.ElementFormDefault = XmlSchemaForm.Qualified;
            xmlSchema.AttributeFormDefault = XmlSchemaForm.Unqualified;
            xmlSchema.Namespaces.Add("ns", ns);
            xmlSchema.TargetNamespace = ns;

            // Comment
            XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
            XmlSchemaDocumentation documentation = new XmlSchemaDocumentation();
            XmlDocument helperDocument = new XmlDocument();
            string comment = String.Format("  XML schema for {0} , generated at {1}  ", ns, DateTime.Now.ToString());
            documentation.Markup = new XmlNode[1] { helperDocument.CreateComment(comment) };
            annotation.Items.Add(documentation);
            xmlSchema.Items.Add(annotation);

            // Create group "action" to refer to any action
            var ints = new Dictionary<Type, XmlSchemaGroup>();
            if (interfaces != null)
            {
                foreach (var intf in interfaces)
                {
                    var action = new XmlSchemaGroup();
                    action.Name = getXmlTypeName(intf);
                    action.Particle = new XmlSchemaChoice();
                    xmlSchema.Items.Add(action);
                    ints.Add(intf, action);
                }
            }

            Dictionary<Type, XmlSchemaType> xmlTypes = new Dictionary<Type, XmlSchemaType>();
            foreach (var type in types)
            {
                // If it does not have our XML header - skip it
                var na = (CustomAttributeHelper.First<XsTypeAttribute>(type));
                if (na == null)
                    continue;

                // Check if it is complex or simple
                XmlSchemaComplexType ct = new XmlSchemaComplexType();
                ct.Name = getXmlTypeName(type);

                XmlSchemaObjectCollection attr = createComplexType(type, ct, ns, ints);

                // Add the new element as an option to the "action" group
                foreach (var i in ints)
                {
                    bool isAction = (type.FindInterfaces((tp, nu) => tp == i.Key, null).Length != 0);
                    if (isAction)
                    {
                        foreach (var tp in CustomAttributeHelper.All<XsTypeAttribute>(type))
                        {
                            if (!string.IsNullOrEmpty(tp.Name))
                                i.Value.Particle.Items.Add(new XmlSchemaElement
                                {
                                    Name = tp.Name,
                                    MinOccurs = 0,
                                    SchemaTypeName = new XmlQualifiedName(ct.Name, ns)
                                });
                        }
                    }
                }

                // Work with attributes
                foreach (var o in generateAttributes(xmlSchema, type, xmlTypes, ns))
                    attr.Add(o);

                if (na.AnyAttribute)
                {
                    ct.AnyAttribute = new XmlSchemaAnyAttribute
                    {
                        ProcessContents = XmlSchemaContentProcessing.Skip
                    };
                }

                // Add type to the list
                xmlTypes.Add(type, ct);
                xmlSchema.Items.Add(ct);

                if (root.IsAssignableFrom(type))
                {
                    // Add all variations of Script names as element
                    foreach (var o in CustomAttributeHelper.All<XsTypeAttribute>(root))
                    {
                        xmlSchema.Items.Add(new XmlSchemaElement
                        {
                            Name = o.Name,
                            SchemaTypeName = new XmlQualifiedName(xmlTypes[typeof(Script)].Name, ns)
                        });
                    }
//.........这里部分代码省略.........
开发者ID:xsharper,项目名称:xsharper,代码行数:101,代码来源:XsXsdGenerator.cs


示例18: AddAnnotation

 internal virtual void AddAnnotation(XmlSchemaAnnotation annotation) {}
开发者ID:ArildF,项目名称:masters,代码行数:1,代码来源:xmlschemaobject.cs


示例19: AddAttributeValue

		/// <summary>
		/// Adds an attribute value to the completion data collection.
		/// </summary>
		static void AddAttributeValue(XmlCompletionItemCollection completionItems, string valueText, XmlSchemaAnnotation annotation)
		{
			string documentation = GetDocumentation(annotation);
			XmlCompletionItem item = new XmlCompletionItem(valueText, documentation, XmlCompletionItemType.XmlAttributeValue);
			completionItems.Add(item);
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:9,代码来源:XmlSchemaCompletion.cs


示例20: HandleRelations

 private void HandleRelations(XmlSchemaAnnotation ann, bool fNested) {
     foreach (object __items in ann.Items)
     if (__items is XmlSchemaAppInfo) {
         XmlNode[] relations = ((XmlSchemaAppInfo) __items).Markup;
         for (int i = 0; i<relations.Length; i++)
         if (FEqualIdentity(relations[i], Keywords.MSD_RELATION, Keywords.MSDNS))
             HandleRelation((XmlElement)relations[i], fNested);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:XMLSchema.cs



注:本文中的System.Xml.Schema.XmlSchemaAnnotation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Schema.XmlSchemaAny类代码示例发布时间:2022-05-26
下一篇:
C# Schema.XmlSchemaAnnotated类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap