Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
using System.Text;
namespace HtmlAgilityPack
{
internal class EncodingFoundException : Exception
{
#region Fields
private Encoding _encoding;
#endregion
#region Constructors
internal EncodingFoundException(Encoding encoding)
{
_encoding = encoding;
}
#endregion
#region Properties
internal Encoding Encoding
{
get { return _encoding; }
}
#endregion
}
}

View File

@@ -0,0 +1,260 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
#region
using System;
using System.Diagnostics;
#endregion
namespace HtmlAgilityPack
{
/// <summary>
/// Represents an HTML attribute.
/// </summary>
[DebuggerDisplay("Name: {OriginalName}, Value: {Value}")]
public class HtmlAttribute : IComparable
{
#region Fields
private int _line;
internal int _lineposition;
internal string _name;
internal int _namelength;
internal int _namestartindex;
internal HtmlDocument _ownerdocument; // attribute can exists without a node
internal HtmlNode _ownernode;
private AttributeValueQuote _quoteType = AttributeValueQuote.DoubleQuote;
internal int _streamposition;
internal string _value;
internal int _valuelength;
internal int _valuestartindex;
#endregion
#region Constructors
internal HtmlAttribute(HtmlDocument ownerdocument)
{
_ownerdocument = ownerdocument;
}
#endregion
#region Properties
/// <summary>
/// Gets the line number of this attribute in the document.
/// </summary>
public int Line
{
get { return _line; }
internal set { _line = value; }
}
/// <summary>
/// Gets the column number of this attribute in the document.
/// </summary>
public int LinePosition
{
get { return _lineposition; }
}
/// <summary>
/// Gets the qualified name of the attribute.
/// </summary>
public string Name
{
get
{
if (_name == null)
{
_name = _ownerdocument._text.Substring(_namestartindex, _namelength);
}
return _name.ToLower();
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
_name = value;
if (_ownernode != null)
{
_ownernode._innerchanged = true;
_ownernode._outerchanged = true;
}
}
}
/// <summary>
/// Name of attribute with original case
/// </summary>
public string OriginalName
{
get { return _name; }
}
/// <summary>
/// Gets the HTML document to which this attribute belongs.
/// </summary>
public HtmlDocument OwnerDocument
{
get { return _ownerdocument; }
}
/// <summary>
/// Gets the HTML node to which this attribute belongs.
/// </summary>
public HtmlNode OwnerNode
{
get { return _ownernode; }
}
/// <summary>
/// Specifies what type of quote the data should be wrapped in
/// </summary>
public AttributeValueQuote QuoteType
{
get { return _quoteType; }
set { _quoteType = value; }
}
/// <summary>
/// Gets the stream position of this attribute in the document, relative to the start of the document.
/// </summary>
public int StreamPosition
{
get { return _streamposition; }
}
/// <summary>
/// Gets or sets the value of the attribute.
/// </summary>
public string Value
{
get
{
if (_value == null)
{
_value = _ownerdocument._text.Substring(_valuestartindex, _valuelength);
}
return _value;
}
set
{
_value = value;
if (_ownernode != null)
{
_ownernode._innerchanged = true;
_ownernode._outerchanged = true;
}
}
}
internal string XmlName
{
get { return HtmlDocument.GetXmlName(Name); }
}
internal string XmlValue
{
get { return Value; }
}
/// <summary>
/// Gets a valid XPath string that points to this Attribute
/// </summary>
public string XPath
{
get
{
string basePath = (OwnerNode == null) ? "/" : OwnerNode.XPath + "/";
return basePath + GetRelativeXpath();
}
}
#endregion
#region IComparable Members
/// <summary>
/// Compares the current instance with another attribute. Comparison is based on attributes' name.
/// </summary>
/// <param name="obj">An attribute to compare with this instance.</param>
/// <returns>A 32-bit signed integer that indicates the relative order of the names comparison.</returns>
public int CompareTo(object obj)
{
HtmlAttribute att = obj as HtmlAttribute;
if (att == null)
{
throw new ArgumentException("obj");
}
return Name.CompareTo(att.Name);
}
#endregion
#region Public Methods
/// <summary>
/// Creates a duplicate of this attribute.
/// </summary>
/// <returns>The cloned attribute.</returns>
public HtmlAttribute Clone()
{
HtmlAttribute att = new HtmlAttribute(_ownerdocument);
att.Name = Name;
att.Value = Value;
return att;
}
/// <summary>
/// Removes this attribute from it's parents collection
/// </summary>
public void Remove()
{
_ownernode.Attributes.Remove(this);
}
#endregion
#region Private Methods
private string GetRelativeXpath()
{
if (OwnerNode == null)
return Name;
int i = 1;
foreach (HtmlAttribute node in OwnerNode.Attributes)
{
if (node.Name != Name) continue;
if (node == this)
break;
i++;
}
return "@" + Name + "[" + i + "]";
}
#endregion
}
/// <summary>
/// An Enum representing different types of Quotes used for surrounding attribute values
/// </summary>
public enum AttributeValueQuote
{
/// <summary>
/// A single quote mark '
/// </summary>
SingleQuote,
/// <summary>
/// A double quote mark "
/// </summary>
DoubleQuote
}
}

