我正在尝试用JSF/J2EE开发一个应用程序:多维分析应用程序,我生成一个Schema文件,现在我想用mondrian.xsd来验证它--这是我生成的代码:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Schema description="test shcema description" name="First Schema9">
<Cube cache="true"
caption="code here"
description="cubeInSchema"
enabled="true"
name="First Cube7"/>
<Parameter defaultValue="admin"
description="parameter role"
modifiable="true"
name="param name"
type="String"/>
</Schema>但我在验证中得到了以下错误:
**cvc-complex-type.2.4.b: The content of the element "Cube" is not complete. One of the values "{Annotations, Table, View}" is expected.**==>但是我不认为我们应该在每个立方体中有一个{Annotations,Table,View}。我不知道如何验证我的mondrian模式。
发布于 2014-06-02 21:06:36
在mondrian.xsd XSD中,Cube元素声明为:
<xsd:element name="Cube" minOccurs="1" maxOccurs="unbounded">
...
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Annotations" type="Annotations" minOccurs="0" maxOccurs="1"/>
<xsd:group ref="FactTable" minOccurs="1" maxOccurs="1">
...
</xsd:group>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="DimensionUsage" type="DimensionUsage"/>
<xsd:element name="Dimension" type="PrivateDimension"/>
</xsd:choice>
<xsd:element name="Measure" minOccurs="1" maxOccurs="unbounded">
...然后声明chid <Annotations>元素是可选的(minOccurs="0"),但是FactTable组中的元素、<Dimension>或<DimensionUsage>以及<Measure>元素必须按照这个顺序出现。
搜索您找到的FactTable组:
<xsd:group name="FactTable">
<xsd:choice>
<xsd:element name="Table" type="Table"/>
<xsd:element name="View" type="View"/>
</xsd:choice>
</xsd:group>这意味着<Cube>中强制的元素是<View> (或<Table>)、<Dimension> (或<DimensionUsage>)和<Measure>。如果它们不存在,则您的实例将不会验证。
此外,在<Schema>序列中还有一个强制顺序:<View>必须出现在<Parameter>之后(而不是像您的示例中那样)。
我根据您的文件从mondrian.xsd模式生成了一个最小的验证文件。考虑到选项Dimension和View,所有这些都是强制性的:
<Schema description="test shcema description" name="First Schema9">
<Parameter defaultValue="admin"
description="parameter role"
modifiable="true"
name="param name"
type="String"/>
<Cube cache="true"
caption="code here"
description="cubeInSchema"
enabled="true"
name="First Cube7">
<View alias="aaa">
<SQL dialect="sss"></SQL>
</View>
<Dimension name="bbb">
<Annotations>
<Annotation></Annotation>
</Annotations>
<Hierarchy hasAll="false">
<Level name="ccc"></Level>
</Hierarchy>
</Dimension>
<Measure name="ddd" aggregator="max"/>
</Cube>
</Schema>https://stackoverflow.com/questions/24002731
复制相似问题