* @return the targetNamespace of the parent schema of the wrapped structure.
*/
public String getTargetNamespace() {
String result = null;
Schema schema = null;
Form form = null;
switch (_annotated.getStructureType()) {
case Structure.ATTRIBUTE:
AttributeDecl attribute = (AttributeDecl) _annotated;
//-- resolve reference
if (attribute.isReference()) {
attribute = attribute.getReference();
}
schema = attribute.getSchema();
//-- top-level (use targetNamespace of schema)
if (attribute.getParent() == schema) {
break;
}
//-- check form (qualified or unqualified)
form = attribute.getForm();
if (form == null) {
form = schema.getAttributeFormDefault();
}
if ((form == null) || form.isUnqualified()) {
//-- no targetNamespace by default
return null;
}
//-- use targetNamespace of schema
break;
case Structure.ELEMENT:
//--resolve reference?
ElementDecl element = (ElementDecl) _annotated;
if (element.isReference()) {
element = element.getReference();
}
schema = element.getSchema();
//-- top-level (use targetNamespace of schema)
if (element.getParent() == schema) {
break;
}
//-- check form (qualified or unqualified)
form = element.getForm();
if (form == null) {
form = schema.getElementFormDefault();
}
//-- no targetNamespace by default
if ((form == null) || form.isUnqualified()) {
return null;
}
//-- use targetNamespace of schema
break;
case Structure.COMPLEX_TYPE: