[Mondrian] RE: Comments support in eigenbase

Arora, Somita sarora at cincom.com
Thu Nov 20 08:41:58 EST 2008

Hi Julian,

Comments, I mean, the comment tags in an xml file. Eg:
	<!-- hello string -->

Schema Workbench does not preserve such comments found in a Mondrian
schema file (say FoodMart.xml). A schema files loose all comment tags
when opened and saved in workbench.

We are not making changes to the workbench but would like to understand,
if we want to retain these comments, what changes could be done to the
definition in Mondrian_SW.xml

If I go by defining a sub-element Comment of type StringElement, I'll
have to put all comments in <Comment> tags. This is not normally
followed to enter comments in xml files.
Is there any other way I can define in Mondrina_SW.xml to handle xml
comment tags found in elements along with other sub-elements?
Eg. to handle this

	<Schema name="MyMart">
  			== This Mart describes the analysis and trends
found in Inventory data
		<Cube name="Inventory" >
			<Table name="inventoryDB" ></Table>

Thanks & Regards,
Somita Arora

-----Original Message-----
From: Julian Hyde [mailto:jhyde at pentaho.com] 
Sent: Thursday, November 20, 2008 6:16 PM
To: Arora, Somita; 'Mondrian developer mailing list'
Cc: De, Sunil
Subject: RE: Comments support in eigenbase

> 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
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
contentModel="mixed", not use an <Attribute> element. Here's an example
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
your problem. Don't change the content model of the Schema element to
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