/// <summary> /// See 8.2.4.55 After DOCTYPE name state /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeNameAfter(Char c, XmlDoctypeToken doctype) { while (c.IsSpaceCharacter()) c = GetNext(); if (c == Symbols.GreaterThan) return doctype; if (ContinuesWith(PublicIdentifier, false)) { Advance(5); return DoctypePublic(GetNext(), doctype); } else if (ContinuesWith(SystemIdentifier, false)) { Advance(5); return DoctypeSystem(GetNext(), doctype); } else if (c == Symbols.SquareBracketOpen) { Advance(); return DoctypeAfter(GetNext(), doctype); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.55 After DOCTYPE name state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeNameAfter(XmlDoctypeToken doctype) { var c = SkipSpaces(); if (c == Symbols.GreaterThan) { return(doctype); } else if (ContinuesWithSensitive(Keywords.Public)) { Advance(5); return(DoctypePublic(doctype)); } else if (ContinuesWithSensitive(Keywords.System)) { Advance(5); return(DoctypeSystem(doctype)); } else if (c == Symbols.SquareBracketOpen) { Advance(); return(DoctypeAfter(GetNext(), doctype)); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.60 After DOCTYPE public identifier state /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypePublicIdentifierAfter(Char c, XmlDoctypeToken doctype) { if (c == Symbols.GreaterThan) return doctype; else if (c.IsSpaceCharacter()) return DoctypeBetween(GetNext(), doctype); throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// The doctype finalizer. /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeAfter(Char c, XmlDoctypeToken doctype) { while (c.IsSpaceCharacter()) c = GetNext(); if (c == Symbols.GreaterThan) return doctype; throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.66 After DOCTYPE system identifier state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeSystemIdentifierAfter(XmlDoctypeToken doctype) { var c = SkipSpaces(); if (c == Symbols.SquareBracketOpen) { Advance(); c = GetNext(); } return(DoctypeAfter(c, doctype)); }
/// <summary> /// See 8.2.4.66 After DOCTYPE system identifier state /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeSystemIdentifierAfter(Char c, XmlDoctypeToken doctype) { while (c.IsSpaceCharacter()) c = GetNext(); if (c == Symbols.SquareBracketOpen) { Advance(); c = GetNext(); } return DoctypeAfter(c, doctype); }
/// <summary> /// See 8.2.4.64 DOCTYPE system identifier (double-quoted) state /// </summary> /// <param name="c">The next input character.</param> /// <param name="q">The quote character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeSystemIdentifierValue(Char c, Char q, XmlDoctypeToken doctype) { while (c != q) { if (c == Symbols.EndOfFile) throw XmlParseError.EOF.At(GetCurrentPosition()); _stringBuffer.Append(c); c = GetNext(); } doctype.SystemIdentifier = FlushBuffer(); return DoctypeSystemIdentifierAfter(GetNext(), doctype); }
/// <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); }
/// <summary> /// See 8.2.4.60 After DOCTYPE public identifier state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypePublicIdentifierAfter(XmlDoctypeToken doctype) { var c = GetNext(); if (c == Symbols.GreaterThan) { return(doctype); } else if (c.IsSpaceCharacter()) { return(DoctypeBetween(doctype)); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.61 Between DOCTYPE public and system identifiers state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeBetween(XmlDoctypeToken doctype) { var c = SkipSpaces(); if (c == Symbols.GreaterThan) { return(doctype); } else if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) { doctype.SystemIdentifier = String.Empty; return(DoctypeSystemIdentifierValue(doctype, c)); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.62 After DOCTYPE system keyword state /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeSystem(Char c, XmlDoctypeToken doctype) { if (c.IsSpaceCharacter()) { while (c.IsSpaceCharacter()) c = GetNext(); if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) { doctype.SystemIdentifier = String.Empty; return DoctypeSystemIdentifierValue(GetNext(), c, doctype); } } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.62 After DOCTYPE system keyword state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeSystem(XmlDoctypeToken doctype) { var c = GetNext(); if (c.IsSpaceCharacter()) { c = SkipSpaces(); if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) { doctype.SystemIdentifier = String.Empty; return(DoctypeSystemIdentifierValue(doctype, c)); } } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.54 DOCTYPE name state /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeName(Char c, XmlDoctypeToken doctype) { while (c.IsXmlName()) { _stringBuffer.Append(c); c = GetNext(); } doctype.Name = FlushBuffer(); if (c == Symbols.GreaterThan) return doctype; else if (c.IsSpaceCharacter()) return DoctypeNameAfter(GetNext(), doctype); throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.58 DOCTYPE public identifier (double-quoted) state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <param name="quote">The closing character.</param> /// <returns>The emitted token.</returns> XmlToken DoctypePublicIdentifierValue(XmlDoctypeToken doctype, Char quote) { var c = GetNext(); while (c != quote) { if (!c.IsPubidChar()) { throw XmlParseError.XmlInvalidPubId.At(GetCurrentPosition()); } StringBuffer.Append(c); c = GetNext(); } doctype.PublicIdentifier = FlushBuffer(); return(DoctypePublicIdentifierAfter(doctype)); }
/// <summary> /// See 8.2.4.64 DOCTYPE system identifier (double-quoted) state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <param name="quote">The quote character.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeSystemIdentifierValue(XmlDoctypeToken doctype, Char quote) { var c = GetNext(); while (c != quote) { if (c == Symbols.EndOfFile) { throw XmlParseError.EOF.At(GetCurrentPosition()); } StringBuffer.Append(c); c = GetNext(); } doctype.SystemIdentifier = FlushBuffer(); return(DoctypeSystemIdentifierAfter(doctype)); }
/// <summary> /// See 8.2.4.54 DOCTYPE name state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeName(XmlDoctypeToken doctype) { var c = GetNext(); while (c.IsXmlName()) { StringBuffer.Append(c); c = GetNext(); } doctype.Name = FlushBuffer(); if (c == Symbols.GreaterThan) { return(doctype); } else if (c.IsSpaceCharacter()) { return(DoctypeNameAfter(doctype)); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.55 After DOCTYPE name state /// </summary> /// <param name="c">The next input character.</param> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> XmlToken DoctypeNameAfter(Char c, XmlDoctypeToken doctype) { while (c.IsSpaceCharacter()) c = GetNext(); if (c == Symbols.GreaterThan) return doctype; if (ContinuesWithSensitive(Keywords.Public)) { Advance(5); return DoctypePublic(GetNext(), doctype); } else if (ContinuesWithSensitive(Keywords.System)) { Advance(5); return DoctypeSystem(GetNext(), doctype); } else if (c == Symbols.SquareBracketOpen) { Advance(); return DoctypeAfter(GetNext(), doctype); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.54 DOCTYPE name state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypeName(XmlDoctypeToken doctype) { var c = GetNext(); while (c.IsXmlName()) { StringBuffer.Append(c); c = GetNext(); } doctype.Name = FlushBuffer(); if (c == Symbols.GreaterThan) { return doctype; } else if (c.IsSpaceCharacter()) { return DoctypeNameAfter(doctype); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.58 DOCTYPE public identifier (double-quoted) state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <param name="quote">The closing character.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypePublicIdentifierValue(XmlDoctypeToken doctype, Char quote) { var c = GetNext(); while (c != quote) { if (!c.IsPubidChar()) throw XmlParseError.XmlInvalidPubId.At(GetCurrentPosition()); StringBuffer.Append(c); c = GetNext(); } doctype.PublicIdentifier = FlushBuffer(); return DoctypePublicIdentifierAfter(doctype); }
/// <summary> /// See 8.2.4.55 After DOCTYPE name state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypeNameAfter(XmlDoctypeToken doctype) { var c = SkipSpaces(); if (c == Symbols.GreaterThan) { return doctype; } else if (ContinuesWithSensitive(Keywords.Public)) { Advance(5); return DoctypePublic(doctype); } else if (ContinuesWithSensitive(Keywords.System)) { Advance(5); return DoctypeSystem(doctype); } else if (c == Symbols.SquareBracketOpen) { Advance(); return DoctypeAfter(GetNext(), doctype); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.60 After DOCTYPE public identifier state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypePublicIdentifierAfter(XmlDoctypeToken doctype) { var c = GetNext(); if (c == Symbols.GreaterThan) { return doctype; } else if (c.IsSpaceCharacter()) { return DoctypeBetween(doctype); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.61 Between DOCTYPE public and system identifiers state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypeBetween(XmlDoctypeToken doctype) { var c = SkipSpaces(); if (c == Symbols.GreaterThan) { return doctype; } else if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) { doctype.SystemIdentifier = String.Empty; return DoctypeSystemIdentifierValue(doctype, c); } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.62 After DOCTYPE system keyword state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypeSystem(XmlDoctypeToken doctype) { var c = GetNext(); if (c.IsSpaceCharacter()) { c = SkipSpaces(); if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) { doctype.SystemIdentifier = String.Empty; return DoctypeSystemIdentifierValue(doctype, c); } } throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); }
/// <summary> /// See 8.2.4.64 DOCTYPE system identifier (double-quoted) state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <param name="quote">The quote character.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypeSystemIdentifierValue(XmlDoctypeToken doctype, Char quote) { var c = GetNext(); while (c != quote) { if (c == Symbols.EndOfFile) throw XmlParseError.EOF.At(GetCurrentPosition()); StringBuffer.Append(c); c = GetNext(); } doctype.SystemIdentifier = FlushBuffer(); return DoctypeSystemIdentifierAfter(doctype); }
/// <summary> /// See 8.2.4.66 After DOCTYPE system identifier state /// </summary> /// <param name="doctype">The current doctype token.</param> /// <returns>The emitted token.</returns> private XmlToken DoctypeSystemIdentifierAfter(XmlDoctypeToken doctype) { var c = SkipSpaces(); if (c == Symbols.SquareBracketOpen) { Advance(); c = GetNext(); } return DoctypeAfter(c, doctype); }