|
|
@@ -1,4 +1,3 @@
|
|
|
-// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
|
//
|
|
|
// System.Xml.XmlDocument
|
|
|
//
|
|
|
@@ -9,22 +8,37 @@
|
|
|
|
|
|
using System;
|
|
|
using System.IO;
|
|
|
+using System.Xml.XPath;
|
|
|
|
|
|
namespace System.Xml
|
|
|
{
|
|
|
-
|
|
|
public delegate void XmlNodeChangedEventHandler (XmlNodeChangedEventArgs args);
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Abstract class XmlNodeList.
|
|
|
- /// </summary>
|
|
|
public class XmlDocument : XmlNode
|
|
|
{
|
|
|
- // Private data members
|
|
|
- XmlResolver _resolver = null;
|
|
|
+ #region Constructors
|
|
|
+
|
|
|
+ public XmlDocument () : base (null)
|
|
|
+ {
|
|
|
+ FOwnerDocument = this;
|
|
|
+ }
|
|
|
+
|
|
|
+ [MonoTODO]
|
|
|
+ protected internal XmlDocument (XmlImplementation imp) : base (null)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException ();
|
|
|
+ }
|
|
|
+
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlDocument (NameTable nt) : base (null)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException ();
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Events
|
|
|
|
|
|
- // Public events
|
|
|
- //===========================================================================
|
|
|
public event XmlNodeChangedEventHandler NodeChanged;
|
|
|
|
|
|
public event XmlNodeChangedEventHandler NodeChanging;
|
|
|
@@ -37,29 +51,19 @@ namespace System.Xml
|
|
|
|
|
|
public event XmlNodeChangedEventHandler NodeRemoving;
|
|
|
|
|
|
- // public properties
|
|
|
+ #endregion
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Get the base URI for this document (the location from where the document was loaded)
|
|
|
- /// </summary>
|
|
|
- /// <example>If a document was loaded with doc.Load("c:\tmp\mydoc.xml"),
|
|
|
- /// then BaseURI would hold "c:\tmp\mydoc.xml"</example>
|
|
|
- public override string BaseURI
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.BaseURI {get;}
|
|
|
- throw new NotImplementedException("BaseURI.get not implemented");
|
|
|
+ #region Properties
|
|
|
+
|
|
|
+ [MonoTODO]
|
|
|
+ public override string BaseURI {
|
|
|
+ get {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Get the root element for the document. If no root exists, null is returned.
|
|
|
- /// </summary>
|
|
|
- public XmlElement DocumentElement
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
+ public XmlElement DocumentElement {
|
|
|
+ get {
|
|
|
XmlNode node = FirstChild;
|
|
|
|
|
|
while (node != null) {
|
|
|
@@ -72,429 +76,372 @@ namespace System.Xml
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Gets the node containing the DOCTYPE declaration.
|
|
|
- /// </summary>
|
|
|
- public virtual XmlDocumentType DocumentType
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.DocumentType
|
|
|
- throw new NotImplementedException("XmlDocument.DocumentType not implemented");
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlDocumentType DocumentType {
|
|
|
+ get {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Get the XmlImplemenation for the current document.
|
|
|
- /// </summary>
|
|
|
- public XmlImplementation Implementation
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.Implementation
|
|
|
- throw new NotImplementedException("Implementation not implemented");
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlImplementation Implementation {
|
|
|
+ get {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Get/Set the markup representing the children of the document.
|
|
|
- /// </summary>
|
|
|
- public override string InnerXml
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.InnerXml {get;}
|
|
|
- throw new NotImplementedException("InnerXml get not implemented");
|
|
|
+ [MonoTODO]
|
|
|
+ public override string InnerXml {
|
|
|
+ get {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
- set
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.InnerXml {set;}
|
|
|
- throw new NotImplementedException("InnerXml set not implemented");
|
|
|
+
|
|
|
+ set {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Get a value indicating if the document is read-only.
|
|
|
- /// </summary>
|
|
|
- public override bool IsReadOnly
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return false;
|
|
|
+ public override bool IsReadOnly {
|
|
|
+ get {
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Get the local name of the node. For documents, returns "#document"
|
|
|
- /// </summary>
|
|
|
public override string LocalName {
|
|
|
- get
|
|
|
- {
|
|
|
- return "#document";
|
|
|
+ get {
|
|
|
+ return "#document";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Get the qualified name of the node. For documents, returns "#document"
|
|
|
- /// </summary>
|
|
|
- public override string Name
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return "#document";
|
|
|
+ public override string Name {
|
|
|
+ get {
|
|
|
+ return "#document";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public XmlNameTable NameTable
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.NameTable {get;}
|
|
|
- throw new NotImplementedException("NameTable get not implemented");
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlNameTable NameTable {
|
|
|
+ get {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public override XmlNodeType NodeType
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return XmlNodeType.Document;
|
|
|
+ public override XmlNodeType NodeType {
|
|
|
+ get {
|
|
|
+ return XmlNodeType.Document;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Returns OwnerDocument. For an XmlDocument, this property is always null.
|
|
|
- /// </summary>
|
|
|
- public override XmlDocument OwnerDocument
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return null;
|
|
|
+ public override XmlDocument OwnerDocument {
|
|
|
+ get {
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public bool PreserveWhitespace
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.PreserveWhitespace {get;}
|
|
|
- throw new NotImplementedException("PreserveWhitespace get not implemented");
|
|
|
+ [MonoTODO]
|
|
|
+ public bool PreserveWhitespace {
|
|
|
+ get {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
- set
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.PreserveWhitespace {set;}
|
|
|
- throw new NotImplementedException("PreserveWhitespace set not implemented");
|
|
|
+
|
|
|
+ set {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public XmlResolver XmlResolver
|
|
|
- {
|
|
|
- set
|
|
|
- {
|
|
|
- // TODO - Finish/test XmlDocument.XmlResolver {set;}
|
|
|
- _resolver = value;
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlResolver XmlResolver {
|
|
|
+ set {
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Public Methods
|
|
|
- //===========================================================================
|
|
|
- public override XmlNode CloneNode(bool deep)
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Methods
|
|
|
+
|
|
|
+ [MonoTODO]
|
|
|
+ public override XmlNode CloneNode (bool deep)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CloneNode(bool)
|
|
|
- throw new NotImplementedException("CloneNode(bool) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public XmlAttribute CreateAttribute(string name)
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlAttribute CreateAttribute (string name)
|
|
|
{
|
|
|
- return new XmlAttribute(this, name, "");
|
|
|
+ return new XmlAttribute (this, name, "");
|
|
|
}
|
|
|
|
|
|
- public XmlAttribute CreateAttribute(string qualifiedName,string namespaceURI)
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlAttribute CreateAttribute (string qualifiedName, string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateAttribute(string, string)
|
|
|
- throw new NotImplementedException("CreateAttribute(string, string) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlAttribute CreateAttribute(
|
|
|
- string prefix,
|
|
|
- string localName,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlAttribute CreateAttribute (string prefix, string localName, string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateAttribute(prefix, localName, namespaceURI)
|
|
|
- throw new NotImplementedException("CreateAttribute(prefix, localName, namespaceURI) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlCDataSection CreateCDataSection(string data)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlCDataSection CreateCDataSection (string data)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateCDataSection(string data)
|
|
|
- throw new NotImplementedException("CreateCDataSection(string data) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlComment CreateComment (string data)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException ();
|
|
|
+ }
|
|
|
|
|
|
- public virtual XmlComment CreateComment(string data)
|
|
|
+ [MonoTODO]
|
|
|
+ protected internal virtual XmlAttribute CreateDefaultAttribute (string prefix, string localName, string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateComment(string data)
|
|
|
- throw new NotImplementedException("CreateComment(string data) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlDocumentFragment CreateDocumentFragment()
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlDocumentFragment CreateDocumentFragment ()
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateDocumentFragment
|
|
|
- throw new NotImplementedException("CreateDocumentFragment not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlDocumentType CreateDocumentType(
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlDocumentType CreateDocumentType (
|
|
|
string name,
|
|
|
string publicId,
|
|
|
string systemId,
|
|
|
- string internalSubset
|
|
|
- )
|
|
|
+ string internalSubset)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateDocumentType
|
|
|
- throw new NotImplementedException("CreateDocumentType not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public XmlElement CreateElement(string name)
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlElement CreateElement (string name)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateElement(string name)
|
|
|
- throw new NotImplementedException("CreateElement(string name) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public XmlElement CreateElement(
|
|
|
- string qualifiedName,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ [MonoTODO]
|
|
|
+ public XmlElement CreateElement (string qualifiedName, string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateElement(string qualifiedName, string namespaceURI)
|
|
|
- throw new NotImplementedException("CreateElement(string qualifiedName, string namespaceURI) not implemented");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlElement CreateElement(
|
|
|
+ public virtual XmlElement CreateElement (
|
|
|
string prefix,
|
|
|
string localName,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ string namespaceURI)
|
|
|
{
|
|
|
- return new XmlElement(prefix, localName, namespaceURI, this);
|
|
|
+ return new XmlElement (prefix, localName, namespaceURI, this);
|
|
|
}
|
|
|
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlEntityReference CreateEntityReference (string name)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException ();
|
|
|
+ }
|
|
|
|
|
|
- public virtual XmlEntityReference CreateEntityReference(string name)
|
|
|
+ [MonoTODO]
|
|
|
+ protected internal virtual XPathNavigator CreateNavigator (XmlNode node)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateEntityReference
|
|
|
- throw new NotImplementedException("XmlDocument.CreateEntityReference not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlNode CreateNode(
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNode CreateNode (
|
|
|
string nodeTypeString,
|
|
|
string name,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateNode(string, string, string)
|
|
|
- throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlNode CreateNode(
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNode CreateNode (
|
|
|
XmlNodeType type,
|
|
|
string name,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string)
|
|
|
- throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlNode CreateNode(
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNode CreateNode (
|
|
|
XmlNodeType type,
|
|
|
string prefix,
|
|
|
string name,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateNode(XmlNodeType, string, string, string)
|
|
|
- throw new NotImplementedException("XmlDocument.CreateNode not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlProcessingInstruction CreateProcessingInstruction(
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlProcessingInstruction CreateProcessingInstruction (
|
|
|
string target,
|
|
|
- string data
|
|
|
- )
|
|
|
+ string data)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateProcessingInstruction
|
|
|
- throw new NotImplementedException("XmlDocument.CreateProcessingInstruction not implemented.");
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlSignificantWhitespace CreateSignificantWhitespace(string text )
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlSignificantWhitespace CreateSignificantWhitespace (string text )
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateSignificantWhitespace
|
|
|
- throw new NotImplementedException("XmlDocument.CreateSignificantWhitespace not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlText CreateTextNode(string text)
|
|
|
+ public virtual XmlText CreateTextNode (string text)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateTextNode
|
|
|
- throw new NotImplementedException("XmlDocument.CreateTextNode not implemented.");
|
|
|
+ return new XmlText (text, this);
|
|
|
}
|
|
|
|
|
|
- public virtual XmlWhitespace CreateWhitespace(string text)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlWhitespace CreateWhitespace (string text)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.CreateWhitespace
|
|
|
- throw new NotImplementedException("XmlDocument.CreateWhitespace not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlDeclaration CreateXmlDeclaration(
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlDeclaration CreateXmlDeclaration (
|
|
|
string version,
|
|
|
string encoding,
|
|
|
- string standalone
|
|
|
- )
|
|
|
- {
|
|
|
- // TODO - implement XmlDocument.CreateXmlDeclaration
|
|
|
- throw new NotImplementedException("XmlDocument.CreateXmlDeclaration not implemented.");
|
|
|
- }
|
|
|
-
|
|
|
- public virtual XmlElement GetElementById(string elementId)
|
|
|
+ string standalone)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.GetElementById
|
|
|
- throw new NotImplementedException("XmlDocument.GetElementById not implemented.");
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlNodeList GetElementsByTagName(string name)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlElement GetElementById (string elementId)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.GetElementsByTagName(name)
|
|
|
- throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlNodeList GetElementsByTagName(
|
|
|
- string localName,
|
|
|
- string namespaceURI
|
|
|
- )
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNodeList GetElementsByTagName (string name)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.GetElementsByTagName(localName, namespaceURI)
|
|
|
- throw new NotImplementedException("XmlDocument.GetElementsByTagName not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual XmlNode ImportNode(
|
|
|
- XmlNode node,
|
|
|
- bool deep
|
|
|
- )
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.ImportNode
|
|
|
- throw new NotImplementedException("XmlDocument.ImportNode not implemented.");
|
|
|
+ throw new NotImplementedException();
|
|
|
}
|
|
|
|
|
|
- public virtual void Load(Stream inStream)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNode ImportNode (XmlNode node, bool deep)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Load(Stream)
|
|
|
- throw new NotImplementedException("XmlDocument.Load(Stream) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual void Load(string filename)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual void Load (Stream inStream)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Load(string)
|
|
|
- throw new NotImplementedException("XmlDocument.Load(string) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual void Load(TextReader txtReader)
|
|
|
+ public virtual void Load (string filename)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Load(TextReader)
|
|
|
- throw new NotImplementedException("XmlDocument.Load(TextReader) not implemented.");
|
|
|
+ XmlReader xmlReader = new XmlTextReader (new StreamReader (filename));
|
|
|
+ Load (xmlReader);
|
|
|
}
|
|
|
|
|
|
- public virtual void Load(XmlReader reader)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual void Load (TextReader txtReader)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Load(XmlReader)
|
|
|
- throw new NotImplementedException("XmlDocument.Load(XmlReader) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual void LoadXml(string xml)
|
|
|
+ public virtual void Load (XmlReader xmlReader)
|
|
|
{
|
|
|
- XmlReader xmlReader = new XmlTextReader(new StringReader(xml));
|
|
|
- XmlNode currentNode = this;
|
|
|
- XmlNode newNode;
|
|
|
-
|
|
|
// Reset our document
|
|
|
// For now this just means removing all our children but later this
|
|
|
// may turn out o need to call a private method that resets other things
|
|
|
// like properties we have, etc.
|
|
|
- RemoveAll();
|
|
|
+ RemoveAll ();
|
|
|
|
|
|
- // Wrapping in try/catch for now until XmlTextReader starts throwing XmlException
|
|
|
- try
|
|
|
+ XmlNode currentNode = this;
|
|
|
+
|
|
|
+ while (xmlReader.Read ())
|
|
|
{
|
|
|
- while (xmlReader.Read())
|
|
|
- {
|
|
|
- switch(xmlReader.NodeType)
|
|
|
- {
|
|
|
- case XmlNodeType.Element:
|
|
|
- newNode = CreateElement(xmlReader.Name, xmlReader.LocalName, xmlReader.NamespaceURI);
|
|
|
- currentNode.AppendChild(newNode);
|
|
|
- if (!xmlReader.IsEmptyElement)
|
|
|
- {
|
|
|
- currentNode = newNode;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case XmlNodeType.Text:
|
|
|
- newNode = CreateTextNode(xmlReader.Value);
|
|
|
- currentNode.AppendChild(newNode);
|
|
|
- break;
|
|
|
-
|
|
|
- case XmlNodeType.EndElement:
|
|
|
- currentNode = currentNode.ParentNode;
|
|
|
- break;
|
|
|
- }
|
|
|
+ switch (xmlReader.NodeType) {
|
|
|
+
|
|
|
+ case XmlNodeType.Element:
|
|
|
+ XmlElement element = CreateElement (xmlReader.Name, xmlReader.LocalName, xmlReader.NamespaceURI);
|
|
|
+ currentNode.AppendChild (element);
|
|
|
+
|
|
|
+ // set the element's attributes.
|
|
|
+ while (xmlReader.MoveToNextAttribute ())
|
|
|
+ element.SetAttribute (xmlReader.Name, xmlReader.Value);
|
|
|
+
|
|
|
+ // if this element isn't empty, push it onto our "stack".
|
|
|
+ if (!xmlReader.IsEmptyElement)
|
|
|
+ currentNode = element;
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case XmlNodeType.Text:
|
|
|
+ XmlText text = CreateTextNode (xmlReader.Value);
|
|
|
+ currentNode.AppendChild (text);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case XmlNodeType.EndElement:
|
|
|
+ currentNode = currentNode.ParentNode;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- catch(Exception e)
|
|
|
- {
|
|
|
- throw new XmlException(e.Message, e);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
- public virtual void Save(Stream outStream)
|
|
|
+ public virtual void LoadXml (string xml)
|
|
|
+ {
|
|
|
+ XmlReader xmlReader = new XmlTextReader (new StringReader (xml));
|
|
|
+ Load (xmlReader);
|
|
|
+ }
|
|
|
+
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual XmlNode ReadNode(XmlReader reader)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Save(Stream)
|
|
|
- throw new NotImplementedException("XmlDocument.Save(Stream) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual void Save(string filename)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual void Save(Stream outStream)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Save(string)
|
|
|
- throw new NotImplementedException("XmlDocument.Save(string) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual void Save(TextWriter writer)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual void Save (string filename)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Save(TextWriter)
|
|
|
- throw new NotImplementedException("XmlDocument.Save(TextWriter) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public virtual void Save(XmlWriter writer)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual void Save (TextWriter writer)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.Save(XmlWriter)
|
|
|
- throw new NotImplementedException("XmlDocument.Save(XmlWriter) not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public override void WriteContentTo(XmlWriter w)
|
|
|
+ [MonoTODO]
|
|
|
+ public virtual void Save (XmlWriter writer)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.WriteContentTo
|
|
|
- throw new NotImplementedException("XmlDocument.WriteContentTo not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
- public override void WriteTo(XmlWriter w)
|
|
|
+ [MonoTODO]
|
|
|
+ public override void WriteContentTo (XmlWriter xw)
|
|
|
{
|
|
|
- // TODO - implement XmlDocument.WriteTo
|
|
|
- throw new NotImplementedException("XmlDocument.WriteTo not implemented.");
|
|
|
+ throw new NotImplementedException ();
|
|
|
}
|
|
|
|
|
|
+ [MonoTODO]
|
|
|
+ public override void WriteTo (XmlWriter w)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException ();
|
|
|
+ }
|
|
|
|
|
|
- // Internal functions
|
|
|
- //===========================================================================
|
|
|
internal void onNodeChanging(XmlNode node, XmlNode Parent)
|
|
|
{
|
|
|
if (NodeInserting != null)
|
|
|
@@ -535,16 +482,8 @@ namespace System.Xml
|
|
|
if (NodeRemoved != null)
|
|
|
NodeRemoved(new XmlNodeChangedEventArgs(XmlNodeChangedAction.Remove,
|
|
|
node, oldParent, null));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- // Constructors
|
|
|
- //===========================================================================
|
|
|
- public XmlDocument() : base(null)
|
|
|
- {
|
|
|
- FOwnerDocument = this;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|