diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2005-12-13 13:46:25 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2005-12-13 13:46:25 +0300 |
commit | aba5cde6e552af5255f8c54b80c79a19f6f655c5 (patch) | |
tree | fba28ad840193effd0401f4d05ce67e9075369a6 /mcs/class/System.XML/System.Xml.XPath | |
parent | 9e72f5a27cfc925fb807e1d537f356ec5f96a3bd (diff) |
2005-12-13 Atsushi Enomoto <atsushi@ximian.com>
* XPathEditableDocument.cs :
- Now it does not append "written" nodes until Close() is invoked.
- Use XmlDocumentFragment to store incomplete tree fragment.
- Implemented DeleteRange() and ReplaceRange().
- Added "Closed" event for ReplaceRange() to "not remove until
Close() is called."
* XPathNavigator.cs : InsertAfter() should raise an error before
MoveToNext() when current node is either attribute or namespace.
* XPathEditableNavigatorTests.cs :
Added more tests for InsertAfter() and InsertBefore().
Added tests for DeleteRange() and ReplaceRange().
svn path=/trunk/mcs/; revision=54276
Diffstat (limited to 'mcs/class/System.XML/System.Xml.XPath')
-rw-r--r-- | mcs/class/System.XML/System.Xml.XPath/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs | 15 |
2 files changed, 16 insertions, 4 deletions
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog index 4c55237564e..f8cc3cc241c 100644 --- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog @@ -1,5 +1,10 @@ 2005-12-13 Atsushi Enomoto <atsushi@ximian.com> + * XPathNavigator.cs : InsertAfter() should raise an error before + MoveToNext() when current node is either attribute or namespace. + +2005-12-13 Atsushi Enomoto <atsushi@ximian.com> + * XPathNavigator.cs : InsertAfter() should append children after it once moved to parent. This method shoulr raise an error when it is placed on Root. diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs index 05e75eabb2a..9f8a04a7ff2 100644 --- a/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs +++ b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs @@ -1009,6 +1009,7 @@ namespace System.Xml.XPath new XmlParserContext (NameTable, nsmgr, null, XmlSpace.None)); } + // must override it. public virtual XmlWriter AppendChild () { throw new NotSupportedException (); @@ -1052,23 +1053,24 @@ namespace System.Xml.XPath } } + // must override it. public virtual XmlWriter CreateAttributes () { throw new NotSupportedException (); } + // must override it. public virtual void DeleteSelf () { throw new NotSupportedException (); } - [MonoTODO ("no concrete implementation yet")] + // must override it. public virtual void DeleteRange (XPathNavigator nav) { throw new NotSupportedException (); } - [MonoTODO ("no concrete implementation yet")] public virtual XmlWriter ReplaceRange (XPathNavigator nav) { throw new NotSupportedException (); @@ -1076,13 +1078,19 @@ namespace System.Xml.XPath public virtual XmlWriter InsertAfter () { + switch (NodeType) { + case XPathNodeType.Root: + case XPathNodeType.Attribute: + case XPathNodeType.Namespace: + throw new InvalidOperationException (String.Format ("Insertion after {0} is not allowed.", NodeType)); + } XPathNavigator nav = Clone (); if (nav.MoveToNext ()) return nav.InsertBefore (); else if (nav.MoveToParent ()) return nav.AppendChild (); else - throw new InvalidOperationException ("Insertion after Root node is not allowed."); + throw new InvalidOperationException ("Could not move to parent to insert sibling node"); } public virtual void InsertAfter (string xmlFragments) @@ -1090,7 +1098,6 @@ namespace System.Xml.XPath InsertAfter (CreateFragmentReader (xmlFragments)); } - [MonoTODO] public virtual void InsertAfter (XmlReader reader) { using (XmlWriter w = InsertAfter ()) { |