LoadLanguageFromXml from Stream

SyntaxEditor for Windows Forms Forum

Posted 8 years ago by Peter Treier
Version: 4.0.0288
Avatar
Hi all

I try to load a Language file from a embedded Resource !

namespace XTOOLZ.EDMX.Visualizer.Controls
{
    public partial class xmlViewer : UserControl
    {
        public string entitySetName { get; set; }
        public EntityStorageModel model { get; set; }

        private const string DYNAMIC_LEXERS_PATH = "XTOOLZ.EDMX.Visualizer.Lexer.ActiproSoftware.XML.xml";

        public xmlViewer()
        {
            InitializeComponent();

            var stream = (System.Reflection.Assembly.GetExecutingAssembly()).GetManifestResourceStream(DYNAMIC_LEXERS_PATH );
            if (stream != null)
            {
                xmlEditor.Document.LoadLanguageFromXml(stream, 0);

                xmlEditor.Document.Outlining.Mode = OutliningMode.Automatic;
                xmlEditor.Document.SemanticParsingEnabled = true;
                xmlEditor.Document.LexicalParsingEnabled = true;
            }
        }

        public void fill(string xmlText)
        {
            xmlEditor.Document.Text = "<XToolz.EDMX.Viewer>" + xmlText + "</XToolz.EDMX.Viewer>";
        }

    }
}
The stream contains data, but I get this Error :

An error occurred while loading the DynamicSyntaxLanguage '{Unknown}':
The syntax language type 'TestApplication.XmlDynamicSyntaxLanguage, TestApplication' could not be loaded. Please see the 'Troubleshooting' topic in the documentation for details on how to resolve this error.
The problem occurred near line 1, position 2
in Unknown Stream.

Any idea whats wrong here ?

Kind Regards
Peter

Comments (4)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Peter,

Per the exception message, take a look at the Troubleshooting documentation topic. It explains what that error means and how to resolve it. Let us know if you still can't figure it out after reading through the documentation it points to.


Actipro Software Support

Posted 8 years ago by Peter Treier
Avatar
Still in trouble :-/
I changed the XML File like that

<SyntaxLanguage Key="XML" LanguageDefinitionVersion="4.0" Secure="True" 
                SyntaxLanguageTypeName="XTOOLZ.EDMX.Visualizer.Controls.Lexer.XmlDynamicSyntaxLanguage, xmlViewer" 
                xmlns="http://ActiproSoftware/SyntaxEditor/4.0/LanguageDefinition">
But the error still occures...
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you look in reflector or in the VS Object Browser do you see:
Assembly name is: xmlViewer.exe or xmlViewer.dll
Namespace is: XTOOLZ.EDMX.Visualizer.Controls.Lexer
Type name is: XmlDynamicSyntaxLanguage

If so, it should be working fine as long as you have copied the XmlDynamicSyntaxLanguage right from our sample.


Actipro Software Support

Posted 8 years ago by Peter Treier
Avatar
Reflector was a good idea !

That's the correct Setting

<SyntaxLanguageTypeName="XTOOLZ.EDMX.Visualizer.Lexer.XmlDynamicSyntaxLanguage, XTOOLZ.EDMX.Visualizer"/> 
Peter

[Modified at 04/01/2011 09:43 AM]
The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.