Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlAttribute.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttribute.cs45
1 files changed, 18 insertions, 27 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
index 4ec826437bf..39fb89271ca 100644
--- a/mcs/class/System.XML/System.Xml/XmlAttribute.cs
+++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
@@ -40,13 +40,12 @@ using System.Xml.Schema;
namespace System.Xml
{
- public class XmlAttribute : XmlNode, IHasXmlChildNode
+ public class XmlAttribute : XmlNode
{
#region Fields
private XmlNameEntry name;
internal bool isDefault;
- XmlLinkedNode lastLinkedChild;
#if NET_2_0
private IXmlSchemaInfo schemaInfo;
#endif
@@ -70,12 +69,10 @@ namespace System.Xml
XmlDocument doc,
bool atomizedNames, bool checkNamespace) : base (doc)
{
- if (!atomizedNames) {
- if (prefix == null)
- prefix = String.Empty;
- if (namespaceURI == null)
- namespaceURI = String.Empty;
- }
+ 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
@@ -87,15 +84,14 @@ namespace System.Xml
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.");
+ // 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.");
+ if (!atomizedNames) {
prefix = doc.NameTable.Add (prefix);
localName = doc.NameTable.Add (localName);
namespaceURI = doc.NameTable.Add (namespaceURI);
@@ -107,11 +103,6 @@ namespace System.Xml
#region Properties
- XmlLinkedNode IHasXmlChildNode.LastLinkedChild {
- get { return lastLinkedChild; }
- set { lastLinkedChild = value; }
- }
-
public override string BaseURI {
get { return OwnerElement != null ? OwnerElement.BaseURI : String.Empty; }
}
@@ -243,11 +234,11 @@ namespace System.Xml
XmlNode textChild = FirstChild as XmlCharacterData;
if (textChild == null) {
this.RemoveAll ();
- AppendChild (OwnerDocument.CreateTextNode (value), false);
+ AppendChild (OwnerDocument.CreateTextNode (value));
}
else if (FirstChild.NextSibling != null) {
this.RemoveAll ();
- AppendChild (OwnerDocument.CreateTextNode (value), false);
+ AppendChild (OwnerDocument.CreateTextNode (value));
}
else
textChild.Value = value;
@@ -304,8 +295,8 @@ namespace System.Xml
XmlNode node = new XmlAttribute (name.Prefix, name.LocalName, name.NS,
OwnerDocument, true, false);
if (deep) {
- for (XmlNode n = FirstChild; n != null; n = n.NextSibling)
- node.AppendChild (n.CloneNode (deep), false);
+ for (int i = 0; i < ChildNodes.Count; i++)
+ node.AppendChild (ChildNodes [i].CloneNode (deep));
}
return node;
@@ -318,8 +309,8 @@ namespace System.Xml
public override void WriteContentTo (XmlWriter w)
{
- for (XmlNode n = FirstChild; n != null; n = n.NextSibling)
- n.WriteTo (w);
+ for (int i = 0; i < ChildNodes.Count; i++)
+ ChildNodes [i].WriteTo (w);
}
public override void WriteTo (XmlWriter w)