How to use Oxygen XML Editor to develop DSL IDE?

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
serioadamo97
Posts: 9

How to use Oxygen XML Editor to develop DSL IDE?

Mon Feb 12, 2018 9:08 pm

Hi,
I've been using Oxygen XML Editor for a while, but my main job is to focus on XML document editing, XSD design, validation, and XSLT transformations, it's really good.

Now, I want to use XML to create DSL (domain-specific-language). My DSL is a kind of data instance definition language:
There are no processes or functions, but it still has some concepts such as variables, external file import, symbol scoping, cross reference, inheritance and so on. The purpose of the DSL is to facilitate users to quickly input data because there are many duplication parts in the data.

You can see these data as a form of serialization of the Java object, but the user can edit it directly.

My question is:
Does Oxygen XML Editor support the development of such DSL IDE? (or general programming language which like XSLT?)
For example, support content completion just like using Oxygen XML Editor to edit XSLT file.
Imagine, If we have some language which very like XSLT, how to use Oxygen XML Editor to implement IDE for this. (no need execute, only editing and validation)

I know that XSD can be seen as the grammar of DSL, and we also can use Schematron/XSLT for semantic validation, but they have some shortcomings:

(1) XSD-based content completion (default) in Oxygen XML Editor only support relationship of containment, it does not support cross-reference.
What I really want is something like editing XSLT in Oxygen XML Editor, for example:

Code: Select all

    <xsl:template match="/">
        <xsl:variable name="v1" select="'foo'"/>
        <xsl:value-of select="$v1"/>
    </xsl:template>

When we writing <xsl: value-of select = ", Oxygen XML Editor will prompt $v1. This is scoping base cross-reference content completion.

(2) Schematron/XSLT is declarative rather than imperative. So there is no way to do some optimization.(eg: dynamically cache at runtime), there may be performance issues.

So, how does Oxygen XML Editor support the development of such DSL IDE?
I found that we can create Content Completion Configuration, but I don't know how to use it.
Or we should write Java Plugin?
What are the Best Practices?
Thanks.
adrian
Posts: 2360

Re: How to use Oxygen XML Editor to develop DSL IDE?

Tue Feb 13, 2018 4:37 pm

Hi,

I'm afraid it's not possible to use/customize Oxygen XML Editor for editing (with helpers) custom content other than XML. The "Content Completion Configuration" only works for XML. There is no way to provide user defined syntax highlight (color coding) and content completion rules in Oxygen for a custom non-XML (text) editor.

Does Oxygen XML Editor support the development of such DSL IDE? (or general programming language which like XSLT?)
For example, support content completion just like using Oxygen XML Editor to edit XSLT file.
Is your DSL XML-based, like XSLT is?

If it's XML based, you just need an XML schema to make content completion and validation work in Oxygen. CSS is optional, only if you want to use the Author mode.

If it's non-XML I'm afraid there's nothing that can be done to support editing it in Oxygen.
A Java plugin won't help because there are no extension points to support a custom type of editor.
There are ways to mimic your non-XML DSL in Author mode (have an XML+schema+CSS behind the scene), but I don't think this is what you are looking for.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
serioadamo97
Posts: 9

Re: How to use Oxygen XML Editor to develop DSL IDE?

Tue Feb 13, 2018 7:50 pm

adrian wrote:Hi,
I'm afraid it's not possible to use/customize Oxygen XML Editor for editing (with helpers) custom content other than XML. The "Content Completion Configuration" only works for XML. There is no way to provide user defined syntax highlight (color coding) and content completion rules in Oxygen for a custom non-XML (text) editor.

Hi, Adrian,

I did not want to use Oxygen XML Editor for editing custom content (pure text) other than XML.
My DSL is absolutely XML based (just like XSLT), not pure text (eg: c++, javascript).

Yes, XML schema can make content completion and validation work, but it still have some shortcoming which I have mentioned before.

For examples:

(1) XSD-based content completion does not support cross-reference. (Even cross-document-references, cross-document-references based scoping)

(2) Schematron/XSLT can do semantics-checking, but they are declarative rather than imperative.
So there is no way to do optimization. For example, we have 10000 DSL XML files, how to validate them efficiently? One way is using a master file to include all of them, but this makes performance poor. Because whenever a file is modified, 10000 DSL files need be validated. So we must disable auto-validation, and only used it when full verification is required (just like C++ press Rebuild button in visual studio, in this case, performance is not a problem). Another way is to only validate the opened file automatically. Since the opened file maybe has some cross-document-references, so we need read other files when validating the opened file. This approach seems to make sense, but I want to know if there is best practice.

(3) Preprocessor
If the DSL have some feature like "macro", how to support it?
A naive way is using pipeline:
First using XSLT to preprocess source file, then using XSD to validate the result file.
But it seems not possible to obtain detailed information about the error with XProc...

And so on...

So I want to know what's the Best Practices for developing DSL IDE in Oxygen XML Editor?
How to use Oxygen XML Editor to develop DSL just like XSLT?

Another question is:
In the folder (C:\Program Files\Oxygen XML Editor 19\lib\external\ant), I found some jar files:
oxygen-ant-content-completion.jar
oxygen-ant-core.jar
oxygen-ant-validation.jar
What is this?
Why does Oxygen XML Editor not use XSD or DTD or Schematron to validate ANT file?
Is this a start point of developing DSL IDE?

Thanks.
adrian
Posts: 2360

Re: How to use Oxygen XML Editor to develop DSL IDE?

Thu Feb 15, 2018 5:46 pm

Hi,

So I want to know what's the Best Practices for developing DSL IDE in Oxygen XML Editor? How to use Oxygen XML Editor to develop DSL just like XSLT?
I'm afraid we do not have such best practices for DSL in specific. There is a framework customization tutorial in the user guide, but that revolves around the Author mode, which you do not seem to need.
The XSL editor from Oxygen is a specialized XML editor that collects XSL templates functions and variables and provides content completion when they are referenced. The XSL editor is using private API to achieve this, so there is no way to develop an Oxygen plugin that replicates its behavior for your DSL.
The same is true for the ANT editor.
Why does Oxygen XML Editor not use XSD or DTD or Schematron to validate ANT file?
Because there is no XML Schema that describes the full model that ANT build files have.

You are probably better off trying to develop a plugin for the Eclipse IDE to edit your DSL. Eclipse is specifically designed to be extended and provides the necessary API to implement custom editors with content completion and validation.
Oxygen is also available as a plugin for Eclipse. So you could also use Oxygen in the Eclipse IDE for the rest (XML, XSD, etc).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 0 guests