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>2008-04-02 13:23:41 +0400
committerAtsushi Eno <atsushieno@gmail.com>2008-04-02 13:23:41 +0400
commit0e79d8f402f4913a4378d0dab346281720b59624 (patch)
treec65670aea1b46f331b9298fa5661ff09f73eef69 /mcs/class/System.XML/Mono.Xml.XPath
parent24c587136c1c86fa4dd4102d29bcfe3064bf58f2 (diff)
2008-04-02 Atsushi Enomoto <atsushi@ximian.com>
* XPathEditableDocument.cs : it should not expect ParentNode for OwnerElement. Fixed bug #376210. * XPathEditableNavigatorTests.cs : added test for bug #376210. svn path=/trunk/mcs/; revision=99629
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.XPath')
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/ChangeLog5
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/XPathEditableDocument.cs15
2 files changed, 16 insertions, 4 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
index 17694171565..78ce570b62f 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-02 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XPathEditableDocument.cs : it should not expect ParentNode for
+ OwnerElement. Fixed bug #376210.
+
2008-03-17 Atsushi Enomoto <atsushi@ximian.com>
* DTMXPathDocumentBuilder2.cs : allow document fragment as XmlReader
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/XPathEditableDocument.cs b/mcs/class/System.XML/Mono.Xml.XPath/XPathEditableDocument.cs
index d7a008ebcfb..549d45a0cec 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/XPathEditableDocument.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/XPathEditableDocument.cs
@@ -664,11 +664,18 @@ namespace Mono.Xml.XPath
public override void DeleteSelf ()
{
XmlNode n = ((IHasXmlNode) navigator).GetNode ();
- if (!navigator.MoveToNext ())
+ XmlAttribute a = n as XmlAttribute;
+ if (a != null) {
+ if (a.OwnerElement == null)
+ throw new InvalidOperationException ("This attribute node cannot be removed since it has no owner element.");
navigator.MoveToParent ();
- if (n.ParentNode == null)
- throw new InvalidOperationException ("This node cannot be removed since it has no parent.");
- n.ParentNode.RemoveChild (n);
+ a.OwnerElement.RemoveAttributeNode (a);
+ } else {
+ if (n.ParentNode == null)
+ throw new InvalidOperationException ("This node cannot be removed since it has no parent.");
+ navigator.MoveToParent ();
+ n.ParentNode.RemoveChild (n);
+ }
}
public override void ReplaceSelf (XmlReader reader)