public XmlNameEntry Get(string prefix, string local, string ns, bool atomic) { XmlNameEntry e = GetInternal(prefix, local, ns, atomic); return(e); }
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(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 (); } } } } }
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(); } } } } }
public override bool Equals(object other) { XmlNameEntry e = other as XmlNameEntry; return(e != null && e.Hash == Hash && Object.ReferenceEquals(e.LocalName, LocalName) && Object.ReferenceEquals(e.NS, NS) && Object.ReferenceEquals(e.Prefix, Prefix)); }
internal XmlAttribute( string prefix, string localName, string namespaceURI, XmlDocument doc, bool atomizedNames, bool checkNamespace) : base(doc) { if (!atomizedNames) { if (prefix == null) { prefix = String.Empty; } if (namespaceURI == null) { namespaceURI = String.Empty; } } // Prefix "xml" should be also checked (http://www.w3.org/XML/xml-names-19990114-errata#NE05) // but MS.NET ignores such case if (checkNamespace) { if (prefix == "xmlns" || (prefix == "" && localName == "xmlns")) { if (namespaceURI != XmlNamespaceManager.XmlnsXmlns) { throw new ArgumentException("Invalid attribute namespace for namespace declaration."); } else if (prefix == "xml" && namespaceURI != XmlNamespaceManager.XmlnsXml) { throw new ArgumentException("Invalid attribute namespace for namespace declaration."); } } } if (!atomizedNames) { // There are no means to identify the DOM is // namespace-aware or not, so we can only // check Name validity. if (prefix != "" && !XmlChar.IsName(prefix)) { throw new ArgumentException("Invalid attribute prefix."); } else if (!XmlChar.IsName(localName)) { throw new ArgumentException("Invalid attribute local name."); } prefix = doc.NameTable.Add(prefix); localName = doc.NameTable.Add(localName); namespaceURI = doc.NameTable.Add(namespaceURI); } name = doc.NameCache.Add(prefix, localName, namespaceURI, true); }
public XmlNameEntry Add (string prefix, string local, string ns, bool atomic) { if (!atomic) { prefix = nameTable.Add (prefix); local = nameTable.Add (local); ns = nameTable.Add (ns); } XmlNameEntry e = GetInternal (prefix, local, ns, true); if (e == null) { e = new XmlNameEntry (prefix, local, ns); table [e] = e; } return e; }
public XmlNameEntry Add(string prefix, string local, string ns, bool atomic) { if (!atomic) { prefix = this.nameTable.Add(prefix); local = this.nameTable.Add(local); ns = this.nameTable.Add(ns); } XmlNameEntry xmlNameEntry = this.GetInternal(prefix, local, ns, true); if (xmlNameEntry == null) { xmlNameEntry = new XmlNameEntry(prefix, local, ns); this.table[xmlNameEntry] = xmlNameEntry; } return(xmlNameEntry); }
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 }
public XmlNameEntry Add(string prefix, string local, string ns, bool atomic) { if (!atomic) { prefix = nameTable.Add(prefix); local = nameTable.Add(local); ns = nameTable.Add(ns); } XmlNameEntry e = GetInternal(prefix, local, ns, true); if (e == null) { e = new XmlNameEntry(prefix, local, ns); table [e] = e; } return(e); }
internal XmlAttribute(string prefix, string localName, string namespaceURI, XmlDocument doc, bool atomizedNames, bool checkNamespace) : base(doc) { if (!atomizedNames) { if (prefix == null) { prefix = string.Empty; } if (namespaceURI == null) { namespaceURI = string.Empty; } } if (checkNamespace && (prefix == "xmlns" || (prefix == string.Empty && localName == "xmlns"))) { if (namespaceURI != "http://www.w3.org/2000/xmlns/") { throw new ArgumentException("Invalid attribute namespace for namespace declaration."); } if (prefix == "xml" && namespaceURI != "http://www.w3.org/XML/1998/namespace") { throw new ArgumentException("Invalid attribute namespace for namespace declaration."); } } if (!atomizedNames) { if (prefix != string.Empty && !XmlChar.IsName(prefix)) { throw new ArgumentException("Invalid attribute prefix."); } if (!XmlChar.IsName(localName)) { throw new ArgumentException("Invalid attribute local name."); } prefix = doc.NameTable.Add(prefix); localName = doc.NameTable.Add(localName); namespaceURI = doc.NameTable.Add(namespaceURI); } this.name = doc.NameCache.Add(prefix, localName, namespaceURI, true); }
internal XmlAttribute ( string prefix, string localName, string namespaceURI, XmlDocument doc, bool atomizedNames, bool checkNamespace) : base (doc) { if (!atomizedNames) { if (prefix == null) prefix = String.Empty; if (namespaceURI == null) namespaceURI = String.Empty; } // Prefix "xml" should be also checked (http://www.w3.org/XML/xml-names-19990114-errata#NE05) // but MS.NET ignores such case if (checkNamespace) { if (prefix == "xmlns" || (prefix == "" && localName == "xmlns")) if (namespaceURI != XmlNamespaceManager.XmlnsXmlns) throw new ArgumentException ("Invalid attribute namespace for namespace declaration."); else if (prefix == "xml" && namespaceURI != XmlNamespaceManager.XmlnsXml) throw new ArgumentException ("Invalid attribute namespace for namespace declaration."); } if (!atomizedNames) { // There are no means to identify the DOM is // namespace-aware or not, so we can only // check Name validity. if (prefix != "" && !XmlChar.IsName (prefix)) throw new ArgumentException ("Invalid attribute prefix."); else if (!XmlChar.IsName (localName)) throw new ArgumentException ("Invalid attribute local name."); prefix = doc.NameTable.Add (prefix); localName = doc.NameTable.Add (localName); namespaceURI = doc.NameTable.Add (namespaceURI); } name = doc.NameCache.Add (prefix, localName, namespaceURI, true); }
public override bool Equals(object other) { XmlNameEntry xmlNameEntry = other as XmlNameEntry; return(xmlNameEntry != null && xmlNameEntry.Hash == this.Hash && object.ReferenceEquals(xmlNameEntry.LocalName, this.LocalName) && object.ReferenceEquals(xmlNameEntry.NS, this.NS) && object.ReferenceEquals(xmlNameEntry.Prefix, this.Prefix)); }