Transition to another language from stream?

Posted 10 years ago by Avatar Jeff Cohen
I have two .xml definition files, and one transitions to the other with the typical <State Filename="child.xml"> tag. The syntax coloring works great in both the parent and child language sections of the document.

But I'd prefer to embed my dynamic language .xml files into my executable instead of deploying physical files. Using the LoadFromXml() overload that takes a stream works great for the parent language, but using the <State Filename="child.xml"> tag won't work if I'm loading from streams (i.e., how would it know which stream I'm referring to?)

So, I thought maybe I'll have to extract my embedded .xml files to disk a runtime with an encoding value, and then read them from disk instead - but again, how would I specify the encoding value in the <State> tag?

Or, could I extract the files without encoding, load the definitions, and then immediately delete the .xml files on disk?

I also see the <StateTransition> tag and I'm wondering if I should be using that instead anyway? So I'm wondering if I'm missing an important concept here in all of this...?

Any tips?


Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Jeff,

One thing you can do is load them in our SDI Editor sample as merged, then save the merged language back out as a file. I believe that doing that will place all the merged languages in a single XML definition, thus circumventing this issue.

Alternatively you could maybe do like what you thought, by saving them to a temp folder, loading the DynamicSyntaxLanguage class, and then deleting the files.

Actipro Software Support
Information The latest build of this product (2016.1 build 0330) was released 11 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.