Map schemas = validator.getWSDLDocument().getSchemas();
// Going through the schemas
Iterator it = schemas.values().iterator();
while (it.hasNext())
{
XSModel xsModel = (XSModel) it.next();
XSTypeDefinition xsType = null;
// Getting the corresponding part type
if (type == XSConstants.ELEMENT_DECLARATION)
{
// Getting schema element
XSElementDeclaration elem = xsModel.getElementDeclaration(
ref.getLocalPart(), ref.getNamespaceURI());
if (elem != null)
{
// Getting element's type
xsType = elem.getTypeDefinition();
// If it is ref:swaRef
if (WSIConstants.NS_URI_SWA_REF.equals(xsType.getName())
&& WSIConstants.SCHEMA_TYPE_SWA_REF.equals(
xsType.getNamespace()))
{
// Adding the name of the element to the list
swaRefs.add(
new QName(elem.getNamespace(), elem.getName()));
}
}
}
else
{
xsType = xsModel.getTypeDefinition(
ref.getLocalPart(), ref.getNamespaceURI());
}
// Collecting all the element names,adding element names to the list
swaRefs.addAll(collectSwaRefs(xsType));
}