-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathProcessingInstruction.cs
More file actions
57 lines (52 loc) · 1.71 KB
/
ProcessingInstruction.cs
File metadata and controls
57 lines (52 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace Waher.Content.Html
{
/// <summary>
/// Represents a Processing instruction inside the document.
/// </summary>
public class ProcessingInstruction : HtmlNode
{
private readonly string instruction;
/// <summary>
/// Represents a Processing instruction inside the document.
/// </summary>
/// <param name="Document">HTML Document.</param>
/// <param name="Parent">Parent node. Can be null for root elements.</param>
/// <param name="StartPosition">Start position.</param>
/// <param name="EndPosition">End position.</param>
/// <param name="Instruction">Instruction</param>
public ProcessingInstruction(HtmlDocument Document, HtmlElement Parent, int StartPosition,
int EndPosition, string Instruction)
: base(Document, Parent, StartPosition, EndPosition)
{
this.instruction = Instruction;
}
/// <summary>
/// Unparsed Processing instruction.
/// </summary>
public string Instruction => this.instruction;
/// <summary>
/// Exports the HTML document to XML.
/// </summary>
/// <param name="Namespaces">Namespaces defined, by prefix.</param>
/// <param name="Output">XML Output</param>
public override void Export(XmlWriter Output, Dictionary<string, string> Namespaces)
{
Output.WriteRaw("<?");
Output.WriteRaw(this.instruction);
Output.WriteRaw("?>");
}
/// <summary>
/// Exports the HTML document to XML.
/// </summary>
/// <param name="Output">XML Output</param>
public override void Export(StringBuilder Output)
{
Output.Append("<?");
Output.Append(this.instruction);
Output.Append("?>");
}
}
}