System.Xml.XmlReader.IsStartElement C# (CSharp) Method

IsStartElement() public method

public IsStartElement ( ) : bool
return bool
        public virtual bool IsStartElement()
        {
            return MoveToContent() == XmlNodeType.Element;
        }

Same methods

XmlReader::IsStartElement ( string name ) : bool
XmlReader::IsStartElement ( string localname, string ns ) : bool

Usage Example

        /// <summary>
        /// Reads the match.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="reader">The reader.</param>
        /// <returns></returns>
        /// <exception cref="System.Xml.XmlException">MatchId IsNullOrEmpty</exception>
        protected override XacmlMatch ReadMatch(XmlReader reader) {
            Contract.Requires<ArgumentNullException>(reader != null, "reader");
            Contract.Requires<XmlException>(reader.IsStartElement(XacmlConstants.ElementNames.Match, this.version.NamespacePolicy));

            var gaMatchId = reader.GetAttribute("MatchId");
            if (string.IsNullOrEmpty(gaMatchId)) {
                throw Diagnostic.DiagnosticTools.ExceptionUtil.ThrowHelperError(new XmlException("MatchId IsNullOrEmpty"));
            }

            reader.ReadStartElement(XacmlConstants.ElementNames.Match, this.version.NamespacePolicy);

            var attributeValue = ReadAttributeValue(reader);

            XacmlMatch result;
            if (reader.IsStartElement(XacmlConstants.ElementNames.AttributeDesignator, this.version.NamespacePolicy)) {
                var attributeDesignator = this.ReadAttributeDesignator(reader) as XacmlAttributeDesignator;
                result = new XacmlMatch(new Uri(gaMatchId, UriKind.RelativeOrAbsolute), attributeValue, attributeDesignator);
            }
            else {
                XacmlAttributeSelector attributeSelector = ReadAttributeSelector(reader);
                result = new XacmlMatch(new Uri(gaMatchId, UriKind.RelativeOrAbsolute), attributeValue, attributeSelector);
            }

            reader.ReadEndElement();
            return result;
        }
All Usage Examples Of System.Xml.XmlReader::IsStartElement