Interface IHtmlParserContext
The interface that connects the HtmlStreamReader with the HTML source to be parsed.
Namespace: EPiServer.HtmlParsing
Assembly: EPiServer.Framework.dll
Version: 11.20.7Syntax
public interface IHtmlParserContext : IHtmlSource
Properties
CaseFolding
Gets the case folding.
Declaration
CaseFolding CaseFolding { get; }
Property Value
Type | Description |
---|---|
CaseFolding | The case folding. |
Options
Gets or sets the set of options that controls the parser behavior.
Declaration
ParserOptions Options { get; set; }
Property Value
Type | Description |
---|---|
ParserOptions | The options. |
Remarks
You should not change the value of Options in the middle of an enumeration as this may cause unexpected results.
SpecialTextFragment
Gets or sets state indicating that the next fragment should be treated as an implicit CDATA fragment.
Declaration
string SpecialTextFragment { get; set; }
Property Value
Type | Description |
---|---|
System.String | The special text fragment element name. |
Remarks
Used to handle <style> and <script> elements that requires the content between start and end elements to be treated as implicit CDATA. This is done to avoid problems with parsing characters that are perfectly legal in script or CSS but may look like HTML elements.
Note that the range of elements to handle are defined by the SetSpecialName method. Override that implementation to expand or reduce the range of elements to handle in this way.
Methods
GetBuilder()
Gets the shared StringBuilder instance.
Declaration
StringBuilder GetBuilder()
Returns
Type | Description |
---|---|
System.Text.StringBuilder | An empty StringBuilder instance. |
Remarks
This method helps reduce the numer of objects to create when parsing a large HTML stream by allowing the reuse of a single StringBuilder instance across the entire run.
GetRunningComparer(String)
Gets the running comparer matching the given string.
Declaration
RunningComparer GetRunningComparer(string match)
Parameters
Type | Name | Description |
---|---|---|
System.String | match | The string that the comparer will serach for. |
Returns
Type | Description |
---|---|
RunningComparer | An initialized instance of a RunningComparer. |
Remarks
This method helps reduce the numer of objects to create when parsing a large HTML stream by allowing the reuse of RunningComparer instances across the entire run.
GetToken(String, out Int32)
Gets the token.
Declaration
char[] GetToken(string terminators, out int length)
Parameters
Type | Name | Description |
---|---|---|
System.String | terminators | The terminators. |
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
System.Char[] |
IsWhiteSpace(Char)
Determines whether the specified character is white space.
Declaration
bool IsWhiteSpace(char character)
Parameters
Type | Name | Description |
---|---|---|
System.Char | character | The character. |
Returns
Type | Description |
---|---|
System.Boolean |
|
NextFragment()
Gets the next HTML fragment from the HTML source stream.
Declaration
HtmlFragment NextFragment()
Returns
Type | Description |
---|---|
HtmlFragment | A HtmlFragment that represents the next piece of information. |
SetSpecialName(String)
Sets the name of the special.
Declaration
void SetSpecialName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
SkipWhiteSpace()
Skips white space in the HTML source stream.
Declaration
bool SkipWhiteSpace()
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGetQuotedString(out String)
Tries to get a string that must be quoted.
Declaration
bool TryGetQuotedString(out string quotedString)
Parameters
Type | Name | Description |
---|---|---|
System.String | quotedString | the quoted string. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
Will ignore leading whitespace characters.
TryGetString(String, out String)
Tries to get a string that may be quoted or unquoted.
Declaration
bool TryGetString(string terminators, out string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | terminators | A set of characters that will end the parsing. |
System.String | value | The value. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
Will ignore leading whitespace characters. A quoted string is defined as starting with a single quote (') or a double quote (").
TryGetUnquotedString(String, out String)
Tries to get a string that must be unquoted.
Declaration
bool TryGetUnquotedString(string terminators, out string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | terminators | A set of characters that will end the parsing. |
System.String | value | The value. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
Will ignore leading whitespace characters. Since the string must be unquoted, single quote (') and double quote (") are implicitly added to the terminators.