A couple of questions
1.
I am having a problem where I cannot find certain
schemaIdentityConstraints in the generated code for our XSD. Our code
walks the schema and derives a mapping from the constrained element to
its actual constraint and scope in the model. This is working for the
vast majority of cases, but for some of our top-level elements they
cannot be found. I am currently checking for the presence of constraints
by walking the global schemaTypes via the containment hierarchy in the
tree. Each complex type (we use named types only) is checked for
constraints as follows:
private SchemaIdentityConstraint[] getConstraints(SchemaType
_schemaType)
{
SchemaIdentityConstraint[] constraints = null;
if(isLocalElement(_schemaType))
{
SchemaLocalElement local =
(SchemaLocalElement)_schemaType.getContentModel();
constraints = local.getIdentityConstraints();
}
return constraints;
}
Can anyone tell me what am missing or doing wrong? Are there other
component types I have to check for constraints?
2.
Something else I have noticed is that the generated identity constraint
for an element in the schema is actually associated against its
containing schemaType - which makes it hard to use ./xxx in a
constraint definition - since the scope in the generated code is one
step higher than its original definition. Is this intentional? If so, I
would be interested to know why it is done this way and possibly a
strategy to manage these scopes in a way consistent with the XSD.
Currently I have to wrap my selector access with the extra inserted
element name - this works, but seems awkward.
any guidance is greatly appreciated
LW