VerifyQName() static private method

static private VerifyQName ( string name ) : string
name string
return string
示例#1
0
 public override Task WriteNameAsync(string name)
 {
     if (_checkNames)
     {
         XmlConvert.VerifyQName(name, ExceptionType.XmlException);
     }
     return(writer.WriteNameAsync(name));
 }
 public override void WriteName(string name)
 {
     if (_checkNames)
     {
         XmlConvert.VerifyQName(name, ExceptionType.XmlException);
     }
     writer.WriteName(name);
 }
 public override void WriteName(string name)
 {
     if (checkNames)
     {
         XmlConvert.VerifyQName(name);
     }
     writer.WriteName(name);
 }
示例#4
0
 public virtual Task WriteNameAsync(string name)
 {
     return(WriteStringAsync(XmlConvert.VerifyQName(name, ExceptionType.ArgumentException)));
 }
示例#5
0
 // Writes out the specified name, ensuring it is a valid Name according to the XML specification
 // (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).
 public virtual void WriteName(string name)
 {
     WriteString(XmlConvert.VerifyQName(name, ExceptionType.ArgumentException));
 }
示例#6
0
        public override async Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)
        {
            try
            {
                if (name == null || name.Length == 0)
                {
                    throw new ArgumentException(SR.Xml_EmptyName);
                }
                XmlConvert.VerifyQName(name, ExceptionType.XmlException);

                if (_conformanceLevel == ConformanceLevel.Fragment)
                {
                    throw new InvalidOperationException(SR.Xml_DtdNotAllowedInFragment);
                }

                await AdvanceStateAsync(Token.Dtd).ConfigureAwait(false);

                if (_dtdWritten)
                {
                    _currentState = State.Error;
                    throw new InvalidOperationException(SR.Xml_DtdAlreadyWritten);
                }

                if (_conformanceLevel == ConformanceLevel.Auto)
                {
                    _conformanceLevel = ConformanceLevel.Document;
                    _stateTable       = s_stateTableDocument;
                }

                int i;

                // check characters
                if (_checkCharacters)
                {
                    if (pubid != null)
                    {
                        if ((i = _xmlCharType.IsPublicId(pubid)) >= 0)
                        {
                            throw new ArgumentException(SR.Format(SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(pubid, i)), "pubid");
                        }
                    }
                    if (sysid != null)
                    {
                        if ((i = _xmlCharType.IsOnlyCharData(sysid)) >= 0)
                        {
                            throw new ArgumentException(SR.Format(SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(sysid, i)), "sysid");
                        }
                    }
                    if (subset != null)
                    {
                        if ((i = _xmlCharType.IsOnlyCharData(subset)) >= 0)
                        {
                            throw new ArgumentException(SR.Format(SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(subset, i)), "subset");
                        }
                    }
                }

                // write doctype
                await _writer.WriteDocTypeAsync(name, pubid, sysid, subset).ConfigureAwait(false);

                _dtdWritten = true;
            }
            catch
            {
                _currentState = State.Error;
                throw;
            }
        }