}
if (bindingName == null) {
//do we have a containing type?
if (container != null) {
XSDNamedComponent base = container;
//the container itself could be an anonymous type, check for
// a named containing element
if ( container.getName() == null ) {
if ( container.getContainer() instanceof XSDElementDeclaration ) {
XSDElementDeclaration e = (XSDElementDeclaration) container.getContainer();
//only do this if the containing element is global
if ( e.isGlobal() ) {
base = e;
}
}
}
//get the anonymous element, and look it up in the container type
if (type.getContainer() instanceof XSDElementDeclaration) {
XSDElementDeclaration anonymous = (XSDElementDeclaration) type.getContainer();
XSDParticle particle = Schemas.getChildElementParticle(container,
anonymous.getName(), true);
if (particle != null) {
bindingName = new QName(base.getTargetNamespace(),
base.getName() + "_" + anonymous.getName());
}
}
}
}