AvalonEdit:如何修改xshd文件以更改元素atrribute

时间:2015-07-22 11:24:25

标签: c# xml text-formatting avalonedit

我尝试修改xshd文件以在c#中以编程方式更改元素Color的属性前景。我试图使用XmlAtrribute来访问它并更改它但它没有用。我怎么能改变它?这是我在下面的xshd文件

 <?xml version="1.0"?>
<SyntaxDefinition name="Boo" extensions=".boo" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="String" foreground="Red" />
<Color name="Comment" foreground="Green" />

<!-- This is the main ruleset. -->
<RuleSet>
<Span color="Comment" begin="//" />
<Span color="Comment" multiline="true" begin="/\*" end="\*/" />
<Span color="String">
  <Begin>'</Begin>
  <End>'</End>
  <RuleSet>
    <!-- nested span for escape sequences -->
    <Span begin="\\" end="." />
  </RuleSet>
</Span>
<Keywords fontWeight="bold" foreground="Green">
  <Word>IF</Word>
  <Word>IFEND</Word>
  <Word>DECLARED</Word>
</Keywords>
<!-- Digits -->
<Rule foreground="Gray">
    \b0[xX][0-9a-fA-F]+  # hex number
    |    \b
    (    \d+(\.[0-9]+)?   #number with optional floating point
    |    \.[0-9]+         #or just starting with floating point
    )
    ([eE][+-]?[0-9]+)? # optional exponent
  </Rule>
<Rule  foreground="Blue">
    \w*-\w*-*\w*
  </Rule>
<Rule foreground="Pink">
    (\w*=\w*)
  </Rule>
 </RuleSet>
</SyntaxDefinition>

1 个答案:

答案 0 :(得分:0)

使用LINQ试试这个:

csh