View File

@@ -0,0 +1,394 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
using System.Collections;
using System.Collections.Generic;
namespace HtmlAgilityPack
{
/// <summary>
/// Represents a combined list and collection of HTML nodes.
/// </summary>
public class HtmlAttributeCollection : IList<HtmlAttribute>
{
#region Fields
internal Dictionary<string, HtmlAttribute> Hashitems = new Dictionary<string, HtmlAttribute>();
private HtmlNode _ownernode;
private List<HtmlAttribute> items = new List<HtmlAttribute>();
#endregion
#region Constructors
internal HtmlAttributeCollection(HtmlNode ownernode)
{
_ownernode = ownernode;
}
#endregion
#region Properties
/// <summary>
/// Gets a given attribute from the list using its name.
/// </summary>
public HtmlAttribute this[string name]
{
get
{
if (name == null)
{
throw new ArgumentNullException("name");
}
return Hashitems.ContainsKey(name.ToLower()) ? Hashitems[name.ToLower()] : null;
}
set { Append(value); }
}
#endregion
#region IList<HtmlAttribute> Members
/// <summary>
/// Gets the number of elements actually contained in the list.
/// </summary>
public int Count
{
get { return items.Count; }
}
/// <summary>
/// Gets readonly status of colelction
/// </summary>
public bool IsReadOnly
{
get { return false; }
}
/// <summary>
/// Gets the attribute at the specified index.
/// </summary>
public HtmlAttribute this[int index]
{
get { return items[index]; }
set { items[index] = value; }
}
/// <summary>
/// Adds supplied item to collection
/// </summary>
/// <param name="item"></param>
public void Add(HtmlAttribute item)
{
Append(item);
}
/// <summary>
/// Explicit clear
/// </summary>
void ICollection<HtmlAttribute>.Clear()
{
items.Clear();
}
/// <summary>
/// Retreives existence of supplied item
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public bool Contains(HtmlAttribute item)
{
return items.Contains(item);
}
/// <summary>
/// Copies collection to array
/// </summary>
/// <param name="array"></param>
/// <param name="arrayIndex"></param>
public void CopyTo(HtmlAttribute[] array, int arrayIndex)
{
items.CopyTo(array, arrayIndex);
}
/// <summary>
/// Get Explicit enumerator
/// </summary>
/// <returns></returns>
IEnumerator<HtmlAttribute> IEnumerable<HtmlAttribute>.GetEnumerator()
{
return items.GetEnumerator();
}
/// <summary>
/// Explicit non-generic enumerator
/// </summary>
/// <returns></returns>
IEnumerator IEnumerable.GetEnumerator()
{
return items.GetEnumerator();
}
/// <summary>
/// Retrieves the index for the supplied item, -1 if not found
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public int IndexOf(HtmlAttribute item)
{
return items.IndexOf(item);
}
/// <summary>
/// Inserts given item into collection at supplied index
/// </summary>
/// <param name="index"></param>
/// <param name="item"></param>
public void Insert(int index, HtmlAttribute item)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
Hashitems[item.Name] = item;
item._ownernode = _ownernode;
items.Insert(index, item);
_ownernode._innerchanged = true;
_ownernode._outerchanged = true;
}
/// <summary>
/// Explicit collection remove
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
bool ICollection<HtmlAttribute>.Remove(HtmlAttribute item)
{
return items.Remove(item);
}
/// <summary>
/// Removes the attribute at the specified index.
/// </summary>
/// <param name="index">The index of the attribute to remove.</param>
public void RemoveAt(int index)
{
HtmlAttribute att = items[index];
Hashitems.Remove(att.Name);
items.RemoveAt(index);
_ownernode._innerchanged = true;
_ownernode._outerchanged = true;
}
#endregion
#region Public Methods
/// <summary>
/// Adds a new attribute to the collection with the given values
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
public void Add(string name, string value)
{
Append(name, value);
}
/// <summary>
/// Inserts the specified attribute as the last attribute in the collection.
/// </summary>
/// <param name="newAttribute">The attribute to insert. May not be null.</param>
/// <returns>The appended attribute.</returns>
public HtmlAttribute Append(HtmlAttribute newAttribute)
{
if (newAttribute == null)
{
throw new ArgumentNullException("newAttribute");
}
Hashitems[newAttribute.Name] = newAttribute;
newAttribute._ownernode = _ownernode;
items.Add(newAttribute);
_ownernode._innerchanged = true;
_ownernode._outerchanged = true;
return newAttribute;
}
/// <summary>
/// Creates and inserts a new attribute as the last attribute in the collection.
/// </summary>
/// <param name="name">The name of the attribute to insert.</param>
/// <returns>The appended attribute.</returns>
public HtmlAttribute Append(string name)
{
HtmlAttribute att = _ownernode._ownerdocument.CreateAttribute(name);
return Append(att);
}
/// <summary>
/// Creates and inserts a new attribute as the last attribute in the collection.
/// </summary>
/// <param name="name">The name of the attribute to insert.</param>
/// <param name="value">The value of the attribute to insert.</param>
/// <returns>The appended attribute.</returns>
public HtmlAttribute Append(string name, string value)
{
HtmlAttribute att = _ownernode._ownerdocument.CreateAttribute(name, value);
return Append(att);
}
/// <summary>
/// Checks for existance of attribute with given name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public bool Contains(string name)
{
for (int i = 0; i < items.Count; i++)
{
if (items[i].Name.Equals(name.ToLower()))
return true;
}
return false;
}
/// <summary>
/// Inserts the specified attribute as the first node in the collection.
/// </summary>
/// <param name="newAttribute">The attribute to insert. May not be null.</param>
/// <returns>The prepended attribute.</returns>
public HtmlAttribute Prepend(HtmlAttribute newAttribute)
{
Insert(0, newAttribute);
return newAttribute;
}
/// <summary>
/// Removes a given attribute from the list.
/// </summary>
/// <param name="attribute">The attribute to remove. May not be null.</param>
public void Remove(HtmlAttribute attribute)
{
if (attribute == null)
{
throw new ArgumentNullException("attribute");
}
int index = GetAttributeIndex(attribute);
if (index == -1)
{
throw new IndexOutOfRangeException();
}
RemoveAt(index);
}
/// <summary>
/// Removes an attribute from the list, using its name. If there are more than one attributes with this name, they will all be removed.
/// </summary>
/// <param name="name">The attribute's name. May not be null.</param>
public void Remove(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
string lname = name.ToLower();
for (int i = 0; i < items.Count; i++)
{
HtmlAttribute att = items[i];
if (att.Name == lname)
{
RemoveAt(i);
}
}
}
/// <summary>
/// Remove all attributes in the list.
/// </summary>
public void RemoveAll()
{
Hashitems.Clear();
items.Clear();
_ownernode._innerchanged = true;
_ownernode._outerchanged = true;
}
#endregion
#region LINQ Methods
/// <summary>
/// Returns all attributes with specified name. Handles case insentivity
/// </summary>
/// <param name="attributeName">Name of the attribute</param>
/// <returns></returns>
public IEnumerable<HtmlAttribute> AttributesWithName(string attributeName)
{
attributeName = attributeName.ToLower();
for (int i = 0; i < items.Count; i++)
{
if (items[i].Name.Equals(attributeName))
yield return items[i];
}
}
/// <summary>
/// Removes all attributes from the collection
/// </summary>
public void Remove()
{
foreach (HtmlAttribute item in items)
item.Remove();
}
#endregion
#region Internal Methods
/// <summary>
/// Clears the attribute collection
/// </summary>
internal void Clear()
{
Hashitems.Clear();
items.Clear();
}
internal int GetAttributeIndex(HtmlAttribute attribute)
{
if (attribute == null)
{
throw new ArgumentNullException("attribute");
}
for (int i = 0; i < items.Count; i++)
{
if ((items[i]) == attribute)
return i;
}
return -1;
}
internal int GetAttributeIndex(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
string lname = name.ToLower();
for (int i = 0; i < items.Count; i++)
{
if ((items[i]).Name == lname)
return i;
}
return -1;
}
#endregion
}
}

