public class TridentTransformer {
public void process(WsdlDefinitions wsdl){
XmlElement types = wsdl.getTypes();
Iterable<XmlElement> schemas = types.elements(null, "schema");
XmlElement theSchema = null;
LinkedList<XmlElement> removeList = new LinkedList<XmlElement>();
for (XmlElement schema : schemas) {
String tns = schema.attributeValue("targetNamespace");
if(null != tns && -1 != tns.indexOf("http://www.extreme.indiana.edu/xbaya")){
theSchema = schema;
}else{
removeList.add(schema);
}
}
for (XmlElement schema : removeList) {
types.removeChild(schema);
}
types.addChild(XMLUtil.stringToXmlElement(GFacSimpleTypesXSD.XSD));
types.addChild(XMLUtil.stringToXmlElement(LeadCrosscutXSD.XSD));
types.addChild(XMLUtil.stringToXmlElement(LeadContextHeaderXSD.XSD));
XmlElement xml = wsdl.xml();
XMLUtil.removeElements(xml, "partnerLinkType");
XMLUtil.removeElements(xml, "default");
}