Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8149901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:56:37+00:00 2026-06-06T14:56:37+00:00

I’m working on highlighting a small scripting language (that is not a derivative of

  • 0

I’m working on highlighting a small scripting language (that is not a derivative of any of the built in’s) and I had a custom XML file setup for different syntax keywords and such.

I would really like to use the XSHD system that exists in AvalonEdit for loading custom keywords, but I need to have custom attributes in them.

So basically, after a lot of searching through the source code, I could not really pin-point the file that reads and specifies the keywords and rulesets.

Does anyone here know where I can edit the needed class to read some custom attributes and storing them?

I have all the XSHD and higlighting stuff in AvalonEdit down and working, so it’s not using it that is the problem, per say, it’s more the problem of using custom attributes in the keywords collection of the XSHD file.

In example:

<Keywords>
   <Word defaultValue="hello" requiresShader="shadertype1, shadertype2" someCustomAttr="value">wordname</word>
</Keyword>

So, I need to set some custom properties to the parser of the XSHD file to load these custom attributes and store them in a custom class I have made that handles a few logical components that are crucial to what I’m trying to do.

I already have a working parser that parses a XML file of all my keywords and their properties (but I wrote it to ScintillaNET, but found AvalonEdit afterwards, that works better with WPF and such).

I will edit the original post with this information, sorry about possible misinformation.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:56:38+00:00Added an answer on June 6, 2026 at 2:56 pm

    To load an XSHD file, you need to import the following libraries:

    using ICSharpCode.AvalonEdit;
    using ICSharpCode.AvalonEdit.Highlighting;
    using ICSharpCode.AvalonEdit.Highlighting.Xshd;    
    

    And then wherever you create the text editor (omit the first line and just reference the TextEditor if you create it in XAML), use the following code to load def.xshd.

    // TextEditor is an AvalonEdit.TextEditor
    TextEditor edit = new TextEditor();
    XmlReader reader = XmlReader.Create("def.xshd");
    edit.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
    

    A good sample xshd file that I am using for a language in the works is this:

    <SyntaxDefinition name="XAPL"
        xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
    <Color name="Comment" foreground="Green" />
    <Color name="String" foreground="Pink" />
    <Color name="Xml" foreground="Orange" />
    <!-- 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>
    
      <Span color="Xml" multiline="false">
        <Begin>spaz</Begin>
        <End>spaz</End>
      </Span>
    
    
        <Keywords fontWeight="bold" foreground="Blue">
            <Word>dealwith</Word>
            <Word>import</Word>
            <Word>end</Word>
            <Word>var</Word>
            <Word>default</Word>
            <Word>template</Word>
            <Word>sub</Word>
            <Word>category</Word>
            <Word>if</Word>
            <Word>otherwise</Word>
            <Word>and</Word>
            <Word>xor</Word>
            <Word>string</Word>
            <Word>int</Word>
            <Word>convert</Word>
            <Word>to</Word>
            <Word>escape</Word>
            <Word>native</Word>
            <Word>loop</Word>
            <Word>is</Word>
            <Word>to</Word>
            <Word>from</Word>
            <Word>by</Word>
        </Keywords>
    
        <!-- Digits -->
        <Rule foreground="DarkGray">
            \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>
    </RuleSet>
    </SyntaxDefinition>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need a function that will clean a strings' special characters. I do NOT
I'm parsing an XML file, the creators of it stuck in a bunch social
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.