* Extract the element declarations from the given schema.
*/
private void buildElementDeclarations(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
XmlSchemaObjectTable elementTable = schemaDef.getElements();
NamespacePrefixList prefixes = schemaDef.getNamespaceContext();
Iterator qnames = elementTable.getNames();
while (qnames.hasNext()) {
QName xseQN = (QName) qnames.next();
if(fDesc.getElementDeclaration(xseQN) != null) {
//The Description already contains this Element Declaration.
continue;
//This check is necessary because the XmlSchema.equals method, which gets used
//to evaluate fSchemas.contains(..), cannot detect the equivalence of a schema
//that is xs:imported within <wsdl:types> and also xs:imported within by
//an inlined schema within the same <wsdl:types> element.
//Error case is result.xsd in the W3C WSDL 2.0 test case SparqlQuerySimplified-1G.
//This check may be necessary anyway, because if the document assertion Schema-1073
//is violated, we don't want the duplicate schema components in the component model.
//TODO check that this behaviour is correct (eliminating duplicates)
}
QName edQN = xseQN;
if(xseQN.getNamespaceURI() == null && schemaTns != null) {
//this is how XmlSchema represents tns for chameleon xs:includes,
//so replace it with the including schema's tns.
edQN = new QName(schemaTns, xseQN.getLocalPart(), xseQN.getPrefix());
}
if(edQN.getPrefix() == "" || edQN.getPrefix() == null) {
//if a prefix has been declared for this NS uri, include it in the qname
String pfx = prefixes.getPrefix(edQN.getNamespaceURI());
if(pfx != null) {
edQN = new QName(edQN.getNamespaceURI(), edQN.getLocalPart(), pfx);
}
}
if(schemaTns == null || schemaTns.equals(edQN.getNamespaceURI())) //TODO test with schema imports, may be incorrect.