public override int Read() { // Read each character, skipping over characters that XML has prohibited int nextCharacter; do { // Read a character if ((nextCharacter = base.Read()) == EOF) { // If the character denotes the end of the file, stop reading break; } } // Skip the character if it's prohibited, and try the next while (!XmlSanitizingStream.IsLegalXmlChar(nextCharacter)); return(nextCharacter); }
public override int Peek() { // Return the next legl XML character without reading it int nextCharacter; do { // See what the next character is nextCharacter = base.Peek(); }while ( // If it's prohibited XML, skip over the character in the stream // and try the next. !XmlSanitizingStream.IsLegalXmlChar(nextCharacter) && (nextCharacter = base.Read()) != EOF ); return(nextCharacter); } // method
/// <summary> /// Get whether an integer represents a legal XML 1.0 character. See the /// specification at w3.org for these characters. /// </summary> public static bool IsLegalXmlChar(int character) { return(XmlSanitizingStream.IsLegalXmlChar("1.0", character)); }