当前位置: 首页>>代码示例>>C#>>正文


C# XmlReader.MoveToNextAttribute方法代码示例

本文整理汇总了C#中System.Xml.XmlReader.MoveToNextAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.MoveToNextAttribute方法的具体用法?C# XmlReader.MoveToNextAttribute怎么用?C# XmlReader.MoveToNextAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlReader的用法示例。


在下文中一共展示了XmlReader.MoveToNextAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: while

        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "usage":
                        Usage = reader.ReadContentAsInt();
                        break;
                    case "predicate":
                        PredicateName = reader.Value;
                        break;
                    case "namespace":
                        NamespaceName = reader.Value;
                        break;
                    case "first_added":
                        DateFirstAdded = UtilityMethods.UnixTimestampToDate(reader.Value);
                        break;
                    case "last_added":
                        DateLastUsed = UtilityMethods.UnixTimestampToDate(reader.Value);
                        break;
                }
            }

            reader.Read();

            if (reader.NodeType == XmlNodeType.Text)
                ValueText = reader.ReadContentAsString();

            reader.Read();
        }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:31,代码来源:Value.cs

示例2: while

 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
     {
         switch (reader.LocalName)
         {
             case "id":
                 PhotoId = reader.Value;
                 break;
             case "ispublic":
                 IsPublic = reader.Value == "1";
                 break;
             case "iscontact":
                 IsContact = reader.Value == "1";
                 break;
             case "isfamily":
                 IsFamily = reader.Value == "1";
                 break;
             case "isfriend":
                 IsFriend = reader.Value == "1";
                 break;
         }
     }
     reader.Read();
 }
开发者ID:ghostnguyen,项目名称:f503cd14-7a08-48cb-a2b6-d607c618743e,代码行数:25,代码来源:GeoPermissions.cs

示例3: ReadNodes

 public static XmlNode[] ReadNodes(XmlReader xmlReader)
 {
     if (xmlReader == null)
         throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("xmlReader");
     XmlDocument doc = new XmlDocument();
     List<XmlNode> nodeList = new List<XmlNode>();
     if (xmlReader.MoveToFirstAttribute())
     {
         do
         {
             if (IsValidAttribute(xmlReader))
             {
                 XmlNode node = doc.ReadNode(xmlReader);
                 if (node == null)
                     throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnexpectedEndOfFile)));
                 nodeList.Add(node);
             }
         } while (xmlReader.MoveToNextAttribute());
     }
     xmlReader.MoveToElement();
     if (!xmlReader.IsEmptyElement)
     {
         int startDepth = xmlReader.Depth;
         xmlReader.Read();
         while (xmlReader.Depth > startDepth && xmlReader.NodeType != XmlNodeType.EndElement)
         {
             XmlNode node = doc.ReadNode(xmlReader);
             if (node == null)
                 throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnexpectedEndOfFile)));
             nodeList.Add(node);
         }
     }
     return nodeList.ToArray();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:XmlSerializableServices.cs

示例4: Parse

 public FlatXml Parse(XmlReader reader)
 {
     var nodes = new SortedSet<FlatXmlNode>();
     var position = 0;
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
             case XmlNodeType.Element:
                 var element = new FlatXmlNode {Name = reader.Name, Depth = reader.Depth, Position = position};
                 nodes.Add(element);
                 if (reader.HasAttributes)
                 {
                     while (reader.MoveToNextAttribute())
                     {
                         position += 1;
                         var attribute = new FlatXmlNode {Name = reader.Name, Value = reader.Value, Position = position, Depth = reader.Depth};
                         nodes.Add(attribute);
                     }
                 }
                 break;
             case XmlNodeType.Text:
                 var t = new FlatXmlNode {Value = reader.Value, Depth = reader.Depth, Position = position};
                 nodes.Add(t);
                 break;
         }
         position += 1;
     }
     return new FlatXml(nodes);
 }
开发者ID:kalotay,项目名称:UnorderedXmlComparer,代码行数:30,代码来源:FlatXmlParser.cs

