Exemple #1
0
        /// <summary>
        /// Consumes the given token.
        /// </summary>
        /// <param name="token">The token to consume.</param>
        void Consume(DtdToken token)
        {
            switch (token.Type)
            {
            case DtdTokenType.Attribute:
                _result.AddAttribute(((DtdAttributeToken)token).ToElement());
                break;

            case DtdTokenType.Element:
                _result.AddElement(((DtdElementToken)token).ToElement());
                break;

            case DtdTokenType.Entity:
                AddEntity((DtdEntityToken)token);
                break;

            case DtdTokenType.Notation:
                _result.AddNotation(((DtdNotationToken)token).ToElement());
                break;

            case DtdTokenType.TextDecl:
                throw Errors.Xml(ErrorCode.XmlInvalidPI);

            case DtdTokenType.Comment:
            case DtdTokenType.ProcessingInstruction:
                break;
            }
        }
Exemple #2
0
        void Consume(DtdToken token)
        {
            switch (token.Type)
            {
            case DtdTokenType.Attribute:
                _result.AddAttribute(((DtdAttributeToken)token).ToElement());
                break;

            case DtdTokenType.Comment:
                _result.AddComment(((DtdCommentToken)token).ToElement());
                break;

            case DtdTokenType.Element:
                _result.AddElement(((DtdElementToken)token).ToElement());
                break;

            case DtdTokenType.Entity:
                _result.AddEntity(((DtdEntityToken)token).ToElement());
                break;

            case DtdTokenType.Notation:
                _result.AddNotation(((DtdNotationToken)token).ToElement());
                break;

            case DtdTokenType.ProcessingInstruction:
                _result.AddProcessingInstruction(((DtdPIToken)token).ToElement());
                break;
            }
        }