Hi all,
First, some some background information.
I have written a Java application that runs XML-based scripts with relatively simple syntax. The syntax is defined in a schema, so it's possible to a) generate Java binding classes for the application and b) use an editor with validation and code completion.
The scripts are becoming longer and more complex; they could be greatly simplified if there were support for procedures. It's probably possible to generate complex scripts using XSLT, but I have a very superficial knowledge of it and this approach seems too cumbersome, so I'll probably go with procedures. They would be defined and called in the same script file, I imagine.
I would like to define as much of the syntax as possible in the schema and do as little as possible additional validation on the application interpreter level; additionally, I'd like to keep the syntax simple.
The problem is to choose the right syntax and scope for the procedure arguments.
Now, the question:
Is there any way to define the relationship between procedure arguments and procedure calls in the schema, using keyref, idref or anything else?
For example (not the simplest syntax):
<ProcedureDef name="foo">
<ArgumentDef name="fooarg1"/>
<ArgumentDef name="fooarg2"/>
<DoStuff>
....
<DoStuff/>
</Procedure>
<ProcedureDef name="bar">
<DoStuff>
....
<DoStuff/>
</Procedure>
<Call procedureName="foo">
<Argument name="fooarg1" value="1"/>
<Argument name="fooarg2" value="2"/>
</Call>
<Call procedureName="foo">
<Argument name="fooarg1" value="3"/>
<Argument name="fooarg2" value="4"/>
</Call>
<Call procedureName="bar"/>
Many thanks in advance for any advice.
First, some some background information.
I have written a Java application that runs XML-based scripts with relatively simple syntax. The syntax is defined in a schema, so it's possible to a) generate Java binding classes for the application and b) use an editor with validation and code completion.
The scripts are becoming longer and more complex; they could be greatly simplified if there were support for procedures. It's probably possible to generate complex scripts using XSLT, but I have a very superficial knowledge of it and this approach seems too cumbersome, so I'll probably go with procedures. They would be defined and called in the same script file, I imagine.
I would like to define as much of the syntax as possible in the schema and do as little as possible additional validation on the application interpreter level; additionally, I'd like to keep the syntax simple.
The problem is to choose the right syntax and scope for the procedure arguments.
Now, the question:
Is there any way to define the relationship between procedure arguments and procedure calls in the schema, using keyref, idref or anything else?
For example (not the simplest syntax):
<ProcedureDef name="foo">
<ArgumentDef name="fooarg1"/>
<ArgumentDef name="fooarg2"/>
<DoStuff>
....
<DoStuff/>
</Procedure>
<ProcedureDef name="bar">
<DoStuff>
....
<DoStuff/>
</Procedure>
<Call procedureName="foo">
<Argument name="fooarg1" value="1"/>
<Argument name="fooarg2" value="2"/>
</Call>
<Call procedureName="foo">
<Argument name="fooarg1" value="3"/>
<Argument name="fooarg2" value="4"/>
</Call>
<Call procedureName="bar"/>
Many thanks in advance for any advice.