View File

@@ -0,0 +1,142 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
namespace HtmlAgilityPack
{
internal class HtmlCmdLine
{
#region Static Members
internal static bool Help;
#endregion
#region Constructors
static HtmlCmdLine()
{
Help = false;
ParseArgs();
}
#endregion
#region Internal Methods
internal static string GetOption(string name, string def)
{
string p = def;
string[] args = Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++)
{
GetStringArg(args[i], name, ref p);
}
return p;
}
internal static string GetOption(int index, string def)
{
string p = def;
string[] args = Environment.GetCommandLineArgs();
int j = 0;
for (int i = 1; i < args.Length; i++)
{
if (GetStringArg(args[i], ref p))
{
if (index == j)
return p;
else
p = def;
j++;
}
}
return p;
}
internal static bool GetOption(string name, bool def)
{
bool p = def;
string[] args = Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++)
{
GetBoolArg(args[i], name, ref p);
}
return p;
}
internal static int GetOption(string name, int def)
{
int p = def;
string[] args = Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++)
{
GetIntArg(args[i], name, ref p);
}
return p;
}
#endregion
#region Private Methods
private static void GetBoolArg(string Arg, string Name, ref bool ArgValue)
{
if (Arg.Length < (Name.Length + 1)) // -name is 1 more than name
return;
if (('/' != Arg[0]) && ('-' != Arg[0])) // not a param
return;
if (Arg.Substring(1, Name.Length).ToLower() == Name.ToLower())
ArgValue = true;
}
private static void GetIntArg(string Arg, string Name, ref int ArgValue)
{
if (Arg.Length < (Name.Length + 3)) // -name:12 is 3 more than name
return;
if (('/' != Arg[0]) && ('-' != Arg[0])) // not a param
return;
if (Arg.Substring(1, Name.Length).ToLower() == Name.ToLower())
{
try
{
ArgValue = Convert.ToInt32(Arg.Substring(Name.Length + 2, Arg.Length - Name.Length - 2));
}
catch
{
}
}
}
private static bool GetStringArg(string Arg, ref string ArgValue)
{
if (('/' == Arg[0]) || ('-' == Arg[0]))
return false;
ArgValue = Arg;
return true;
}
private static void GetStringArg(string Arg, string Name, ref string ArgValue)
{
if (Arg.Length < (Name.Length + 3)) // -name:x is 3 more than name
return;
if (('/' != Arg[0]) && ('-' != Arg[0])) // not a param
return;
if (Arg.Substring(1, Name.Length).ToLower() == Name.ToLower())
ArgValue = Arg.Substring(Name.Length + 2, Arg.Length - Name.Length - 2);
}
private static void ParseArgs()
{
string[] args = Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++)
{
// help
GetBoolArg(args[i], "?", ref Help);
GetBoolArg(args[i], "h", ref Help);
GetBoolArg(args[i], "help", ref Help);
}
}
#endregion
}
}

