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/XmlElement.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs45
1 files changed, 21 insertions, 24 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
index a49eb3108b9..3f90c23030d 100644
--- a/mcs/class/System.XML/System.Xml/XmlElement.cs
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -42,13 +42,12 @@ using System.Xml.Schema;
namespace System.Xml
{
- public class XmlElement : XmlLinkedNode, IHasXmlChildNode
+ public class XmlElement : XmlLinkedNode
{
#region Fields
private XmlAttributeCollection attributes;
private XmlNameEntry name;
- XmlLinkedNode lastLinkedChild;
private bool isNotEmpty;
#if NET_2_0
@@ -74,15 +73,17 @@ namespace System.Xml
XmlDocument doc,
bool atomizedNames) : base (doc)
{
- if (!atomizedNames) {
- XmlConvert.VerifyName (localName);
+ XmlConvert.VerifyName (localName);
+ if (!atomizedNames) {
prefix = doc.NameTable.Add (prefix);
localName = doc.NameTable.Add (localName);
namespaceURI = doc.NameTable.Add (namespaceURI);
}
name = doc.NameCache.Add (prefix, localName, namespaceURI, true);
+// attributes = new XmlAttributeCollection (this);
+
if(doc.DocumentType != null)
{
DTDAttListDeclaration attlist = doc.DocumentType.DTD.AttListDecls [localName];
@@ -102,11 +103,6 @@ namespace System.Xml
#region Properties
- XmlLinkedNode IHasXmlChildNode.LastLinkedChild {
- get { return lastLinkedChild; }
- set { lastLinkedChild = value; }
- }
-
public override XmlAttributeCollection Attributes {
get {
if (attributes == null)
@@ -131,7 +127,7 @@ namespace System.Xml
while (FirstChild != null)
this.RemoveChild (FirstChild);
// creates new Text node
- AppendChild (OwnerDocument.CreateTextNode (value), false);
+ AppendChild (OwnerDocument.CreateTextNode (value));
}
}
}
@@ -190,8 +186,11 @@ namespace System.Xml
get { return name.NS; }
}
+ // Why is this override?
public override XmlNode NextSibling {
- get { return ParentNode == null || ((IHasXmlChildNode) ParentNode).LastLinkedChild == this ? null : NextLinkedSibling; }
+ get {
+ return base.NextSibling;
+ }
}
public override XmlNodeType NodeType {
@@ -259,7 +258,7 @@ namespace System.Xml
if (deep) {
for (int i = 0; i < ChildNodes.Count; i++)
- node.AppendChild (ChildNodes [i].CloneNode (true), false);
+ node.AppendChild (ChildNodes [i].CloneNode (true));
}
return node;
@@ -408,27 +407,25 @@ namespace System.Xml
public override void WriteContentTo (XmlWriter w)
{
- for (XmlNode n = FirstChild; n != null; n = n.NextSibling)
- n.WriteTo (w);
+ int count = ChildNodes.Count;
+ for (int i = 0; i < count; i++)
+ ChildNodes [i].WriteTo (w);
}
public override void WriteTo (XmlWriter w)
{
- w.WriteStartElement (
- name.NS == null || name.NS.Length == 0 ? String.Empty : name.Prefix,
- name.LocalName,
- name.NS);
-
- if (HasAttributes)
- for (int i = 0; i < Attributes.Count; i++)
- Attributes [i].WriteTo (w);
+ w.WriteStartElement (NamespaceURI == null || NamespaceURI.Length == 0 ? String.Empty : Prefix, LocalName, NamespaceURI);
- WriteContentTo (w);
+ for (int i = 0; i < Attributes.Count; i++)
+ if (Attributes [i].Specified)
+ Attributes [i].WriteTo(w);
if (IsEmpty)
w.WriteEndElement ();
- else
+ else {
+ WriteContentTo (w);
w.WriteFullEndElement ();
+ }
}
#endregion