//allSameType will throw WFSException if there are types that are not found.
if (allSameType(infos)) {
//all the requested have the same namespace prefix, so return their
//schemas.
FeatureTypeInfo ftInfo = infos[0];
String targetNs = ftInfo.getNamespace().getURI();
//String targetNs = nsInfoType.getXmlns();
tempResponse.append(TARGETNS_PREFIX + targetNs + TARGETNS_SUFFIX);
//namespace
tempResponse.append("\n " + "xmlns:" + ftInfo.getNamespace().getPrefix() + "=\""
+ targetNs + "\"");
//xmlns:" + nsPrefix + "=\"" + targetNs
//+ "\"");
tempResponse.append(GML_NAMESPACE);
tempResponse.append(XS_NAMESPACE);
tempResponse.append(ELEMENT_FORM_DEFAULT + ATTR_FORM_DEFAULT);
//request.getBaseUrl should actually be GeoServer.getSchemaBaseUrl()
//but that method is broken right now. See the note there.
//JD: need a good way to publish resources under a web url, at the
// same time abstracting away the httpness of the service, for
// now replacing the schemas.opengis.net
// tempResponse.append("\n\n<xs:import namespace=" + GML_URL
// + " schemaLocation=\"" + request.getSchemaBaseUrl()
// + "gml/2.1.2/feature.xsd\"/>\n\n");
tempResponse.append("\n\n<xs:import namespace=" + GML_URL + " schemaLocation=\"" +
buildSchemaURL(request.getBaseUrl(), "gml/2.1.2.1/feature.xsd")
+ "\"/>\n\n");
tempResponse.append(generateSpecifiedTypes(infos));
} else {
//the featureTypes do not have all the same prefixes.
tempResponse.append(XS_NAMESPACE);
tempResponse.append(ELEMENT_FORM_DEFAULT + ATTR_FORM_DEFAULT);
Set prefixes = new HashSet();
//iterate through the types, and make a set of their prefixes.
for (int i = 0; i < infos.length; i++) {
FeatureTypeInfo ftInfo = infos[i];
prefixes.add(ftInfo.getNamespace().getPrefix());
}
Iterator prefixIter = prefixes.iterator();
while (prefixIter.hasNext()) {