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

133
docs/ChangeLog Normal file
View File

@@ -0,0 +1,133 @@
2010-04-06 Andreia Gaita <avidigal@novell.com>
* Makefile.am: fix distcheck - several targets get built on the
srcdir, which has no write permissions on make distcheck, so make
sure permissions are set
2009-12-22 Jo Shields <directhex@apebox.org>
* HtmlAgilityPack/LICENSE: Include upstream license (Ms-PL) since the
file headers don't specify it
2009-12-22 Jo Shields <directhex@apebox.org>
* HtmlAgilityPack/*: Bundle HtmlAgilityPack 1.4~beta2 from
http://www.codeplex.com/htmlagilitypack in source form.
* AgilityPack.dll: Remove binary assembly, use source instead.
* docs.make Makefile.am README: Reflect above changes
2009-02-12 Zoltan Varga <vargaz@gmail.com>
* Makefile.am (EXTRA_DIST): Remove removed files.
* README: Point to the documentation on the wiki.
* call-sites.txt: Remove this, its contents is in jit-trampolines.
* memory-management.txt thread-safety.txt aot-compiler.txt jit-regalloc
exception-handling.txt: Remove documents which are now on the wiki.
2009-02-11 Rodrigo Kumpera <rkumpera@novell.com>
* thread-safety.txt: Improve the docs about image lock.
2009-02-11 Rodrigo Kumpera <rkumpera@novell.com>
* thread-safety.txt: Document the new image lock.
2008-12-12 Mark Probst <mark.probst@gmail.com>
* mini-porting.txt: Added some details about function descriptors
and emulated opcodes.
2008-12-08 Jonathan Pryor <jpryor@novell.com>
* mono-file-formats.source, mono-tools.source: Place these under the
new "Commands and Files" node, and remove nay intermediate nodes.
2008-11-20 Jonathan Pryor <jpryor@novell.com>
* Makefile.am (sources_DATA): Add mono-file-formats.source,
mono-tools.source.
2008-11-20 Raja R Harinath <harinath@hurrynot.org>
Remove unnecessary rebuilds of the html directory
* docs.make (monoapi.zip): Make slightly more unforgiving, by
using '&&' instead of ';' to sequence commands.
(mono-tools.zip, mono-file-formats.zip): Likewise.
* Makefile.am (monoapi.zip, mono-tools.zip, mono-fileformats.zip):
Likewise.
(convert.exe): Don't depend on Makefile.am or docs.make.
2008-11-19 Raja R Harinath <harinath@hurrynot.org>
Fix srcdir != builddir, and add idiom for multi-output commands
* docs.make (monoapi.zip): Handle the case where 'monoapi.tree'
exists but 'monoapi.zip' doesn't. IOW, we should rebuild
monoapi.zip with 'rm monoapi.zip; make'.
(mono-tools.zip, mono-file-formats.zip): Likewise.
* Makefile.am (monoapi.zip, mono-tools.zip, mono-fileformats.zip):
Likewise.
(monoapi.tree): Don't use $< in an explicit rule.
(mono-tools.tree, mono-file-formats.tree): Likewise.
2008-11-18 Jonathan Pryor <jpryor@novell.com>
* Makefile.am (EXTRA_DIST): Add mono-file-formats{.config,.source} and
mono-tools{.config,.source} (fixes the build).
2008-11-18 Jonathan Pryor <jpryor@novell.com>
* docs.make, Makefile.am: Build mono-file-formats{.tree,.zip},
mono-tool{.tree,.zip} files.
* mono-file-formats.config, mono-tools.config: Alter paths to man
pages so that they're valid for building from mono/docs.
* monoapi.make: Rename to docs.make.
2008-11-01 Raja R Harinath <harinath@hurrynot.org>
* Makefile.am: Clean up for srcdir != builddir.
(deploy/.stamp): Compute location of 'mono-wrapper' and pass to exdoc.
* exdoc (mono-wrapper): Use $runtimedir to look for 'mono-wrapper'.
2008-10-31 Jonathan Pryor <jpryor@novell.com>
* check, Makefile.am (EXTRA_DIST): Rename to check-exports. This was
needed to fix `make distdir...`, because (1) with a file named
`check` which (2) was listed in $(EXTRA_DIST), while (3) `check` is
ALSO a .PHONY target, this caused make to look for the `check` file,
not find it due to (3), and then proceed to try to build convert.exe
from convert.cs...for reasons I don't care about. This obviously
can't work during `make distdir`, as mcs hasn't been built yet, thus
leading to pain, suffering, and a broken build.
2008-10-30 Jonathan Pryor <jpryor@novell.com>
* . (svn:ignore), deploy (svn:ignore): Ignore generated files.
* AgilityPack.dll, api-style.css, ChangeLog, check, check-coverage,
convert.cs, current-api, deploy, documented, exdoc, ignore,
mono-api-metadata.html, monoapi.source, produce-lists, public,
public-api, README, sources, toc.xml, TODO, wapi: Copy from
../mono/docscripts.
* exdoc: Use the in-tree mono program to run convert.exe.
* Makefile.am: Mention files to clean/distribute; extract
documentation (with exdoc) and then assemble documentation (with
monoapi.make's assemble target) for use by monodoc.
* monoapi.make: Added; Makefile to use mcs' buid/rules.make to compile
convert.cs and assemble documentation. (This is a separate file so
that we can include mcs' build/rules.make, which needs topdir set to
behave properly BUT must be $(mcs_topdir) from Makefile.am's
perspective.)
* monoapi.source: Add a /monodoc/node element for use with monodoc 2.2.
2006-11-19 Miguel de Icaza <miguel@novell.com>
* exdoc: Move to use CSS instead of tables, this will break
GtkHTML rendering.
* ignore: Updated with more hidden APIs.
* Bunch of documentation work.

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
}
}

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