/// <summary> /// Gets the encoding specified in the text declaration. /// </summary> /// <param name="c">The character.</param> /// <param name="decl">The current declaration.</param> /// <returns>The token.</returns> DtdToken TextDeclEncoding(Char c, DtdDeclToken decl) { if (c == Specification.EQ) { var q = _stream.Next; if (q == Specification.DQ || q == Specification.SQ) { _stringBuffer.Clear(); c = _stream.Next; if (c.IsLetter()) { do { _stringBuffer.Append(c); c = _stream.Next; } while (c.IsAlphanumericAscii() || c == Specification.DOT || c == Specification.UNDERSCORE || c == Specification.MINUS); } if (c == q) { decl.Encoding = _stringBuffer.ToString(); return TextDeclAfter(_stream.Next, decl); } } } throw Errors.Xml(ErrorCode.DtdTextDeclInvalid); }
/// <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); }
/// <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 == Specification.DOT || c == Specification.UNDERSCORE || c == Specification.MINUS) { _stringBuffer.Append(c); c = _src.Next; } else throw Errors.Xml(ErrorCode.XmlDeclarationInvalid); } while (c != q); decl.Encoding = _stringBuffer.ToString(); c = _src.Next; if(c.IsSpaceCharacter()) return DeclarationAfterEncoding(c, decl); return DeclarationEnd(c, decl); }