break;
}
}
if ( rpDocXsdElem == null )
{
throw new InvalidWsrfWsdlException(
"Unable to locate the ResourceProperties document element with QName " + rpDocElemName );
}
QName type = getQualifiedAttribute( rpDocXsdElem, "type" );
Element rpDocTypeElem;
if ( type != null )
{
if ( ! type.getNamespaceURI().equals( rpDocXsdElem.getSchemaElement().getAttribute( "targetNamespace" ) ) )
{
throw new InvalidWsrfWsdlException(
"This tool currently does not support referencing a ResourceProperties complexType that is not in the current schema's targetNamespace." );
}
rpDocTypeElem = getComplexTypeByName( rpDocXsdElem.getSchemaElement(), type.getLocalPart() );
}
else
{
rpDocTypeElem =
(Element) rpDocXsdElem.getElement().getElementsByTagNameNS( XmlConstants.NSURI_SCHEMA_XSD,
"complexType" )
.item( 0 );
}
if ( rpDocTypeElem == null )
{
throw new InvalidWsrfWsdlException( "Unable to determine type of the ResourceProperties document element with QName " + rpDocElemName + " - expected either a type atribute or a nested anonymous complexType element." );
}
Element sequenceElem = null;
NodeList sequenceNodes = rpDocTypeElem.getElementsByTagNameNS( XmlConstants.NSURI_SCHEMA_XSD, "sequence" );
if ( sequenceNodes != null )
{
sequenceElem = (Element) sequenceNodes.item( 0 );
}
else
{
sequenceNodes = rpDocTypeElem.getElementsByTagNameNS( XmlConstants.NSURI_SCHEMA_XSD, "all" );
if ( sequenceNodes != null )
{
sequenceElem = (Element) sequenceNodes.item( 0 );
}
}
if ( sequenceElem == null )
{
throw new RuntimeException(
"Resource property element definitions must be contained in an xsd:sequence or an xsd:all element." );
}
NodeList propElems = sequenceElem.getElementsByTagNameNS( XmlConstants.NSURI_SCHEMA_XSD, "element" );
for ( int j = 0; j < propElems.getLength(); j++ )
{
Element propElem = (Element) propElems.item( j );
QName propName = getQualifiedAttribute( new XsdElement( propElem, rpDocXsdElem.getSchemaElement() ), "ref" );
if ( propName == null )
{
throw new InvalidWsrfWsdlException( "All element defs within the resource property document def must have a 'ref' attribute that points at a global element def." );
}
propNames.add( propName );
}
return (QName[]) propNames.toArray( new QName[0] );
}