* @param workingSchema
*/
protected void processXMLDirectMapping(XMLDirectMapping mapping, Sequence seq, ComplexType ct, HashMap<String, Schema> schemaForNamespace, Schema workingSchema, SchemaModelGeneratorProperties properties) {
XMLField xmlField = (XMLField) mapping.getField();
XPathFragment frag = xmlField.getXPathFragment();
if (frag.isSelfFragment()) {
// do nothing;
return;
}
// Handle ID
boolean isPk = isFragPrimaryKey(frag, mapping);
String schemaTypeString = null;
if (isPk) {
schemaTypeString = XMLConstants.SCHEMA_PREFIX + XMLConstants.COLON + ID;
} else {
schemaTypeString = getSchemaTypeForDirectMapping(mapping, workingSchema);
}
// Handle enumerations
Class attributeClassification = mapping.getAttributeClassification();
if (attributeClassification != null && Enum.class.isAssignableFrom(attributeClassification)) {
Converter converter = mapping.getConverter();
if (converter != null && converter instanceof EnumTypeConverter) {
processEnumeration(schemaTypeString, frag, mapping, seq, ct, workingSchema, converter);
return;
}
}
if (frag.isAttribute()) {
Attribute attr = buildAttribute(mapping, schemaTypeString);
if (xmlField.isRequired()) {
attr.setUse(Attribute.REQUIRED);
}
ct.getOrderedAttributes().add(attr);
} else {
seq = buildSchemaComponentsForXPath(frag, seq, schemaForNamespace, workingSchema, properties);
frag = getTargetXPathFragment(frag);
Element elem = elementExistsInSequence(frag.getLocalName(), frag.getShortName(), seq);
if (elem == null) {
if (frag.getNamespaceURI() != null) {
elem = handleFragNamespace(frag, schemaForNamespace, workingSchema, properties, elem, schemaTypeString);
} else {
elem = buildElement(frag, schemaTypeString, Occurs.ZERO, null);
}
if (mapping.getNullPolicy().isNullRepresentedByXsiNil()) {