Пример #1
0
        /// <summary>
        /// See 8.2.4.58 DOCTYPE public identifier (double-quoted) state
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The closing character.</param>
        /// <param name="doctype">The current doctype token.</param>
        /// <returns>The emitted token.</returns>
        XmlToken DoctypePublicIdentifierValue(Char c, Char q, XmlDoctypeToken doctype)
        {
            while (c != q)
            {
                if (!c.IsPubidChar())
                    throw XmlParseError.XmlInvalidPubId.At(GetCurrentPosition());

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

            doctype.PublicIdentifier = FlushBuffer();
            return DoctypePublicIdentifierAfter(GetNext(), doctype);
        }
Пример #2
0
        DtdNotationToken NotationDeclarationSystem(Char c, Char quote, DtdNotationToken decl)
        {
            _stringBuffer.Clear();

            while (true)
            {
                if (c == Specification.EOF)
                {
                    RaiseErrorOccurred(ErrorCode.EOF);
                    _src.Back();
                    decl.SystemIdentifier = _stringBuffer.ToString();
                    return decl;
                }
                else if (c == Specification.NULL)
                {
                    RaiseErrorOccurred(ErrorCode.NULL);
                    _stringBuffer.Append(Specification.REPLACEMENT);
                }
                else if (c == quote)
                {
                    decl.SystemIdentifier = _stringBuffer.ToString();
                    return NotationDeclarationAfterSystem(_src.Next, decl);
                }
                else if (c.IsPubidChar())
                    _stringBuffer.Append(c);
                else
                    RaiseErrorOccurred(ErrorCode.InvalidCharacter);

                c = _src.Next;
            }
        }
Пример #3
0
        DtdToken EntityDeclarationPublic(Char c, Char quote, DtdEntityToken decl)
        {
            while (c != quote)
            {
                if (!c.IsPubidChar())
                    throw Errors.Xml(ErrorCode.DtdEntityInvalid);

                _stringBuffer.Append(c);
                c = _stream.Next;
            }

            decl.PublicIdentifier = _stringBuffer.ToString();
            return EntityDeclarationBeforeSystem(_stream.Next, decl);
        }
Пример #4
0
        DtdNotationToken NotationDeclarationPublic(Char c, Char quote, DtdNotationToken decl)
        {
            _stringBuffer.Clear();

            while (c != quote)
            {
                if (c == Specification.EOF)
                    throw Errors.Xml(ErrorCode.DtdNotationInvalid);
                else if (!c.IsPubidChar())
                    throw Errors.Xml(ErrorCode.XmlInvalidPubId);

                _stringBuffer.Append(c);
                c = _stream.Next;
            }

            decl.PublicIdentifier = _stringBuffer.ToString();
            return NotationDeclarationAfterPublic(_stream.Next, decl);
        }
Пример #5
0
        /// <summary>
        /// See 8.2.4.58 DOCTYPE public identifier (double-quoted) state
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="q">The closing character.</param>
        /// <param name="doctype">The current doctype token.</param>
        /// <returns>The emitted token.</returns>
        XmlToken DoctypePublicIdentifierValue(Char c, Char q, XmlDoctypeToken doctype)
        {
            while (c != q)
            {
                if (!c.IsPubidChar())
                    throw Errors.Xml(ErrorCode.XmlInvalidPubId);

                _stringBuffer.Append(c);
                c = _src.Next;
            }

            doctype.PublicIdentifier = _stringBuffer.ToString();
            _stringBuffer.Clear();
            return DoctypePublicIdentifierAfter(_src.Next, doctype);
        }