示例#1
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationEncodingAfterName(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c == Symbols.Equality)
                return DeclarationEncodingBeforeValue(GetNext(), decl);

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#2
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationVersionBeforeValue(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
                return DeclarationVersionValue(GetNext(), c, decl);

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#3
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneAfterName(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (c != Symbols.Equality)
            {
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
            }

            return(DeclarationStandaloneBeforeValue(decl));
        }
示例#4
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneBeforeValue(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (c != Symbols.DoubleQuote && c != Symbols.SingleQuote)
            {
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
            }

            return(DeclarationStandaloneValue(decl, c));
        }
示例#5
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationAfterEncoding(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (ContinuesWithSensitive(AttributeNames.Standalone))
            {
                Advance(9);
                return(DeclarationStandaloneAfterName(decl));
            }

            return(DeclarationEnd(c, decl));
        }
示例#6
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationAfterEncoding(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (ContinuesWith(AttributeNames.Standalone, false))
            {
                Advance(9);
                return DeclarationStandaloneAfterName(GetNext(), decl);
            }

            return DeclarationEnd(c, decl);
        }
示例#7
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneBeforeValue(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
            {
                c = GetNext();
            }

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
            {
                return(DeclarationStandaloneValue(GetNext(), c, decl));
            }

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#8
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneAfterName(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
            {
                c = GetNext();
            }

            if (c == Symbols.Equality)
            {
                return(DeclarationStandaloneBeforeValue(GetNext(), decl));
            }

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#9
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-XMLDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlDeclarationToken DeclarationEnd(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
            {
                c = GetNext();
            }

            if (c != Symbols.QuestionMark || GetNext() != Symbols.GreaterThan)
            {
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
            }

            return(decl);
        }
示例#10
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationEncodingBeforeValue(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
            {
                var q = c;
                c = GetNext();

                if (c.IsLetter())
                    return DeclarationEncodingValue(c, q, decl);
            }

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#11
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationEncodingBeforeValue(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
            {
                var q = c;
                c = GetNext();

                if (c.IsLetter())
                {
                    StringBuffer.Append(c);
                    return(DeclarationEncodingValue(decl, q));
                }
            }

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#12
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The quote character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationVersionValue(Char c, Char q, XmlDeclarationToken decl)
        {
            while (c != q)
            {
                if (c == Symbols.EndOfFile)
                    throw XmlParseError.EOF.At(GetCurrentPosition());

                _stringBuffer.Append(c);
                c = GetNext();
            }

            decl.Version = FlushBuffer();
            c = GetNext();

            if (c.IsSpaceCharacter())
                return DeclarationAfterVersion(c, decl);

            return DeclarationEnd(c, decl);
        }
示例#13
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-VersionNum.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationAfterVersion(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
            {
                c = GetNext();
            }

            if (ContinuesWithSensitive(AttributeNames.Encoding))
            {
                Advance(7);
                return(DeclarationEncodingAfterName(GetNext(), decl));
            }
            else if (ContinuesWithSensitive(AttributeNames.Standalone))
            {
                Advance(9);
                return(DeclarationStandaloneAfterName(GetNext(), decl));
            }

            return(DeclarationEnd(c, decl));
        }
示例#14
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The quote character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneValue(Char c, Char q, XmlDeclarationToken decl)
        {
            while (c != q)
            {
                if (c == Symbols.EndOfFile)
                    throw XmlParseError.EOF.At(GetCurrentPosition());

                _stringBuffer.Append(c);
                c = GetNext();
            }

            var s = FlushBuffer();

            if (s.Equals(YesIdentifier))
                decl.Standalone = true;
            else if (s.Equals(NoIdentifier))
                decl.Standalone = false;
            else
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());

            return DeclarationEnd(GetNext(), decl);
        }
示例#15
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The quote character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationEncodingValue(Char c, Char q, XmlDeclarationToken decl)
        {
            do
            {
                if (c.IsAlphanumericAscii() || c == Symbols.Dot || c == Symbols.Underscore || c == Symbols.Minus)
                {
                    _stringBuffer.Append(c);
                    c = GetNext();
                }
                else
                    throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
            }
            while (c != q);

            decl.Encoding = FlushBuffer();
            c = GetNext();

            if (c.IsSpaceCharacter())
                return DeclarationAfterEncoding(c, decl);

            return DeclarationEnd(c, decl);
        }
示例#16
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        /// <param name="quote">The quote character.</param>
        private XmlToken DeclarationVersionValue(XmlDeclarationToken decl, Char quote)
        {
            var c = GetNext();

            while (c != quote)
            {
                if (c == Symbols.EndOfFile)
                    throw XmlParseError.EOF.At(GetCurrentPosition());

                StringBuffer.Append(c);
                c = GetNext();
            }

            decl.Version = FlushBuffer();
            c = GetNext();

            if (c.IsSpaceCharacter())
            {
                return DeclarationAfterVersion(decl);
            }

            return DeclarationEnd(c, decl);
        }
示例#17
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The quote character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationVersionValue(Char c, Char q, XmlDeclarationToken decl)
        {
            while (c != q)
            {
                if (c == Symbols.EndOfFile)
                    throw XmlParseError.EOF.At(GetCurrentPosition());

                _stringBuffer.Append(c);
                c = GetNext();
            }

            decl.Version = FlushBuffer();
            c = GetNext();

            if (c.IsSpaceCharacter())
                return DeclarationAfterVersion(c, decl);

            return DeclarationEnd(c, decl);
        }
示例#18
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-VersionNum.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationAfterVersion(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (ContinuesWith(AttributeNames.Encoding, false))
            {
                Advance(7);
                return DeclarationEncodingAfterName(GetNext(), decl);
            }
            else if (ContinuesWith(AttributeNames.Standalone, false))
            {
                Advance(9);
                return DeclarationStandaloneAfterName(GetNext(), decl);
            }

            return DeclarationEnd(c, decl);
        }
示例#19
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        /// <param name="quote">The quote character.</param>
        private XmlToken DeclarationStandaloneValue(XmlDeclarationToken decl, Char quote)
        {
            var c = GetNext();

            while (c != quote)
            {
                if (c == Symbols.EndOfFile)
                    throw XmlParseError.EOF.At(GetCurrentPosition());

                StringBuffer.Append(c);
                c = GetNext();
            }

            var s = FlushBuffer();

            if (s.Is(Keywords.Yes))
            {
                decl.Standalone = true;
            }
            else if (s.Is(Keywords.No))
            {
                decl.Standalone = false;
            }
            else
            {
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
            }

            return DeclarationEnd(GetNext(), decl);
        }
示例#20
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        private XmlToken DeclarationStandaloneBeforeValue(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (c != Symbols.DoubleQuote && c != Symbols.SingleQuote)
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());

            return DeclarationStandaloneValue(decl, c);
        }
示例#21
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The quote character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationEncodingValue(Char c, Char q, XmlDeclarationToken decl)
        {
            do
            {
                if (c.IsAlphanumericAscii() || c == Symbols.Dot || c == Symbols.Underscore || c == Symbols.Minus)
                {
                    _stringBuffer.Append(c);
                    c = GetNext();
                }
                else
                    throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
            }
            while (c != q);

            decl.Encoding = FlushBuffer();
            c = GetNext();

            if (c.IsSpaceCharacter())
                return DeclarationAfterEncoding(c, decl);

            return DeclarationEnd(c, decl);
        }
示例#22
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The quote character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneValue(Char c, Char q, XmlDeclarationToken decl)
        {
            while (c != q)
            {
                if (c == Symbols.EndOfFile)
                    throw XmlParseError.EOF.At(GetCurrentPosition());

                _stringBuffer.Append(c);
                c = GetNext();
            }

            var s = FlushBuffer();

            if (s.Is(Keywords.Yes))
                decl.Standalone = true;
            else if (s.Is(Keywords.No))
                decl.Standalone = false;
            else
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());

            return DeclarationEnd(GetNext(), decl);
        }
示例#23
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneAfterName(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c == Symbols.Equality)
                return DeclarationStandaloneBeforeValue(GetNext(), decl);

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#24
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationEncodingBeforeValue(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
            {
                var q = c;
                c = GetNext();

                if (c.IsLetter())
                    return DeclarationEncodingValue(c, q, decl);
            }

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#25
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        private XmlToken DeclarationEncodingBeforeValue(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
            {
                var q = c;
                c = GetNext();

                if (c.IsLetter())
                {
                    StringBuffer.Append(c);
                    return DeclarationEncodingValue(decl, q);
                }
            }

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#26
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationAfterEncoding(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (ContinuesWithSensitive(AttributeNames.Standalone))
            {
                Advance(9);
                return DeclarationStandaloneAfterName(GetNext(), decl);
            }

            return DeclarationEnd(c, decl);
        }
示例#27
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        /// <param name="quote">The quote character.</param>
        private XmlToken DeclarationEncodingValue(XmlDeclarationToken decl, Char quote)
        {
            var c = GetNext();

            while (c != quote)
            {
                if (!c.IsAlphanumericAscii() && c != Symbols.Dot && c != Symbols.Underscore && c != Symbols.Minus)
                    throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());

                StringBuffer.Append(c);
                c = GetNext();
            }

            decl.Encoding = FlushBuffer();
            c = GetNext();

            if (c.IsSpaceCharacter())
            {
                return DeclarationAfterEncoding(decl);
            }

            return DeclarationEnd(c, decl);
        }
示例#28
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlToken DeclarationStandaloneBeforeValue(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote)
                return DeclarationStandaloneValue(GetNext(), c, decl);

            throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());
        }
示例#29
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        private XmlToken DeclarationAfterEncoding(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (ContinuesWithSensitive(AttributeNames.Standalone))
            {
                Advance(9);
                return DeclarationStandaloneAfterName(decl);
            }

            return DeclarationEnd(c, decl);
        }
示例#30
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-XMLDecl.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="decl">The current declaration token.</param>
        XmlDeclarationToken DeclarationEnd(Char c, XmlDeclarationToken decl)
        {
            while (c.IsSpaceCharacter())
                c = GetNext();

            if (c != Symbols.QuestionMark || GetNext() != Symbols.GreaterThan)
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());

            return decl;
        }
示例#31
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl.
        /// </summary>
        /// <param name="decl">The current declaration token.</param>
        private XmlToken DeclarationStandaloneAfterName(XmlDeclarationToken decl)
        {
            var c = SkipSpaces();

            if (c != Symbols.Equality)
                throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition());

            return DeclarationStandaloneBeforeValue(decl);
        }