View File

@@ -0,0 +1,76 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
namespace HtmlAgilityPack
{
/// <summary>
/// Represents an HTML comment.
/// </summary>
public class HtmlCommentNode : HtmlNode
{
#region Fields
private string _comment;
#endregion
#region Constructors
internal HtmlCommentNode(HtmlDocument ownerdocument, int index)
:
base(HtmlNodeType.Comment, ownerdocument, index)
{
}
#endregion
#region Properties
/// <summary>
/// Gets or Sets the comment text of the node.
/// </summary>
public string Comment
{
get
{
if (_comment == null)
{
return base.InnerHtml;
}
return _comment;
}
set { _comment = value; }
}
/// <summary>
/// Gets or Sets the HTML between the start and end tags of the object. In the case of a text node, it is equals to OuterHtml.
/// </summary>
public override string InnerHtml
{
get
{
if (_comment == null)
{
return base.InnerHtml;
}
return _comment;
}
set { _comment = value; }
}
/// <summary>
/// Gets or Sets the object and its content in HTML.
/// </summary>
public override string OuterHtml
{
get
{
if (_comment == null)
{
return base.OuterHtml;
}
return "<!--" + _comment + "-->";
}
}
#endregion
}
}

View File

@@ -0,0 +1,33 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
using System.Diagnostics;
namespace HtmlAgilityPack
{
internal class HtmlConsoleListener : TraceListener
{
#region Public Methods
public override void Write(string Message)
{
Write(Message, "");
}
public override void Write(string Message, string Category)
{
Console.Write("T:" + Category + ": " + Message);
}
public override void WriteLine(string Message)
{
Write(Message + "\n");
}
public override void WriteLine(string Message, string Category)
{
Write(Message + "\n", Category);
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
namespace HtmlAgilityPack
{
/// <summary>
/// Flags that describe the behavior of an Element node.
/// </summary>
[Flags]
public enum HtmlElementFlag
{
/// <summary>
/// The node is a CDATA node.
/// </summary>
CData = 1,
/// <summary>
/// The node is empty. META or IMG are example of such nodes.
/// </summary>
Empty = 2,
/// <summary>
/// The node will automatically be closed during parsing.
/// </summary>
Closed = 4,
/// <summary>
/// The node can overlap.
/// </summary>
CanOverlap = 8
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System.Xml;
namespace HtmlAgilityPack
{
internal class HtmlNameTable : XmlNameTable
{
#region Fields
private NameTable _nametable = new NameTable();
#endregion
#region Public Methods
public override string Add(string array)
{
return _nametable.Add(array);
}
public override string Add(char[] array, int offset, int length)
{
return _nametable.Add(array, offset, length);
}
public override string Get(string array)
{
return _nametable.Get(array);
}
public override string Get(char[] array, int offset, int length)
{
return _nametable.Get(array, offset, length);
}
#endregion
#region Internal Methods
internal string GetOrAdd(string array)
{
string s = Get(array);
if (s == null)
{
return Add(array);
}
return s;
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
namespace HtmlAgilityPack
{
/// <summary>
/// Represents the type of a node.
/// </summary>
public enum HtmlNodeType
{
/// <summary>
/// The root of a document.
/// </summary>
Document,
/// <summary>
/// An HTML element.
/// </summary>
Element,
/// <summary>
/// An HTML comment.
/// </summary>
Comment,
/// <summary>
/// A text node is always the child of an element or a document node.
/// </summary>
Text,
}
}

View File

@@ -0,0 +1,92 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
namespace HtmlAgilityPack
{
/// <summary>
/// Represents a parsing error found during document parsing.
/// </summary>
public class HtmlParseError
{
#region Fields
private HtmlParseErrorCode _code;
private int _line;
private int _linePosition;
private string _reason;
private string _sourceText;
private int _streamPosition;
#endregion
#region Constructors
internal HtmlParseError(
HtmlParseErrorCode code,
int line,
int linePosition,
int streamPosition,
string sourceText,
string reason)
{
_code = code;
_line = line;
_linePosition = linePosition;
_streamPosition = streamPosition;
_sourceText = sourceText;
_reason = reason;
}
#endregion
#region Properties
/// <summary>
/// Gets the type of error.
/// </summary>
public HtmlParseErrorCode Code
{
get { return _code; }
}
/// <summary>
/// Gets the line number of this error in the document.
/// </summary>
public int Line
{
get { return _line; }
}
/// <summary>
/// Gets the column number of this error in the document.
/// </summary>
public int LinePosition
{
get { return _linePosition; }
}
/// <summary>
/// Gets a description for the error.
/// </summary>
public string Reason
{
get { return _reason; }
}
/// <summary>
/// Gets the the full text of the line containing the error.
/// </summary>
public string SourceText
{
get { return _sourceText; }
}
/// <summary>
/// Gets the absolute stream position of this error in the document, relative to the start of the document.
/// </summary>
public int StreamPosition
{
get { return _streamPosition; }
}
#endregion
}
}

View File

@@ -0,0 +1,34 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
namespace HtmlAgilityPack
{
/// <summary>
/// Represents the type of parsing error.
/// </summary>
public enum HtmlParseErrorCode
{
/// <summary>
/// A tag was not closed.
/// </summary>
TagNotClosed,
/// <summary>
/// A tag was not opened.
/// </summary>
TagNotOpened,
/// <summary>
/// There is a charset mismatch between stream and declared (META) encoding.
/// </summary>
CharsetMismatch,
/// <summary>
/// An end tag was not required.
/// </summary>
EndTagNotRequired,
/// <summary>
/// An end tag is invalid at this position.
/// </summary>
EndTagInvalidHere
}
}

View File

@@ -0,0 +1,69 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
namespace HtmlAgilityPack
{
/// <summary>
/// Represents an HTML text node.
/// </summary>
public class HtmlTextNode : HtmlNode
{
#region Fields
private string _text;
#endregion
#region Constructors
internal HtmlTextNode(HtmlDocument ownerdocument, int index)
:
base(HtmlNodeType.Text, ownerdocument, index)
{
}
#endregion
#region Properties
/// <summary>
/// Gets or Sets the HTML between the start and end tags of the object. In the case of a text node, it is equals to OuterHtml.
/// </summary>
public override string InnerHtml
{
get { return OuterHtml; }
set { _text = value; }
}
/// <summary>
/// Gets or Sets the object and its content in HTML.
/// </summary>
public override string OuterHtml
{
get
{
if (_text == null)
{
return base.OuterHtml;
}
return _text;
}
}
/// <summary>
/// Gets or Sets the text of the node.
/// </summary>
public string Text
{
get
{
if (_text == null)
{
return base.OuterHtml;
}
return _text;
}
set { _text = value; }
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System;
namespace HtmlAgilityPack
{
/// <summary>
/// Represents an exception thrown by the HtmlWeb utility class.
/// </summary>
public class HtmlWebException : Exception
{
#region Constructors
/// <summary>
/// Creates an instance of the HtmlWebException.
/// </summary>
/// <param name="message">The exception's message.</param>
public HtmlWebException(string message)
: base(message)
{
}
#endregion
}
}

View File

@@ -0,0 +1,28 @@
// HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
using System.IO;
namespace HtmlAgilityPack
{
internal struct IOLibrary
{
#region Internal Methods
internal static void CopyAlways(string source, string target)
{
if (!File.Exists(source))
return;
Directory.CreateDirectory(Path.GetDirectoryName(target));
MakeWritable(target);
File.Copy(source, target, true);
}
internal static void MakeWritable(string path)
{
if (!File.Exists(path))
return;
File.SetAttributes(path, File.GetAttributes(path) & ~FileAttributes.ReadOnly);
}
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More