diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2004-10-28 10:29:02 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2004-10-28 10:29:02 +0400 |
commit | 1ca41856d9f2a29b6c7304cc76b1aaeb712ae275 (patch) | |
tree | af51bbe075c85690d04b90c4a84362783cb08165 /mcs/class/Mono.Xml.Ext | |
parent | be71f854d65a8f867bd28ae2a0bc60879c62435a (diff) |
2004-10-28 Atsushi Enomoto <atsushi@ximian.com>
* XPathEditableDocument.cs : Copied from sys.xml.
svn path=/trunk/mcs/; revision=35390
Diffstat (limited to 'mcs/class/Mono.Xml.Ext')
-rwxr-xr-x | mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/ChangeLog | 4 | ||||
-rwxr-xr-x | mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/XPathEditableDocument.cs | 33 |
2 files changed, 30 insertions, 7 deletions
diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/ChangeLog b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/ChangeLog index 596b2e9a6c5..d46297932c5 100755 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/ChangeLog @@ -1,3 +1,7 @@ +2004-10-28 Atsushi Enomoto <atsushi@ximian.com> + + * XPathEditableDocument.cs : Copied from sys.xml. + 2004-10-22 Atsushi Enomoto <atsushi@ximian.com> DTMXPathDocument.cs, diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/XPathEditableDocument.cs b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/XPathEditableDocument.cs index 828a0414f05..4407c585b2a 100755 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/XPathEditableDocument.cs +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/XPathEditableDocument.cs @@ -6,7 +6,7 @@ // // (C)2004 Novell Inc. // -// Yet another implementation of editable XPathNavigator. +// Yet another implementation of XPathEditableNavigator. // (Even runnable under MS.NET 2.0) // // By rewriting XPathEditableDocument.CreateNavigator() as just to @@ -99,18 +99,26 @@ namespace Mono.Xml.XPath } */ - XmlDocument document; + XmlNode node; ArrayList changes = new ArrayList (); - public XPathEditableDocument (XmlDocument doc) + public XPathEditableDocument (XmlNode node) { - document = doc; + this.node = node; + } + + public virtual bool CanEdit { + get { return true; } + } + + public XmlNode Node { + get { return node; } } public XPathNavigator CreateNavigator () { - return document.CreateNavigator (); + return new XmlDocumentEditableNavigator (this); } public XmlWriter CreateWriter () @@ -592,13 +600,25 @@ namespace Mono.Xml.XPath public class XmlDocumentEditableNavigator : XPathNavigator, IHasXmlNode { + static readonly bool isXmlDocumentNavigatorImpl; + + static XmlDocumentEditableNavigator () + { + isXmlDocumentNavigatorImpl = + (typeof (XmlDocumentEditableNavigator).Assembly + == typeof (XmlDocument).Assembly); + } + XPathEditableDocument document; XPathNavigator navigator; public XmlDocumentEditableNavigator (XPathEditableDocument doc) { document = doc; - navigator = doc.CreateNavigator (); + if (isXmlDocumentNavigatorImpl) + navigator = new XmlDocumentNavigator (doc.Node); + else + navigator = doc.CreateNavigator (); } public XmlDocumentEditableNavigator (XmlDocumentEditableNavigator nav) @@ -755,7 +775,6 @@ namespace Mono.Xml.XPath foreach (XmlNode c in n.ChildNodes) document.DeleteNode (c); XmlWriter w = document.CreateInsertionWriter (n, null); - // FIXME: Hmm, it does not look like using it. w.WriteValue (value); w.Close (); } |