Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose HTMLNode and HTMLAttribute exact position #172

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/HtmlAgilityPack.Shared/HtmlAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ public int LinePosition
get { return _lineposition; }
}

/// <summary>
/// Gets the stream position of the value of this attribute in the document, relative to the start of the document.
/// </summary>
public int ValueStartIndex
{
get { return _valuestartindex; }
}

/// <summary>
/// Gets the length of the value.
/// </summary>
public int ValueLength
{
get { return _valuelength; }
}

/// <summary>
/// Gets the qualified name of the attribute.
/// </summary>
Expand Down
29 changes: 28 additions & 1 deletion src/HtmlAgilityPack.Shared/HtmlNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ public HtmlAttributeCollection ClosingAttributes
get { return !HasClosingAttributes ? new HtmlAttributeCollection(this) : _endnode.Attributes; }
}

internal HtmlNode EndNode
/// <summary>
/// Gets the closing tag of the node, null if the node is self-closing.
/// </summary>
public HtmlNode EndNode
{
get { return _endnode; }
}
Expand Down Expand Up @@ -461,6 +464,30 @@ public int LinePosition
internal set { _lineposition = value; }
}

/// <summary>
/// Gets the stream position of the area between the opening and closing tag of the node, relative to the start of the document.
/// </summary>
public int InnerStartIndex
{
get { return _innerstartindex; }
}

/// <summary>
/// Gets the length of the area between the opening and closing tag of the node.
/// </summary>
public int InnerLength
{
get { return _innerlength; }
}

/// <summary>
/// Gets the length of the entire node, opening and closing tag included.
/// </summary>
public int OuterLength
{
get { return _outerlength; }
}

/// <summary>
/// Gets or sets this node's name.
/// </summary>
Expand Down