[Mondrian] RE: Comments support in eigenbase

Julian Hyde jhyde at pentaho.com
Thu Nov 20 07:46:15 EST 2008

> Somita wrote:
> I am working on Schema Workbench and would like to preserve 
> all comments in Mondrian schema files that are loaded in it. 
> These comments are ignored by MondrianGuiDef.java.

For background, what changes are you making to the workbench?

What do you mean by comments? Javadoc comments, to appear in the generated
Java code, or comments by users of the workbench?

> I tried putting contentModel Attribute in Schema Element as
>    <Element type="Schema">
> 	...
> 	<Attribute name="contentModel" default="mixed"/>
> 	...
> But this does not generate the appropriate 
> MondrianGuiDef.java nor the Mondrian_SW.dtd. The schema 
> definition in Mondrian_SW.dtd should have #PCDATA 
> automatically inserted in its list of sub-elements as in 
> 	<!ELEMENT Schema (#PCDATA,(Parameter)*,(Dimension)* ...

If you want an element to have a mixed content model, you need to specify
contentModel="mixed", not use an <Attribute> element. Here's an example of
how I have used it in Mondrian.xml (not checked in yet):

    <Element type="SQL" contentModel="mixed">
        <Attribute name="dialect" required="true" default="generic">
                Dialect of SQL the view is intended for. Valid values
                but are not limited to:

I did this because I wanted SQL to contain alternating text and XML

Having said that, I don't think that mixed content type is the solution to
your problem. Don't change the content model of the Schema element to mixed;
it will make the schema difficult to parse.

Introduce a sub-element called Comment of type StringElement. For an
example, see how Doc is defined as a StringElement in Meta.xml.


More information about the Mondrian mailing list