VerifyName() public static method

public static VerifyName ( string name ) : string
name string
return string
示例#1
0
 // Constructor
 protected internal XmlEntityReference(string name, XmlDocument doc)
     : base(doc)
 {
     // LAMESPEC: MS CreateNode() allows null node name.
     XmlConvert.VerifyName(name);
     entityName = doc.NameTable.Add(name);
 }
示例#2
0
        /// <summary>
        /// Calls WriteString if the name is a valid XML NMTOKEN.
        /// </summary>
        public override void WriteNmToken(string name)
        {
            // NmToken is the same as NcName, except it doesn't restrict first character.
            string temp = XmlConvert.VerifyName("a" + name);

            WriteString(temp.Substring(1));
        }
示例#3
0
 internal XmlElement(string prefix, string localName, string namespaceURI, XmlDocument doc, bool atomizedNames) : base(doc)
 {
     if (!atomizedNames)
     {
         if (prefix == null)
         {
             prefix = string.Empty;
         }
         if (namespaceURI == null)
         {
             namespaceURI = string.Empty;
         }
         XmlConvert.VerifyName(localName);
         prefix       = doc.NameTable.Add(prefix);
         localName    = doc.NameTable.Add(localName);
         namespaceURI = doc.NameTable.Add(namespaceURI);
     }
     this.name = doc.NameCache.Add(prefix, localName, namespaceURI, true);
     if (doc.DocumentType != null)
     {
         DTDAttListDeclaration dtdattListDeclaration = doc.DocumentType.DTD.AttListDecls[localName];
         if (dtdattListDeclaration != null)
         {
             for (int i = 0; i < dtdattListDeclaration.Definitions.Count; i++)
             {
                 DTDAttributeDefinition dtdattributeDefinition = dtdattListDeclaration[i];
                 if (dtdattributeDefinition.DefaultValue != null)
                 {
                     this.SetAttribute(dtdattributeDefinition.Name, dtdattributeDefinition.DefaultValue);
                     this.Attributes[dtdattributeDefinition.Name].SetDefault();
                 }
             }
         }
     }
 }
示例#4
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Xml.XmlProcessingInstruction" /> class.</summary>
 /// <param name="target">The target of the processing instruction; see the <see cref="P:System.Xml.XmlProcessingInstruction.Target" /> property.</param>
 /// <param name="data">The content of the instruction; see the <see cref="P:System.Xml.XmlProcessingInstruction.Data" /> property.</param>
 /// <param name="doc">The parent XML document.</param>
 protected internal XmlProcessingInstruction(string target, string data, XmlDocument doc) : base(doc)
 {
     XmlConvert.VerifyName(target);
     if (data == null)
     {
         data = string.Empty;
     }
     this.target = target;
     this.data   = data;
 }
示例#5
0
文件: XmlWriter.cs 项目: weeble/mono
 internal void WriteNameInternal(string name)
 {
     switch (Settings.ConformanceLevel)
     {
     case ConformanceLevel.Document:
     case ConformanceLevel.Fragment:
         XmlConvert.VerifyName(name);
         break;
     }
     WriteString(name);
 }
示例#6
0
        internal XmlElement(
            string prefix,
            string localName,
            string namespaceURI,
            XmlDocument doc,
            bool atomizedNames) : base(doc)
        {
            if (!atomizedNames)
            {
                if (prefix == null)
                {
                    prefix = String.Empty;
                }
                if (namespaceURI == null)
                {
                    namespaceURI = String.Empty;
                }

                XmlConvert.VerifyName(localName);

                prefix       = doc.NameTable.Add(prefix);
                localName    = doc.NameTable.Add(localName);
                namespaceURI = doc.NameTable.Add(namespaceURI);
            }
            name = doc.NameCache.Add(prefix, localName, namespaceURI, true);

#if NOT_PFX
            if (doc.DocumentType != null)
            {
                DTDAttListDeclaration attlist = doc.DocumentType.DTD.AttListDecls [localName];
                if (attlist != null)
                {
                    for (int i = 0; i < attlist.Definitions.Count; i++)
                    {
                        DTDAttributeDefinition def = attlist [i];
                        if (def.DefaultValue != null)
                        {
                            SetAttribute(def.Name, def.DefaultValue);
                            Attributes [def.Name].SetDefault();
                        }
                    }
                }
            }
#endif
        }
示例#7
0
 /// <summary>
 /// Calls WriteString if the name is a valid XML name.
 /// </summary>
 public override void WriteName(string name)
 {
     WriteString(XmlConvert.VerifyName(name));
 }
示例#8
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Xml.XmlEntityReference" /> class.</summary>
 /// <param name="name">The name of the entity reference; see the <see cref="P:System.Xml.XmlEntityReference.Name" /> property.</param>
 /// <param name="doc">The parent XML document.</param>
 protected internal XmlEntityReference(string name, XmlDocument doc) : base(doc)
 {
     XmlConvert.VerifyName(name);
     this.entityName = doc.NameTable.Add(name);
 }