XMLElement faultEl,
DescriptionElement desc,
InterfaceElement parent)
throws WSDLException {
InterfaceFaultElement fault = parent.addInterfaceFaultElement();
String name = faultEl.getAttributeValue(Constants.ATTR_NAME);
if(name != null)
{
fault.setName(new NCName(name));
}
String element = faultEl.getAttributeValue(Constants.ATTR_ELEMENT);
if(element != null)
{
if(element.equals(Constants.NMTOKEN_ANY)) {
fault.setElement(QNameTokenUnion.ANY);
} else if(element.equals(Constants.NMTOKEN_NONE)) {
fault.setElement(QNameTokenUnion.NONE);
} else if(element.equals(Constants.NMTOKEN_OTHER)) {
fault.setElement(QNameTokenUnion.OTHER);
} else {
//It is not one of the allowed xs:Token values, so it must be an xs:QName
try {
QName qname = faultEl.getQName(element);
fault.setElement(new QNameTokenUnion(qname));
} catch (WSDLException e) {
getErrorReporter().reportError(
new ErrorLocatorImpl(), //TODO line&col nos.
"WSDL505",
new Object[] {element, faultEl.getQName()},
ErrorReporter.SEVERITY_ERROR);
}
}
}
parseExtensionAttributes(faultEl, InterfaceFaultElement.class, fault, desc);
XMLElement[] children = faultEl.getChildElements();
XMLElement tempEl = null;
QName tempElQN = null;
for(int i=0; i<children.length; i++)
{
tempEl = children[i];
tempElQN = tempEl.getQName();
if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
{
parseDocumentation(tempEl, desc, fault);
}
else
{
fault.addExtensionElement(
parseExtensionElement(InterfaceFaultElement.class, fault, tempEl, desc) );
}
}
return fault;