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

C# Xml.XmlAttribute类代码示例

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

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



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

示例1: GetTypeByNode

 private static PhoneNumberElementType GetTypeByNode(XmlAttribute node)
 {
     var str = node.InnerText;
     switch (str)
     {
     case "international-prefix":
         return PhoneNumberElementType.InternationalPrefix;
     case "country-prefix":
         return PhoneNumberElementType.CountryPrefix;
     case "national-prefix":
         return PhoneNumberElementType.NationalPrefix;
     case "unknown-national-prefix":
         return PhoneNumberElementType.UnknownNationalPrefix;
     case "national-code":
         return PhoneNumberElementType.NationalCode;
     case "area-code":
         return PhoneNumberElementType.AreaCode;
     case "local-number":
         return PhoneNumberElementType.LocalNumber;
     default:
         throw new MalformedXMLException (
             "The XML Received from Time and Date did not include an object name which complies with an AstronomyObjectType enum: " +
             str
         );
     }
 }
开发者ID:adny,项目名称:libtad-net,代码行数:26,代码来源:Composition.cs


示例2: ValidateXmlAnyAttributes

        /// <summary>
        /// Validates the XML any attributes.
        /// </summary>
        /// <param name="anyAttributes">Any attributes.</param>
        public void ValidateXmlAnyAttributes(XmlAttribute[] anyAttributes)
        {
            if (anyAttributes == null)
            {
                throw new ArgumentNullException("anyAttributes");
            }

            if (anyAttributes.Length == 0)
            {
                return;
            }

            foreach (var attr in anyAttributes)
            {
                if (!Saml20Utils.ValidateRequiredString(attr.Prefix))
                {
                    throw new Saml20FormatException("Attribute extension xml attributes MUST BE namespace qualified");
                }

                foreach (var samlns in Saml20Constants.SamlNamespaces)
                {
                    if (attr.NamespaceURI == samlns)
                    {
                        throw new Saml20FormatException("Attribute extension xml attributes MUST NOT use a namespace reserved by SAML");
                    }
                }
            }
        }
开发者ID:jbparker,项目名称:SAML2,代码行数:32,代码来源:Saml20XmlAnyAttributeValidator.cs


示例3: Serialize

        public void Serialize(XmlElement node)
        {
            if (ShouldIgnore(node))
                return;

            Serialize(BEGIN_ELEMENT);
            Serialize(node.NamespaceURI);
            Serialize(node.LocalName);

            var attrs = new XmlAttribute[node.Attributes.Count];
            node.Attributes.CopyTo(attrs, 0);

            Array.Sort(attrs, new AttributeComparer());

            foreach (var attr in attrs) {
                Serialize(attr);
            }

            Serialize(END_ATTRIBUTES);

            foreach (XmlNode child in node.ChildNodes) {
                if (child is XmlElement) {
                    Serialize(child as XmlElement);
                } else {
                    Serialize(child as XmlCharacterData);
                }
            }

            Serialize(END_ELEMENT);
        }
开发者ID:ben-biddington,项目名称:Brick,代码行数:30,代码来源:AdobeXmlSerializer.cs


示例4: InitAtrrib

 protected override void InitAtrrib(XmlAttribute Attr)
 {
     if(Attr.Name == "digits")
         Digits	= byte.Parse(Attr.Value);
     else if(Attr.Name == "magnitude")
         Magnitude	= short.Parse(Attr.Value);
 }
开发者ID:miquik,项目名称:leviatan-game,代码行数:7,代码来源:float_array.cs


示例5: Exception

        void IHasAttribute.InitAtrribute(XmlAttribute Attr)
        {
            switch(Attr.Name)
            {
                case "mips_generate":
                    MipGenerate	= bool.Parse(Attr.Value);
                    break;

                case "array_index":
                    ArrayIndex	= uint.Parse(Attr.Value);
                    break;

                case "mip_index":
                    MipIndex	= uint.Parse(Attr.Value);
                    break;

                case "depth":
                    Depth	= uint.Parse(Attr.Value);
                    break;

                case "face":
                    Face	= (CubeFace)Enum.Parse(typeof(CubeFace),Attr.Value);
                    break;

                default:
                    throw new Exception("Invalid Atrribute");
            }
        }
开发者ID:miquik,项目名称:leviatan-game,代码行数:28,代码来源:init_from.cs


