+2004-01-07 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttribute.cs, XmlDocument.cs, XmlElement.cs :
+ set_Prefix should atomize to name table.
+ Avoided extraneous atomization attempt a bit.
+
2004-01-07 Atsushi Enomoto <atsushi@ximian.com>
* DTDObjectModel.cs, DTDReader.cs, XmlSecureResolver.cs :
string prefix,
string localName,
string namespaceURI,
- XmlDocument doc) : base (doc)
+ XmlDocument doc,
+ bool atomizedNames) : base (doc)
{
if (prefix == null)
prefix = String.Empty;
else if (!XmlChar.IsName (localName))
throw new ArgumentException ("Invalid attribute local name.");
- this.prefix = doc.NameTable.Add (prefix);
- this.localName = doc.NameTable.Add (localName);
- this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ if (atomizedNames) {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+ } else {
+ this.prefix = doc.NameTable.Add (prefix);
+ this.localName = doc.NameTable.Add (localName);
+ this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ }
}
#endregion
if (prefix == "xmlns" && value != "xmlns")
throw new ArgumentException ("Cannot bind to the reserved namespace.");
- prefix = value;
+ prefix = OwnerDocument.NameTable.Add (value);
}
get {
public override XmlNode CloneNode (bool deep)
{
XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
- OwnerDocument);
+ OwnerDocument, true);
if (deep) {
foreach (XmlNode child in this.ChildNodes)
node.AppendChild (child.CloneNode (deep));
if ((localName == null) || (localName == String.Empty))
throw new ArgumentException ("The attribute local name cannot be empty.");
- return new XmlAttribute (prefix, localName, namespaceURI, this);
+ return new XmlAttribute (prefix, localName, namespaceURI, this, false);
}
public virtual XmlCDataSection CreateCDataSection (string data)
// I leave it as it is.
if (!XmlChar.IsName (localName))
throw new ArgumentException ("Invalid name.", "localName");
- return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this);
+ return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this, false);
}
public virtual XmlEntityReference CreateEntityReference (string name)
string prefix,
string localName,
string namespaceURI,
- XmlDocument doc) : base (doc)
+ XmlDocument doc,
+ bool atomizedNames) : base (doc)
{
- this.prefix = doc.NameTable.Add (prefix);
- this.localName = doc.NameTable.Add (localName);
- this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ if (atomizedNames) {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+ } else {
+ this.prefix = doc.NameTable.Add (prefix);
+ this.localName = doc.NameTable.Add (localName);
+ this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ }
attributes = new XmlAttributeCollection (this);
if (!XmlChar.IsNCName (value))
throw new ArgumentException ("Specified name is not a valid NCName: " + value);
- prefix = value;
+ prefix = OwnerDocument.NameTable.Add (value);
}
}
public override XmlNode CloneNode (bool deep)
{
XmlElement node = new XmlElement (
- prefix, localName, namespaceURI, OwnerDocument);
+ prefix, localName, namespaceURI, OwnerDocument, true);
for (int i = 0; i < Attributes.Count; i++)
node.SetAttributeNode ((XmlAttribute)
public virtual XmlAttribute SetAttributeNode (string localName, string namespaceURI)
{
XmlDocument xmlDoc = this.OwnerDocument;
- XmlAttribute xmlAttribute = new XmlAttribute (String.Empty, localName, namespaceURI, xmlDoc);
+ XmlAttribute xmlAttribute = new XmlAttribute (String.Empty, localName, namespaceURI, xmlDoc, false);
return this.attributes.Append (xmlAttribute);
}