XmlSyntaxLanguage and KeyPressTrigger

SyntaxEditor Web Languages Add-on for Windows Forms Forum

Posted 14 years ago by Stefan
Avatar
Hello,

is it possible to use the features of the XmlSyntaxLanguage like IntelliPrompt of members and schema validation, and to use a KeyPressTrigger for inserting Placeholders? How can I do it?

Greetings,
Stefan

[Modified at 02/17/2010 03:24 AM]

Comments (5)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Stefan,

Yes you can use triggers on any language. But sorry, I'm not sure what you mean by "placeholders". It looks like you submitted a ticket on this issue too, so we'll look at that and reply more there.


Actipro Software Support

Posted 14 years ago by Stefan
Avatar
Thanks for your mail.

But I have another question:

Is it possible to ignore a specific line or text in my XmlSyntaxLanguage, so that the line or text is not parsed by the semantic parser?

Greetings,
Stefan
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Stefan,

If you are trying to add your own extra syntax to the XML add-on language, you would have to:

1) Override the "object PerformSemanticParse(MergableLexicalParserManager manager)" method. Right now it does this:
protected override object PerformSemanticParse(MergableLexicalParserManager manager) {
    MergableRecursiveDescentLexicalParser lexicalParser = new MergableRecursiveDescentLexicalParser(this, manager);
    lexicalParser.InitializeTokens();
    XmlSemanticParser semanticParser = new XmlSemanticParser(lexicalParser);
    semanticParser.Parse();
    return semanticParser.CompilationUnit;
}
The MergableRecursiveDescentLexicalParser is what feeds tokens from your main lexical parser to the semantic parser. So you'd need to make a class that inherits MergableRecursiveDescentLexicalParser and "filter" out the tokens you are adding so that they don't interfere with the AST that is built for the XML.

2) Turn SchemaValidationEnabled off on the language because unfortunately there isn't a way to filter out your custom placeholders for what is sent to the validation code.


Actipro Software Support

Posted 14 years ago by Stefan
Avatar
Hello Support Team,

where can I find the XmlSemanticParser class? Or do I have to write my own semantic parser (with its own grammar)?

All I want to do is ignore the DOCTYPE line, like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

If I doesn't enable the DTDSupport, then I only receive an error message by the semantic parser, and none of the other errors in the file.

I know that i can enable the DTDSupport by:
xmlSchemaResolver.DtdSupportEnabled = true;
xmlSchemaResolver.DtdPath = @"D:\";

and specify the path, because I don't want to download all DTDs from the web.
BUT: If I do that, I have to change the DOCTYPE expression to:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">

But then my XHTML-Templates won't work. So I thought I could implement, that the semantic parser ignores this line.

To cut a long story short: I want to validate my XHTML-Files against the XHTML-Schema, although there is a DOCTYPE expression with a link to a DTD.

Do you have any idea?

Greetings,
Stefan

[Modified at 02/19/2010 04:45 AM]
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Stefan,

Oh sorry, it looks like XmlSemanticParser is internal to our Web Languages Add-on assembly. What you could do is purchase the Blueprint source code for the product (only $249.95) and update it however you want. That may be your best option if you are trying to change the syntax of things.

Unfortunately we're rather limited in how we can handle the DTD processing because we use the Microsoft classes to do it, such as XmlReaderSettings and XmlReader. I don't believe there is a way for them to say allow DTD processing but don't go onto the web if needed.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.