We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

JSon Language Configuration

Thread ID:

Created:

Updated:

Platform:

Replies:

125305 Aug 6,2016 08:24 PM Aug 10,2016 07:16 AM Windows Forms 1
loading
Tags: EditControl
Ron Milne
Asked On August 6, 2016 08:24 PM

Does anyone have a language configuration for parsing Json files?

Venkateshwaran Ramdoss [Syncfusion]
Replied On August 10, 2016 07:16 AM

Hi Ron, 
 
Thank you for contacting Syncfusion Support. 
 
The custom language can be configured in the EditControl by using the configuration file. By configuring the custom language in the EditControl, you can define the syntax coloring based on the requirement. The following steps help you to configure the syntax coloring for the Json language. 
 
 
Step 1(Initialize the configuration language): Set the configured language by using the ConfigLanguage tag attribute.  
 
For an example: <ConfigLanguage name="Json" StartComment="//" CaseInsensitive="true" >  
 
Step 2(Extensions): Extensions contain a list of extensions that are associated with that particular language. 
 
Step 3(Splits): Splits contain a list of expressions that must be treated as one word. “=” and “+” are splitters, by default. So, each of them are returned by the tokenizer as a single char. For example, when you want to specify a configuration for “+=”, you should specify “+=” in the splits section. 
 
Step 4(Formats): This section helps you to initialize the Format strings. The Format assigns the syntax coloring for the keywords, text, comment tag, etc. 
 
Step 5(Lexems): The Lexem contains rules for parsing the text. There are two attributes to specify the format of the lexem. 
·       Type: The Type is used for standard predefined types of the lexems. 
·       FormatName: The FormatName is used only when Type is Custom. 
 
Step 6(AutoReplaceTriggers): The AutoReplaceTrigger option helps you to autocorrect the mistakes in the EditControl. 
 
For an example:  
 
<AutoReplaceTriggers> 
  <AutoReplaceTrigger From="slef" To="self" /> 
</AutoReplaceTriggers> 
 
Step 7: After configuring the custom language, the configured file can be applied to the EditControl by using the Configurator.Open function in the EditControl. 
 
Step 8: The text coloring of the specified language can be applied to the EditControl by using the ApplyConfiguration function in the EditControl. 
 
For an example: 
 
// Opens the PowerShell file. 
this.editControl1.LoadFile(@"..\\..\\Sample.json"); 
//Configures the Custom Language File. 
this.editControl1.Configurator.Open(@"..\\..\\Config.xml"); 
//Applies the Custom Language configuration to the EditControl. 
this.editControl1.ApplyConfiguration("Json"); 
 
You can refer the below KB link for brief explanation of syntax highlighting for Custom Language Configuration. 
 
KB Link:  
 
We have prepared a sample to Parsing Json language in EditControl using above stepsfor your reference and you can download the sample and screenshots from the below link.  
 
 
We request you to check with the above solution and let us know if it helps.  
 
Regards, 
Venkateshwaran V.R. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;