示例5: while

 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "id":
     this.LicenseId = (LicenseType) reader.ReadContentAsInt();
     continue;
       case "name":
     this.LicenseName = reader.Value;
     continue;
       case "url":
     if (!string.IsNullOrEmpty(reader.Value))
     {
       this.LicenseUrl = reader.Value;
       continue;
     }
     else
       continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
开发者ID:rmck,项目名称:FlickrNet,代码行数:26,代码来源:License.cs

示例6: ProcessEnvelopeNode

        public static EsriEnvelope ProcessEnvelopeNode(XmlReader envelopeNode)
        {
            string realVal;
            EsriEnvelope env = new EsriEnvelope();

            while (envelopeNode.MoveToNextAttribute())
            {
                // international numbers
                realVal = envelopeNode.Value.Replace(',', '.');

                switch (envelopeNode.Name)
                {
                    case "maxx":
                        env.maxX = double.Parse(realVal);
                        break;
                    case "maxy":
                        env.maxY = double.Parse(realVal);
                        break;
                    case "minx":
                        env.minX = double.Parse(realVal);
                        break;
                    case "miny":
                        env.minY = double.Parse(realVal);
                        break;
                }
            }

            return env;
        }
开发者ID:groganrj,项目名称:gdis-inspiring,代码行数:29,代码来源:EsriObjects.cs

示例7: ReadXml

        public void ReadXml(XmlReader reader)
        {
            bool isEmpty = reader.IsEmptyElement;

            if (reader.HasAttributes)
            {
                for (int i = 0; i < reader.AttributeCount; i++)
                {
                    reader.MoveToNextAttribute();

                    if (reader.NamespaceURI == "")
                    {
                        if (reader.LocalName == "state")
                        {
                            State = reader.Value;
                        }
                        else
                        {
                            AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), reader.Value);
                        }
                    }
                }
            }

            reader.ReadStartElement();

            AddElementExtensions(reader, isEmpty);
        }
开发者ID:amirhalatzi,项目名称:MediaRssSharp,代码行数:28,代码来源:Status.cs

示例8: Load

        void IFlickrParsable.Load(XmlReader reader)
        {
            Load(reader, false);

            if (reader.LocalName != "stats")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "views":
                        StatViews = int.Parse(reader.Value, NumberFormatInfo.InvariantInfo);
                        break;
                    case "comments":
                        StatComments = int.Parse(reader.Value, NumberFormatInfo.InvariantInfo);
                        break;
                    case "favorites":
                        StatFavorites = int.Parse(reader.Value, NumberFormatInfo.InvariantInfo);
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();

            if (reader.LocalName == "description")
                Description = reader.ReadElementContentAsString();

            reader.Skip();
        }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:35,代码来源:PopularPhoto.cs

示例9: while

        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "blog")
                UtilityMethods.CheckParsingException(reader);

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "id":
                        BlogId = reader.Value;
                        break;
                    case "name":
                        BlogName = reader.Value;
                        break;
                    case "url":
                        BlogUrl = reader.Value;
                        break;
                    case "needspassword":
                        NeedsPassword = reader.Value == "1";
                        break;
                    case "service":
                        Service = reader.Value;
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }
        }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:30,代码来源:Blog.cs

示例10: while

 void IFlickrParsable.Load(XmlReader reader)
 {
     if (!(reader.LocalName != "blog"))
     ;
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "id":
     this.BlogId = reader.Value;
     continue;
       case "name":
     this.BlogName = reader.Value;
     continue;
       case "url":
     this.BlogUrl = reader.Value;
     continue;
       case "needspassword":
     this.NeedsPassword = reader.Value == "1";
     continue;
       case "service":
     this.Service = reader.Value;
     continue;
       default:
     continue;
     }
       }
 }
开发者ID:rmck,项目名称:FlickrNet,代码行数:28,代码来源:Blog.cs