示例6: ParseAttribute

 /// <summary>
 /// Processes an attribute for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="attribute">Attribute to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseAttribute(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlAttribute attribute, Dictionary<string, string> contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "ExePackage":
         case "MsiPackage":
         case "MspPackage":
         case "MsuPackage":
             string packageId;
             if (!contextValues.TryGetValue("PackageId", out packageId) || String.IsNullOrEmpty(packageId))
             {
                 this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, parentElement.LocalName, "Id", attribute.LocalName));
             }
             else
             {
                 switch (attribute.LocalName)
                 {
                     case "PrereqSupportPackage":
                         if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute))
                         {
                             Row row = this.Core.CreateRow(sourceLineNumbers, "MbaPrerequisiteSupportPackage");
                             row[0] = packageId;
                         }
                         break;
                     default:
                         this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                         break;
                 }
             }
                 break;
         case "Variable":
             // at the time the extension attribute is parsed, the compiler might not yet have
             // parsed the Name attribute, so we need to get it directly from the parent element.
             string variableName = parentElement.GetAttribute("Name");
             if (String.IsNullOrEmpty(variableName))
             {
                 this.Core.OnMessage(WixErrors.ExpectedParentWithAttribute(sourceLineNumbers, "Variable", "Overridable", "Name"));
             }
             else
             {
                 switch (attribute.LocalName)
                 {
                     case "Overridable":
                         if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute))
                         {
                             Row row = this.Core.CreateRow(sourceLineNumbers, "WixStdbaOverridableVariable");
                             row[0] = variableName;
                         }
                         break;
                     default:
                         this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                         break;
                 }
             }
             break;
         default:
             this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
             break;
     }
 }
开发者ID:zooba,项目名称:wix3,代码行数:67,代码来源:BalCompiler.cs


示例7: GetValueAsString

        public static string GetValueAsString(XmlAttribute attribute, string defaultValue)
        {
            if (attribute == null)
                return defaultValue;

            return Mask.EmptyString(attribute.Value, defaultValue);
        }
开发者ID:ThePublicTheater,项目名称:NYSF,代码行数:7,代码来源:ConfigurationSectionHelper.cs


示例8: GetXmlAttributeAsString

        private string GetXmlAttributeAsString(XmlAttribute attribute) {

            if (attribute == null) return "";

            return attribute.Value.Trim();

        }
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:7,代码来源:helpRedirect.aspx.cs


示例9: ConditionEvaluationState

 internal ConditionEvaluationState(XmlAttribute conditionAttribute, Expander expanderToUse, Hashtable conditionedPropertiesInProject, string parsedCondition)
 {
     this.conditionAttribute = conditionAttribute;
     this.expanderToUse = expanderToUse;
     this.conditionedPropertiesInProject = conditionedPropertiesInProject;
     this.parsedCondition = parsedCondition;
 }
开发者ID:nikson,项目名称:msbuild,代码行数:7,代码来源:ConditionEvaluationState.cs


示例10: ExecuteCore

 protected override void ExecuteCore(XmlAttribute attribute)
 {
     var data = string.Format("{0}=\"{1}\"", attribute.Name, attribute.Value);
     var section = attribute.OwnerDocument.CreateCDataSection(data);
     attribute.OwnerElement.PrependChild(section);
     attribute.OwnerElement.Attributes.Remove(attribute);
 }
开发者ID:rh,项目名称:mix,代码行数:7,代码来源:ConvertToCdataSection.cs


示例11: ParseAttribute

 /// <summary>
 /// Processes an attribute for the Compiler.
 /// </summary>
 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
 /// <param name="parentElement">Parent element of element to process.</param>
 /// <param name="attribute">Attribute to process.</param>
 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
 public override void ParseAttribute(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlAttribute attribute, Dictionary<string, string> contextValues)
 {
     switch (parentElement.LocalName)
     {
         case "Extension":
             // at the time the IsRichSavedGame extension attribute is parsed, the compiler
             // might not yet have parsed the Id attribute, so we need to get it directly
             // from the parent element and put it into the contextValues dictionary.
             string extensionId = parentElement.GetAttribute("Id");
             if (String.IsNullOrEmpty(extensionId))
             {
                 this.Core.OnMessage(WixErrors.ExpectedParentWithAttribute(sourceLineNumbers, "Extension", "IsRichSavedGame", "Id"));
             }
             else
             {
                 contextValues["ExtensionId"] = extensionId;
                 switch (attribute.LocalName)
                 {
                     case "IsRichSavedGame":
                         if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute))
                         {
                             this.ProcessIsRichSavedGameAttribute(sourceLineNumbers, contextValues);
                         }
                         break;
                     default:
                         this.Core.UnexpectedAttribute(sourceLineNumbers, attribute);
                         break;
                 }
             }
             break;
         default:
             this.Core.UnexpectedElement(parentElement, parentElement);
             break;
     }
 }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:42,代码来源:GamingCompiler.cs


