// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Xml.XmlNode
//
// Author:
// Daniel Weber (daniel-weber@austin.rr.com)
//
// (C) 2001 Daniel Weber
using System;
using System.Collections;
namespace System.Xml
{
public abstract class XmlNode : ICloneable, IEnumerable, IXPathNavigable
{
//======= Private data members ==============================================
protected XmlNodeList _childNodes;
protected XmlNode FOwnerNode;
// ICloneable
///
/// Return a clone of this node
///
///
public virtual object Clone()
{
// TODO - implement XmlNode.Clone() as object
throw new NotImplementedException("object XmlNode.Clone() not implmented");
}
// ============ Properties ============================
///
/// Get the XmlAttributeCollection representing the attributes
/// on the node type. Returns null if the node type is not XmlElement.
///
public virtual XmlAttributeCollection Attributes
{
get
{
return null;
}
}
///
/// Return the base Uniform Resource Indicator (URI) used to resolve
/// this node, or String.Empty.
///
public virtual string BaseURI
{
get
{
// TODO - implement XmlNode.BaseURI {get;}
throw new NotImplementedException("XmlNode.BaseURI not implemented");
}
}
///
/// Return all child nodes of this node. If there are no children,
/// return an empty XmlNodeList;
///
public virtual XmlNodeList ChildNodes
{
get
{
if (_childNodes == null)
_childNodes = new XmlNodeListAsArrayList();
return _childNodes;
}
}
///
/// Return first child node as XmlNode or null
/// if the node has no children
///
public virtual XmlNode FirstChild
{
get
{
if (ChildNodes.Count == 0)
return null;
else
return ChildNodes[0];
}
}
///
/// Return true if the node has children
///
public virtual bool HasChildNodes
{
get
{
if (_childNodes.Count == 0)
return true;
else
return false;
}
}
///
/// Get or Set the concatenated values of node and children
///
public virtual string InnerText
{
get
{
// TODO - implement set InnerText()
throw new NotImplementedException();
}
set
{
// TODO - implement set InnerText()
throw new NotImplementedException();
}
}
///
/// Get/Set the XML representing just the child nodes of this node
///
public virtual string InnerXml
{
get
{
// TODO - implement set InnerXml()
throw new NotImplementedException();
}
set
{
// TODO - implement set InnerXml()
throw new NotImplementedException();
}
}
///
/// Property Get - true if node is read-only
///
public virtual bool IsReadOnly
{
get
{
// TODO - implement or decide to handle in subclass
return true;
}
}
///
/// Return the child element named [string]. Returns XmlElement
/// Indexer for XmlNode class.
///
[System.Runtime.CompilerServices.CSharp.IndexerName("Item")]
public virtual XmlElement this [String index]
{
get
{
// TODO - implement XmlNode.Item(int?)
throw new NotImplementedException();
}
}
///
/// Get the last child node, or null if there are no nodes
///
public virtual XmlNode LastChild
{
get
{
if (_childNodes.Count == 0)
return null;
else
return _childNodes.Item(_childNodes.Count - 1);
}
}
///
/// Returns the local name of the node with qualifiers removed
/// LocalName of ns:elementName = "elementName"
///
public abstract string LocalName {get;}
///
/// Get the qualified node name
/// derived classes must implement as behavior varies
/// by tag type.
///
public abstract string Name { get; }
///
/// Get the namespace URI or String.Empty if none
///
public virtual string NamespaceURI
{
get
{
// TODO - implement Namespace URI, or determine abstractness
return String.Empty;
}
}
///
/// Get the node immediatelly following this node, or null
///
public virtual XmlNode NextSibling
{
get
{
// TODO - implement NextSibling
throw new NotImplementedException();
}
}
public virtual XmlNodeType NodeType
{
get
{
return XmlNodeType.None;
}
}
///
/// Return the string representing this node and all it's children
///
public virtual string OuterXml
{
get
{
// TODO - implement OuterXml {get;}
throw new NotImplementedException();
}
}
///
/// Return owning document.
/// If this nodeType is a document, return null
///
public virtual XmlDocument OwnerDocument
{
get
{
// TODO - implement OwnerDocument {get;}
throw new NotImplementedException();
}
}
///
/// Returns the parent node, or null
/// Return value depends on superclass node type
///
public virtual XmlNode ParentNode
{
get
{
// TODO - implement ParentNode[get;}
throw new NotImplementedException();
}
}
///
/// set/get the namespace prefix for this node, or
/// string.empty if it does not exist
///
public virtual string Prefix
{
get
{
// TODO - implement Prefix {get;}
throw new NotImplementedException();
}
set
{
// TODO - implement Prefix {set;}
throw new NotImplementedException();
}
}
///
/// The preceding XmlNode or null
///
public virtual XmlNode PreviousSibling {
get
{
// TODO - implement PreviousSibling {get;}
throw new NotImplementedException();
}
}
///
/// Get/Set the value for this node
///
public virtual string Value
{
get
{
// TODO - implement Value {get;}
throw new NotImplementedException();
}
set
{
// TODO - implement Value {set;}
throw new NotImplementedException();
}
}
//======= Methods ==========================
///
/// Appends the specified node to the end of the child node list
///
///
///
public virtual XmlNode AppendChild (XmlNode newChild)
{
// TODO - implement AppendChild ();
throw new NotImplementedException();
}
///
/// Return a clone of the node
///
/// Make copy of all children
/// Cloned node
public abstract XmlNode CloneNode( bool deep);
///
/// Return an XPathNavigator for navigating this node
///
///
public XPathNavigator CreateNavigator()
{
// TODO - implement CreateNavigator()
throw new NotImplementedException();
}
///
/// Return true if self = obj || self.outerXml == obj.outerXml
///
///
///
public virtual bool Equals(object obj)
{
// TODO - implement Equals(obj)
throw new NotImplementedException();
}
///
/// Return true if objA = objB || objA.outXml == objB.outerXml
///
///
///
///
public static bool Equals(object objA, object objB)
{
// TODO - implement equals(objA, objB)
throw new NotImplementedException();
}
///
/// Provide support for "for each"
///
///
public IEnumerator GetEnumerator()
{
// TODO - implement GetEnumerator()
throw new NotImplementedException();
}
///
/// Return a hash value for this node
///
///
public virtual int GetHashCode()
{
// TODO - implement GetHashCode()
throw new NotImplementedException();
}
///
/// Look up the closest namespace for this node that is in scope for the given prefix
///
///
/// Namespace URI
public virtual string GetNamespaceOfPrefix(string prefix)
{
// TODO - implement GetNamespaceOfPrefix()
throw new NotImplementedException();
}
///
/// Get the closest xmlns declaration for the given namespace URI that is in scope.
/// Returns the prefix defined in that declaration.
///
///
///
public virtual string GetPrefixOfNamespace(string namespaceURI)
{
// TODO - implement GetPrefixOfNamespace
throw new NotImplementedException();
}
///
/// Get the type of the current node
///
///
public Type GetType()
{
// TODO - implement GetType()
throw new NotImplementedException();
}
///
/// Insert newChild directlly after the reference node
///
///
///
///
public virtual XmlNode InsertAfter(XmlNode newChild, XmlNode refChild)
{
// TODO - implement InsertAfter();
throw new NotImplementedException();
}
///
/// Insert newChild directly before the reference node.
///
///
///
///
public virtual XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
{
// TODO - implement InsertBefore()
throw new NotImplementedException();
}
///
/// Put all nodes under this node in "normal" form
/// Whatever that means...
///
public virtual void Normalize()
{
// TODO - Implement Normalize()
throw new NotImplementedException();
}
///
/// Add the specified child to the beginning of the child node list
///
/// Node to add
/// The node added
public virtual XmlNode PrependChild(XmlNode newChild)
{
//TODO - implement PrependChild(newChild)
throw new NotImplementedException();
}
///
/// Remove all children and attributes
///
public virtual void RemoveAll()
{
// TODO - implement RemoveAll()
throw new NotImplementedException();
}
///
/// Remove specified child node
///
///
/// Removed node
public virtual XmlNode RemoveChild(XmlNode oldChild)
{
// TODO - implement RemoveChild(oldChild)
throw new NotImplementedException();
}
///
/// Select a list of nodes matching the xpath
///
///
/// matching nodes
public XmlNodeList SelectNodes( string xpath)
{
// TODO - imlement SelectNodes(xpath)
throw new NotImplementedException();
}
///
/// Select a list of nodes matching the xpath. Any prefixes are resolved
/// using the passed namespace manager
///
///
///
///
public XmlNodeList SelectNodes(string xpath, XmlNamespaceManager nsmgr)
{
// TODO - implement SelectNodes(xpath, nsmgr)
throw new NotImplementedException();
}
///
/// Selects the first node that matches xpath
///
///
///
public XmlNode SelectSingleNode(string xpatch)
{
// TODO - implement SelectSingeNode(xpath)
throw new NotImplementedException();
}
///
/// Returns the first node that matches xpath
/// Uses the passed namespace manager to resolve namespace URI's
///
///
///
///
public XmlNode SelectSingleNode(string xpath, XmlNamespaceManager nsmgr)
{
// Implement SelectSingleNode(xpath, nsmgr)
throw new NotImplementedException();
}
///
/// Tests if the DOM implementation supports the passed feature
///
///
///
///
public virtual bool Supports(string feature, string version)
{
//TODO - implement Supports(feature, version)
throw new NotImplementedException();
}
///
/// Returns a string representation of the current node and it's children
///
///
public virtual string ToString()
{
// TODO - implement ToString()
throw new NotImplementedException();
}
///
/// Saves all children of the current node to the passed writer
///
///
public abstract void WriteContentTo(XmlWriter w);
///
/// Saves the current node to writer w
///
///
public abstract void WriteTo(XmlWriter w);
//======= Internal methods ===============================================
//======= Protected methods ==============================================
//======= Private Methods ==================
} // XmlNode
} // using namespace System.Xml