示例11: AttributeValueElementReadWrite

 /// <summary>
 /// Creates an instance of the AttributeValue class using the XmlReader and the name of the node that 
 /// defines the AttributeValue. 
 /// </summary>
 /// <param name="reader">The XmlReader positioned at the node AttributeValue.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public AttributeValueElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
     : base(XacmlSchema.Policy, schemaVersion)
 {
     if (reader == null) throw new ArgumentNullException("reader");
     if (reader.LocalName == Consts.Schema1.AttributeValueElement.AttributeValue &&
         ValidateSchema(reader, schemaVersion))
     {
         if (reader.HasAttributes)
         {
             // Load all the attributes
             while (reader.MoveToNextAttribute())
             {
                 if (reader.LocalName == Consts.Schema1.AttributeValueElement.DataType)
                 {
                     _dataType = reader.GetAttribute(Consts.Schema1.AttributeValueElement.DataType);
                 }
             }
             reader.MoveToElement();
         }
         // Load the node contents
         _contents = reader.ReadInnerXml();
     }
     else
     {
         throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
     }
 }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:33,代码来源:AttributeValueElementReadWrite.cs

示例12: CreateResponseException

 public static Exception CreateResponseException(XmlReader reader)
 {
     if (reader == null)
     throw new ArgumentNullException("reader");
       reader.MoveToElement();
       if (!reader.ReadToDescendant("err"))
     throw new XmlException("No error element found in XML");
       int code = 0;
       string message = (string) null;
       while (reader.MoveToNextAttribute())
       {
     if (reader.LocalName == "code")
     {
       try
       {
     code = int.Parse(reader.Value, NumberStyles.Any, (IFormatProvider) NumberFormatInfo.InvariantInfo);
       }
       catch (FormatException ex)
       {
     throw new FlickrException("Invalid value found in code attribute. Value '" + (object) code + "' is not an integer");
       }
     }
     else if (reader.LocalName == "msg")
       message = reader.Value;
       }
       return (Exception) ExceptionHandler.CreateException(code, message);
 }
开发者ID:rmck,项目名称:FlickrNet,代码行数:27,代码来源:ExceptionHandler.cs

示例13: while

        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "nsid":
                        GroupId = reader.Value;
                        break;
                    case "name":
                        GroupName = reader.Value;
                        break;
                    case "admin":
                        IsAdmin = reader.Value == "1";
                        break;
                    case "eighteenplus":
                        EighteenPlus = reader.Value == "1";
                        break;
                    case "invitation_only":
                        InvitationOnly = reader.Value == "1";
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();
        }
开发者ID:liquidboy,项目名称:X,代码行数:29,代码来源:PublicGroupInfo.cs

示例14: ReadXml

        public void ReadXml(XmlReader reader)
        {
            var isEmpty = reader.IsEmptyElement;

            if (reader.HasAttributes)
            {
                for (var i = 0; i < reader.AttributeCount; i++)
                {
                    reader.MoveToNextAttribute();

                    if (reader.NamespaceURI == "")
                    {
                        if (reader.LocalName == "type")
                        {
                            Type = reader.Value;
                        }
                        else
                        {
                            AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), reader.Value);
                        }
                    }
                }
            }

            reader.ReadStartElement();

            if (!isEmpty)
            {
                DescriptionText = reader.ReadContentAsString();
            }

            reader.ReadEndElement();
        }
开发者ID:amirhalatzi,项目名称:MediaRssSharp,代码行数:33,代码来源:Description.cs

示例15: ReadXml

        public virtual void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();
            if (reader.HasAttributes)
                while (reader.MoveToNextAttribute())
                    AttributeWasRead(reader.Name, reader.Value);

            AllAttributesRead();

            var isEmpty = reader.IsEmptyElement;
            if (!isEmpty)
            {
                while (reader.Read())
                {
                    var nodeType = reader.NodeType;
                    switch (nodeType)
                    {
                        case XmlNodeType.Text:
                            var content = reader.ReadContentAsString();
                            ContentWasRead(string.Empty, content);
                            break;
                        case XmlNodeType.Element:
                            var name = reader.Name;
                            ProcessElement(name, reader);
                            break;
                    }
                }
            }
        }
开发者ID:paulomouat,项目名称:spikes,代码行数:29,代码来源:XmlSerializable.cs


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