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:
authorAtsushi Eno <atsushieno@gmail.com>2003-07-12 11:39:25 +0400
committerAtsushi Eno <atsushieno@gmail.com>2003-07-12 11:39:25 +0400
commit86b8448fdb822ca1f72a61c85b1dbe2ae05f8527 (patch)
treefb963987fe9284b7948f25c80ff9f77834b8e918 /mcs/class/System.XML/System.Xml/XmlElement.cs
parentaececc6f872ed754acca6f96483123ce00827400 (diff)
2003-07-12 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* XmlAttribute.cs, XmlElement.cs : Fixed CloneNode() for bug #46129. * XmlDocument.cs : Fixed MakeReaderErrorMessage that specified invalid String.Format arguments, and basically XmlException.ctor( IXmlLineInfo, message) seems good idea to use. * XmlTextReader.cs : - Fixed .ctor(Stream, XmlNodeType, XmlParserContext) which had required non-null context which don't have to exist. - Added state check. Introduced 'currentState' and 'maybeTextDecl' (for external entity) and removed hasEnteredDocument. Added state-check logic to ReadStartTag(), ReadEndTag(), ReadText(), ReadCData(), ReadDoctypeDecl() and ReadWhitespace(). - Replaced throw ReaderError() with throw new XmlException() and fixed that some error hadn't thrown, only created. - ResetState() should re-initialize existing private members other than some specified fields. - Private AddAttribute() should check if the same-named attribute already exists. * DTDObjectModel.cs : Additive declaration for ATTLIST is availabe now. svn path=/trunk/mcs/; revision=16131
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlElement.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs43
1 files changed, 9 insertions, 34 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
index 157eba23a5d..e94673e8113 100644
--- a/mcs/class/System.XML/System.Xml/XmlElement.cs
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -176,50 +176,41 @@ namespace System.Xml
#region Methods
- [MonoTODO]
public override XmlNode CloneNode (bool deep)
{
- XmlNode node = new XmlElement (prefix, localName, namespaceURI,
- OwnerDocument);
+ XmlElement node = new XmlElement (
+ prefix, localName, namespaceURI, OwnerDocument);
+
+ for (int i = 0; i < Attributes.Count; i++)
+ node.SetAttributeNode ((XmlAttribute)
+ Attributes [i].CloneNode (true));
- for (int i = 0; i < node.Attributes.Count; i++)
- node.AppendChild (node.Attributes [i].CloneNode (false));
-
if (deep) {
- while ((node != null) && (node.HasChildNodes)) {
- AppendChild (node.NextSibling.CloneNode (true));
- node = node.NextSibling;
- }
+ foreach (XmlNode child in this.ChildNodes)
+ node.AppendChild (child.CloneNode (true));
} // shallow cloning
-
- //
- // Reminder: Also look into Default attributes.
- //
+
return node;
}
- [MonoTODO]
public virtual string GetAttribute (string name)
{
XmlNode attributeNode = Attributes.GetNamedItem (name);
return attributeNode != null ? attributeNode.Value : String.Empty;
}
- [MonoTODO]
public virtual string GetAttribute (string localName, string namespaceURI)
{
XmlNode attributeNode = Attributes.GetNamedItem (localName, namespaceURI);
return attributeNode != null ? attributeNode.Value : String.Empty;
}
- [MonoTODO]
public virtual XmlAttribute GetAttributeNode (string name)
{
XmlNode attributeNode = Attributes.GetNamedItem (name);
return attributeNode != null ? attributeNode as XmlAttribute : null;
}
- [MonoTODO]
public virtual XmlAttribute GetAttributeNode (string localName, string namespaceURI)
{
XmlNode attributeNode = Attributes.GetNamedItem (localName, namespaceURI);
@@ -265,14 +256,12 @@ namespace System.Xml
return new XmlNodeArrayList (nodeArrayList);
}
- [MonoTODO]
public virtual bool HasAttribute (string name)
{
XmlNode attributeNode = Attributes.GetNamedItem (name);
return attributeNode != null;
}
- [MonoTODO]
public virtual bool HasAttribute (string localName, string namespaceURI)
{
XmlNode attributeNode = Attributes.GetNamedItem (localName, namespaceURI);
@@ -329,7 +318,6 @@ namespace System.Xml
return attributes.Remove(attributes[localName, namespaceURI]);
}
- [MonoTODO]
public virtual void SetAttribute (string name, string value)
{
XmlAttribute attribute = OwnerDocument.CreateAttribute (name);
@@ -338,7 +326,6 @@ namespace System.Xml
Attributes.SetNamedItem (attribute);
}
-// [MonoTODO]
public virtual string SetAttribute (string localName, string namespaceURI, string value)
{
XmlAttribute attr = attributes[localName, namespaceURI];
@@ -353,7 +340,6 @@ namespace System.Xml
return attr.Value;
}
-// [MonoTODO]
public virtual XmlAttribute SetAttributeNode (XmlAttribute newAttr)
{
newAttr.SetOwnerElement(this);
@@ -374,23 +360,12 @@ namespace System.Xml
childNode.WriteTo(w);
}
- [MonoTODO]
public override void WriteTo (XmlWriter w)
{
w.WriteStartElement(Prefix, LocalName, NamespaceURI);
foreach(XmlNode attributeNode in Attributes)
attributeNode.WriteTo(w);
-/*
-// It should be automatically written by XmlWriter.
- // write namespace declarations(if not exist)
- foreach(XmlNode attributeNode in Attributes) {
- if(attributeNode.Prefix != null && attributeNode.Prefix != String.Empty &&
- w.LookupPrefix(attributeNode.NamespaceURI) != attributeNode.Prefix &&
- attributeNode.Prefix != "xmlns")
- w.WriteAttributeString("xmlns", attributeNode.Prefix, "http://www.w3.org/2000/xmlns/", attributeNode.NamespaceURI);
- }
-*/
if (IsEmpty)
w.WriteEndElement ();
else {