Exemple #1
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#sec-pi.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="pi">The processing instruction token.</param>
        protected XmlToken ProcessingTarget(Char c, XmlPIToken pi)
        {
            while (true)
            {
                if (c.IsSpaceCharacter())
                {
                    pi.Target = _stringBuffer.ToString();
                    _stringBuffer.Clear();
                    return(ProcessingContent(_src.Next, pi));
                }
                else if (c == Specification.QM)
                {
                    pi.Target = _stringBuffer.ToString();
                    _stringBuffer.Clear();
                    return(ProcessingContent(c, pi));
                }
                else if (c == Specification.NULL)
                {
                    RaiseErrorOccurred(ErrorCode.NULL);
                    c = Specification.REPLACEMENT;
                }
                else if (c == Specification.EOF)
                {
                    RaiseErrorOccurred(ErrorCode.EOF);
                    return(XmlToken.EOF);
                }

                _stringBuffer.Append(c);
                c = _src.Next;
            }
        }
Exemple #2
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#sec-pi.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="pi">The processing instruction token.</param>
        XmlToken ProcessingContent(Char c, XmlPIToken pi)
        {
            while (true)
            {
                if (c == Specification.QM)
                {
                    c = _src.Next;

                    if (c == Specification.GT)
                    {
                        pi.Content = _stringBuffer.ToString();
                        return(pi);
                    }

                    _stringBuffer.Append(Specification.QM);
                }
                else if (c == Specification.EOF)
                {
                    RaiseErrorOccurred(ErrorCode.EOF);
                    return(XmlToken.EOF);
                }
                else
                {
                    _stringBuffer.Append(c);
                    c = _src.Next;
                }
            }
        }
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#sec-pi.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="pi">The processing instruction token.</param>
        protected XmlToken ProcessingTarget(Char c, XmlPIToken pi)
        {
            while (true)
            {
                if (c.IsSpaceCharacter())
                {
                    pi.Target = _stringBuffer.ToString();
                    _stringBuffer.Clear();
                    return ProcessingContent(_src.Next, pi);
                }
                else if (c == Specification.QM)
                {
                    pi.Target = _stringBuffer.ToString();
                    _stringBuffer.Clear();
                    return ProcessingContent(c, pi);
                }
                else if (c == Specification.NULL)
                {
                    RaiseErrorOccurred(ErrorCode.NULL);
                    c = Specification.REPLACEMENT;
                }
                else if (c == Specification.EOF)
                {
                    RaiseErrorOccurred(ErrorCode.EOF);
                    return XmlToken.EOF;
                }

                _stringBuffer.Append(c);
                c = _src.Next;
            }
        }
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#sec-pi.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="pi">The processing instruction token.</param>
        XmlToken ProcessingContent(Char c, XmlPIToken pi)
        {
            while (true)
            {
                if (c == Specification.QM)
                {
                    c = src.Next;

                    if (c == Specification.GT)
                    {
                        pi.Content = stringBuffer.ToString();
                        return pi;
                    }

                    stringBuffer.Append(Specification.QM);
                }
                else if (c == Specification.EOF)
                {
                    RaiseErrorOccurred(ErrorCode.EOF);
                    return XmlToken.EOF;
                }
                else
                {
                    stringBuffer.Append(c);
                    c = src.Next;
                }
            }
        }
Exemple #5
0
 public DtdPIToken(XmlPIToken token)
 {
     _target = token.Target;
     _content = token.Content;
     _type = DtdTokenType.ProcessingInstruction;
 }
Exemple #6
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#sec-pi.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="pi">The processing instruction token.</param>
        XmlToken ProcessingContent(Char c, XmlPIToken pi)
        {
            while (c != Specification.EOF)
            {
                if (c == Specification.QM)
                {
                    c = _src.Next;

                    if (c == Specification.GT)
                    {
                        pi.Content = _stringBuffer.ToString();
                        return pi;
                    }

                    _stringBuffer.Append(Specification.QM);
                }
                else
                {
                    _stringBuffer.Append(c);
                    c = _src.Next;
                }
            }

            throw Errors.Xml(ErrorCode.EOF);
        }
Exemple #7
0
        /// <summary>
        /// More http://www.w3.org/TR/REC-xml/#sec-pi.
        /// </summary>
        /// <param name="c">The next input character.</param>
        /// <param name="pi">The processing instruction token.</param>
        XmlToken ProcessingTarget(Char c, XmlPIToken pi)
        {
            while (c.IsXmlName())
            {
                _stringBuffer.Append(c);
                c = _src.Next;
            }

            pi.Target = _stringBuffer.ToString();
            _stringBuffer.Clear();

            if (String.Compare(pi.Target, Tags.XML, StringComparison.OrdinalIgnoreCase) == 0)
                throw Errors.Xml(ErrorCode.XmlInvalidPI);

            if (c == Specification.QM)
            {
                c = _src.Next;

                if (c == Specification.GT)
                    return pi;
            }
            else if (c.IsSpaceCharacter())
                return ProcessingContent(_src.Next, pi);

            throw Errors.Xml(ErrorCode.XmlInvalidPI);
        }