|
// <copyright file="BaseDataObject.cs" company="islameldemery.blogspot.com/">
// Copyright (c) 2008 All Right Reserved
// </copyright>
// <author>Islam Eldemery</author>
// <email>issy.sam@gmail.com</email>
// <date>2008-12-29</date>
// <summary>The base class that represents an xml node</summary>
namespace Xmlawy
{
using System;
using System.Collections.Generic;
/// <summary>
/// The base class that represents an xml node
/// </summary>
public class BaseDataObject : InterfaceDataObject
{
#region Feilds
/// <summary>
/// The node name
/// </summary>
private string name = string.Empty;
/// <summary>
/// The node value
/// </summary>
private string value = string.Empty;
/// <summary>
/// The node attributes
/// </summary>
private List<XmlAttribute> attributes = new List<XmlAttribute>();
/// <summary>
/// The node childs
/// </summary>
private List<BaseDataObject> childs = new List<BaseDataObject>();
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
public BaseDataObject()
{
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
public BaseDataObject(string name)
{
this.name = name;
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="value">The node value</param>
public BaseDataObject(string name, string value)
{
this.name = name;
this.value = value;
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="value">The node value</param>
/// <param name="attributes">List of node attributes</param>
public BaseDataObject(string name, string value, params XmlAttribute[] attributes)
{
this.name = name;
this.value = value;
for (int i = 0; i < attributes.Length; i++)
{
this.attributes.Add(attributes[i]);
}
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="value">The node value</param>
/// <param name="attributes">List of node attributes</param>
public BaseDataObject(string name, string value, List<XmlAttribute> attributes)
{
this.name = name;
this.value = value;
this.attributes = attributes;
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="childs">List of childs</param>
public BaseDataObject(string name, params BaseDataObject[] childs)
{
this.name = name;
for (int i = 0; i < childs.Length; i++)
{
this.childs.Add(childs[i]);
}
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="childs">List of childs</param>
public BaseDataObject(string name, List<BaseDataObject> childs)
{
this.name = name;
this.childs = childs;
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="childs">List of childs</param>
/// <param name="attributes">List of attributes</param>
public BaseDataObject(string name, List<BaseDataObject> childs, params XmlAttribute[] attributes)
{
this.name = name;
this.childs = childs;
for (int i = 0; i < attributes.Length; i++)
{
this.attributes.Add(attributes[i]);
}
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="childs">List of childs</param>
/// <param name="attributes">List of attributes</param>
public BaseDataObject(string name, List<BaseDataObject> childs, List<XmlAttribute> attributes)
{
this.name = name;
this.childs = childs;
this.attributes = attributes;
}
/// <summary>
/// Initializes a new instance of the BaseDataObject class
/// </summary>
/// <param name="name">The node name</param>
/// <param name="attributes">List of attributes</param>
/// <param name="childs">List of childs</param>
public BaseDataObject(string name, List<XmlAttribute> attributes, params BaseDataObject[] childs)
{
this.name = name;
this.attributes = attributes;
for (int i = 0; i < childs.Length; i++)
{
this.childs.Add(childs[i]);
}
}
#endregion
#region InterfaceDataObject Properties
/// <summary>
/// Gets or sets a value of the node name
/// </summary>
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>
/// Gets or sets a value of the node value
/// </summary>
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
/// <summary>
/// Gets or sets a value of the list of the node attributes
/// </summary>
public List<XmlAttribute> Attributes
{
get
{
return this.attributes;
}
set
{
this.attributes = value;
}
}
/// <summary>
/// Gets or sets a value of the list of the node childs
/// If u set childs, the value will be ignored
/// </summary>
public List<BaseDataObject> Childs
{
get
{
return this.childs;
}
set
{
if (this.value != null)
{
this.value = null;
}
this.childs = value;
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.