}
protected XSElementImpl(XSObject pParent, XsTElement pBaseElement)
throws SAXException {
super(pParent, pBaseElement);
XsQName qName;
if (isReference()) {
qName = pBaseElement.getRef();
} else {
XsNCName myName = pBaseElement.getName();
if (myName == null) {
throw new LocSAXException("Invalid element: Must have either of its 'ref' or 'name' attributes set.",
getLocator());
}
XsESchema schema = pBaseElement.getXsESchema();
XsAnyURI namespace;
String namespacePrefix;
boolean qualified = pBaseElement.isGlobal();
if (!qualified) {
XsFormChoice form = pBaseElement.getForm();
if (form == null) {
form = schema.getElementFormDefault();
}
qualified = XsFormChoice.QUALIFIED.equals(form);
}
if (qualified) {
namespace = schema.getTargetNamespace();
namespacePrefix = schema.getTargetNamespacePrefix();
} else {
namespace = null;
namespacePrefix = null;
}
qName = new XsQName(namespace, myName.toString(), namespacePrefix);
}
name = qName;
xsAnnotation = pBaseElement.getAnnotation();
isGlobal = pBaseElement instanceof XsTTopLevelElement;
}