示例12: GetModifiedDateTime

 private static DateTime GetModifiedDateTime(DateTime dateTime, XmlAttribute attr, int value)
 {
     switch (attr.Name.ToLower(CultureInfo.InvariantCulture))
     {
         case "year":
         case "addyear":
             dateTime = dateTime.AddYears(value);
             break;
         case "month":
         case "addmonth":
             dateTime = dateTime.AddMonths(value);
             break;
         case "week":
         case "addweek":
             dateTime = dateTime.AddDays(value * 7);
             break;
         case "day":
         case "adday":
             dateTime = dateTime.AddDays(value);
             break;
         case "hour":
         case "addhour":
             dateTime = dateTime.AddHours(value);
             break;
         case "min":
         case "addmin":
             dateTime = dateTime.AddMinutes(value);
             break;
         case "sec":
         case "addsec":
             dateTime = dateTime.AddSeconds(value);
             break;
     }
     return dateTime;
 }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:35,代码来源:DateTimeParser.cs


示例13: XmlAttributeEventArgs

		internal XmlAttributeEventArgs(XmlAttribute attr, int lineNum, int linePos, object source)
		{
			this.attr		= attr;
			this.lineNumber = lineNum;
			this.linePosition = linePos;
			this.obj		= source;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:XmlAttributeEventArgs.cs


示例14: FilterNull

 // Methods
 private static string FilterNull(XmlAttribute strValue)
 {
     if (strValue != null)
     {
         return strValue.Value.ToString();
     }
     return "";
 }
开发者ID:habins,项目名称:WebDS,代码行数:9,代码来源:FactoryDef.cs


示例15: XmlAttributeEventArgs

 internal XmlAttributeEventArgs(XmlAttribute attr, int lineNumber, int linePosition, object o, string qnames)
 {
     this.attr = attr;
     this.o = o;
     this.qnames = qnames;
     this.lineNumber = lineNumber;
     this.linePosition = linePosition;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XmlAttributeEventArgs.cs


示例16: AddXmlNode

        void AddXmlNode(XmlNode node, XmlAttribute attribute)
        {
            if (mResourceNodes.ContainsKey(attribute.Value.ToString()))
                return;

            mResourceNodes.Add(attribute.Value.ToString(), node);
            mResourceNameList.Add(attribute.Value.ToString());
        }
开发者ID:jspraul,项目名称:sortresx,代码行数:8,代码来源:FileProcessor.cs


示例17: AreEqual

 static bool AreEqual(XmlAttribute lhs, XmlAttribute rhs)
 {
     if(lhs.Name != rhs.Name)
         return false;
     if (lhs.Value != rhs.Value)
         return false;
     return true;
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:XmlDocumentComparison.cs


示例18: DocumentXPathNavigator

 XmlAttribute attrXmlNS;  //Used for "Xml" namespace attribute which should be present on all nodes.
 internal DocumentXPathNavigator( XmlNode node ) {
     Debug.Assert( ( (int)(node.XPNodeType) ) != -1 );
     _curNode = node;
     _doc = (_curNode.NodeType == XmlNodeType.Document) ? (XmlDocument)_curNode : _curNode.OwnerDocument;
     _attrInd = -1;
     attrXmlNS = _doc.CreateAttribute( "xmlns", "xml", XmlDocument.strReservedXmlns );
     attrXmlNS.Value = "http://www.w3.org/XML/1998/namespace";
 }
开发者ID:ArildF,项目名称:masters,代码行数:9,代码来源:documentxpathnavigator.cs


示例19: GetRelativePath

 private static string GetRelativePath(XmlAttribute attribute)
 {
     var path = attribute.Value;
     if (!path.Contains(Constants.BACKSLASH)){
         return null;
     }
     var lastSlash = path.LastIndexOf(Constants.BACKSLASH, StringComparison.Ordinal);
     return path.Substring(0, lastSlash + 1);
 }
开发者ID:raaffc,项目名称:objectified-solutions,代码行数:9,代码来源:CppProjFileParser.cs


示例20: InitAtrrib

 void IHasAttribute.InitAtrribute(XmlAttribute Attr)
 {
     if(ID == "mesh2-geometry-position-array")
     {
     }
     if(Attr.Name == "count")
         Count	= uint.Parse(Attr.Value);
     else InitAtrrib(Attr);
 }
开发者ID:miquik,项目名称:leviatan-game,代码行数:9,代码来源:array_element.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Xml.XmlAttributeCollection类代码示例发布时间:2022-05-26
下一篇:
C# Xml.UniqueId类代码示例发布时间: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