XmlSyntaxTree Class
An XML document read from source text, together with what is wrong with it.
public sealed class XmlSyntaxTree : SyntaxTreeExample
var tree = XmlSyntaxTree.ParseText("<root />");
var updated = tree.WithChanges(new TextChange(new TextSpan(0, 0), "<!--generated-->"));
Assert.Equal("<!--generated--><root />", updated.GetText().Text);- Inheritance
SyntaxTreeXmlSyntaxTree
Properties
| Name | Description |
|---|---|
| FilePath |
FilePath
XmlSyntaxTree.csMethods
| Name | Description |
|---|---|
| GetDiagnostics() | Gets everything wrong with the document, in the order it appears in the text. |
| GetRoot() | Gets the document this tree holds. |
| GetText() | |
| IsEquivalentTo(XmlSyntaxTree?) | Determines whether the two trees say the same thing, ignoring how they are laid out. |
| ParseText(SourceText) | |
| ParseText(string) | |
| WithChanges(TextChange[]) | |
| WithChanges(IEnumerable<TextChange>) |
GetDiagnostics()
XmlSyntaxTree.csGets everything wrong with the document, in the order it appears in the text.
public override IReadOnlyList<Diagnostic> GetDiagnostics()Returns
GetRoot()
XmlSyntaxTree.csGetText()
XmlSyntaxTree.csIsEquivalentTo(XmlSyntaxTree?)
XmlSyntaxTree.csDetermines whether the two trees say the same thing, ignoring how they are laid out.
public bool IsEquivalentTo(XmlSyntaxTree? other)Parameters
otherXmlSyntaxTree?
Returns
Remarks
This compares the documents rather than their trees, because two documents that differ only in whitespace between tags have genuinely different trees: that whitespace is character data, not trivia.
ParseText overloads
ParseText(SourceText)
XmlSyntaxTree.cspublic static XmlSyntaxTree ParseText(SourceText text)ParseText(string)
XmlSyntaxTree.cspublic static XmlSyntaxTree ParseText(string text)WithChanges overloads
WithChanges(TextChange[])
XmlSyntaxTree.cspublic XmlSyntaxTree WithChanges(params TextChange[] changes)WithChanges(IEnumerable<TextChange>)
XmlSyntaxTree.cspublic XmlSyntaxTree WithChanges(IEnumerable<TextChange> changes)