I'm trying to validate a mixed content element which should contain exactly one text node. Eg, this should validate:
<corner description="ff models, bc RC; high temperature,high vdd">
<modelSection>fff_pre</modelSection>
<var value="high">temperature</var>
<var value="high">vdd</var>
fff_pre_Thi_Vhi_Vhi
</corner>
but this should not:
<corner description="ff models, bc RC; high temperature,high vdd">
<modelSection>fff_pre</modelSection>
<var value="high">temperature</var>
<var value="high">vdd</var>
<!-- no text, invalid! -->
</corner>
I tried
corner = element corner {
description,
(
modelSection
& var+
& xsd:string
)
}
(where description, modelSection and var are previously defined) but while validating the first example above rnv reports a "text not allowed" error for fff_pre_Thi_Vhi_Vhi. Substituting & text for & xsd:string validates a textless <corner>, which I don't want. Feels like this must be simple and I'm overlooking something... Thanks for any advice.
When I try to run
jingwith your schema (after adding the missing bits and converting from rnc to rng), I get this error:This error correspond to the part of the rng that defines the contents of the
cornerelement.This suggest to me that you are running smack dab into the limitation specified in Section 7.2 of the Relax NG spec. In your case, you are trying to have an element which will accept as children other elements and a
datapattern. The spec does not allow it.If you are generating the XML, you could solve the issue by generating a structure like this:
With a rnc like this:
I used
dataas the name of the element but I would want something more specific than this in a final solution.