CreateInvalidCharException() static private method

static private CreateInvalidCharException ( char invChar, char nextChar ) : Exception
invChar char
nextChar char
return System.Exception
Example #1
0
 public override Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)
 {
     if (_checkNames)
     {
         ValidateQName(name);
     }
     if (_checkValues)
     {
         if (pubid != null)
         {
             int i;
             if ((i = _xmlCharType.IsPublicId(pubid)) >= 0)
             {
                 throw XmlConvert.CreateInvalidCharException(pubid, i);
             }
         }
         if (sysid != null)
         {
             CheckCharacters(sysid);
         }
         if (subset != null)
         {
             CheckCharacters(subset);
         }
     }
     if (_replaceNewLines)
     {
         sysid  = ReplaceNewLines(sysid);
         pubid  = ReplaceNewLines(pubid);
         subset = ReplaceNewLines(subset);
     }
     return(writer.WriteDocTypeAsync(name, pubid, sysid, subset));
 }
 public override void WriteDocType(string name, string pubid, string sysid, string subset)
 {
     if (this.checkNames)
     {
         this.ValidateQName(name);
     }
     if (this.checkValues)
     {
         int num;
         if ((pubid != null) && ((num = this.xmlCharType.IsPublicId(pubid)) >= 0))
         {
             throw XmlConvert.CreateInvalidCharException(pubid, num);
         }
         if (sysid != null)
         {
             this.CheckCharacters(sysid);
         }
         if (subset != null)
         {
             this.CheckCharacters(subset);
         }
     }
     if (this.replaceNewLines)
     {
         sysid  = this.ReplaceNewLines(sysid);
         pubid  = this.ReplaceNewLines(pubid);
         subset = this.ReplaceNewLines(subset);
     }
     base.writer.WriteDocType(name, pubid, sysid, subset);
 }
 public override void WriteDocType(string name, string pubid, string sysid, string subset)
 {
     if (checkNames)
     {
         ValidateQName(name);
     }
     if (checkValues)
     {
         if (pubid != null)
         {
             int i;
             if ((i = xmlCharType.IsPublicId(pubid)) >= 0)
             {
                 throw XmlConvert.CreateInvalidCharException(pubid[i]);
             }
         }
         if (sysid != null)
         {
             CheckCharacters(sysid);
         }
         if (subset != null)
         {
             CheckCharacters(subset);
         }
     }
     if (replaceNewLines)
     {
         sysid  = ReplaceNewLines(sysid);
         pubid  = ReplaceNewLines(pubid);
         subset = ReplaceNewLines(subset);
     }
     writer.WriteDocType(name, pubid, sysid, subset);
 }
Example #4
0
        public override void WriteCharEntity(char ch)
        {
            string s = ((int)ch).ToString("X", NumberFormatInfo.InvariantInfo);

            if (this.checkCharacters && !this.xmlCharType.IsCharData(ch))
            {
                throw XmlConvert.CreateInvalidCharException(ch, '\0');
            }
            this.bufBytes[this.bufPos++] = 0x26;
            this.bufBytes[this.bufPos++] = 0x23;
            this.bufBytes[this.bufPos++] = 120;
            this.RawText(s);
            this.bufBytes[this.bufPos++] = 0x3b;
            if (this.bufPos > this.bufLen)
            {
                this.FlushBuffer();
            }
            this.textPos = this.bufPos;
        }
Example #5
0
 private unsafe byte *InvalidXmlChar(int ch, byte *pDst, bool entitize)
 {
     if (this.checkCharacters)
     {
         throw XmlConvert.CreateInvalidCharException((char)ch, '\0');
     }
     if (entitize)
     {
         return(CharEntity(pDst, (char)ch));
     }
     if (ch < 0x80)
     {
         pDst[0] = (byte)ch;
         pDst++;
         return(pDst);
     }
     pDst = EncodeMultibyteUTF8(ch, pDst);
     return(pDst);
 }