| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- //
- // System.Xml.XPath.XPathDocument
- //
- // Authors:
- // Tim Coleman ([email protected])
- // Atsushi Enomoto ([email protected])
- //
- // (C) Copyright 2002 Tim Coleman
- // (C) 2003 Atsushi Enomoto
- //
- using System;
- using System.Collections;
- using System.IO;
- using System.Xml;
- using System.Xml.Schema;
- using System.Text;
- using Mono.Xml.XPath;
- namespace System.Xml.XPath
- {
- public class XPathDocument : IXPathNavigable
- {
- DTMXPathDocument document;
- #region Constructors
- public XPathDocument (Stream stream)
- {
- XmlValidatingReader vr = new XmlValidatingReader (new XmlTextReader (stream));
- vr.ValidationType = ValidationType.None;
- Initialize (vr, XmlSpace.None);
- }
- public XPathDocument (string uri)
- : this (uri, XmlSpace.None)
- {
- }
- public XPathDocument (TextReader reader)
- {
- XmlValidatingReader vr = new XmlValidatingReader (new XmlTextReader (reader));
- vr.ValidationType = ValidationType.None;
- Initialize (vr, XmlSpace.None);
- }
- public XPathDocument (XmlReader reader)
- : this (reader, XmlSpace.None)
- {
- }
- public XPathDocument (string uri, XmlSpace space)
- {
- XmlValidatingReader vr = null;
- try {
- vr = new XmlValidatingReader (new XmlTextReader (uri));
- vr.ValidationType = ValidationType.None;
- Initialize (vr, space);
- } finally {
- if (vr != null)
- vr.Close ();
- }
- }
- public XPathDocument (XmlReader reader, XmlSpace space)
- {
- Initialize (reader, space);
- }
- private void Initialize (XmlReader reader, XmlSpace space)
- {
- document = new DTMXPathDocumentBuilder (reader, space).CreateDocument ();
- }
- #endregion
- #region Events
- #if NET_2_0
- public event NodeChangedEventHandler ChangeRejected;
- public event NodeChangedEventHandler ItemChanged;
- public event NodeChangedEventHandler ItemChanging;
- public event NodeChangedEventHandler ItemInserted;
- public event NodeChangedEventHandler ItemInserting;
- public event NodeChangedEventHandler ItemRemoved;
- public event NodeChangedEventHandler ItemRemoving;
- public event NodeChangedEventHandler RejectingChange;
- #endif // NET_2_0
- #endregion // Events
- #region Properties
- #if NET_2_0
- [MonoTODO]
- public virtual bool ContainsListCollection {
- get { throw new NotImplementedException (); }
- }
- [MonoTODO]
- public bool EnableChangeTracking {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
- [MonoTODO]
- public Encoding Encoding {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
- [MonoTODO]
- public XmlNameTable NameTable {
- get { throw new NotImplementedException (); }
- }
- [MonoTODO]
- public bool PreserveWhitespace {
- get { throw new NotImplementedException (); }
- }
- [MonoTODO]
- public XmlSchemaSet Schemas {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
- #endif // NET_2_0
- #endregion // Properies
- #region Methods
- #if NET_2_0
- [MonoTODO]
- public XPathChangeNavigator CreateChangeNavigator ()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public XPathEditableNavigator CreateEditor ()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO ("This code is only for compatibility.")]
- public XPathNavigator CreateNavigator ()
- {
- return document.CreateNavigator ();
- }
- [MonoTODO]
- public XmlWriter CreateWriter ()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public virtual IList GetList ()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public bool HasChanges ()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public bool HasChanges (XmlChangeFilters changeFilter)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public void Load (string xml)
- {
- throw new NotImplementedException ();
- // tree = new XPathDocumentTree (xmlReader);
- // if (acceptChangesOnLoad)
- // AcceptChanges ();
- }
- [MonoTODO]
- public void RejectChanges ()
- {
- throw new NotImplementedException ();
- }
- [MonoTODO ("Confirm writer settings etc.")]
- public void Save (Stream stream)
- {
- Save (new XmlTextWriter (stream, null));
- }
- [MonoTODO ("Confirm writer settings etc.")]
- public void Save (string filename)
- {
- using (XmlWriter w = new XmlTextWriter (filename, null)) {
- Save (w);
- }
- }
- [MonoTODO ("Confirm writer settings etc.")]
- public void Save (TextWriter writer)
- {
- Save (new XmlTextWriter (writer));
- }
- [MonoTODO]
- public void Save (XmlWriter writer)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public XPathNodeIterator SelectNodes (string xpath)
- {
- return SelectNodes (xpath, null);
- }
- [MonoTODO]
- public XPathNodeIterator SelectNodes (XPathExpression expr)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public XPathNodeIterator SelectNodes (string xpath ,IXmlNamespaceResolver nsResolver)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public XPathEditableNavigator SelectSingleNode (string xpath)
- {
- return SelectSingleNode (xpath, null);
- }
- [MonoTODO]
- public XPathEditableNavigator SelectSingleNode (XPathExpression expr)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public XPathEditableNavigator SelectSingleNode (string xpath ,IXmlNamespaceResolver nsResolver)
- {
- throw new NotImplementedException ();
- }
- #else // !NET_2_0
- public XPathNavigator CreateNavigator ()
- {
- return document.CreateNavigator ();
- }
- #endif
- #endregion
- }
- }
|