qName = new QName(schemaName);
}
}
property.setSchemaName(qName);
//create properties for any predicates
XPathFragment fragment = tempField.getXPathFragment();
String currentPath = "";
while(fragment != null && !(fragment.nameIsText()) && !(fragment.isAttribute())) {
if(fragment.getPredicate() != null) {
//can't append xpath directly since it will contain the predicate
String fragmentPath = fragment.getLocalName();
if(fragment.getPrefix() != null && !(Constants.EMPTY_STRING.equals(fragment.getPrefix()))) {
fragmentPath = fragment.getPrefix() + ":" + fragmentPath;
}
currentPath += fragmentPath;
String predicatePath = currentPath;
TypeInfo targetInfo = info;
if(fragment.getNextFragment() == null) {
//if this is the last fragment, and there's no text after, then this is
//complex. May need to add the attribute property to the target type.
TypeInfo predicateTypeInfo = typeInfo.get(ptype.getQualifiedName());
if(predicateTypeInfo == null && shouldGenerateTypeInfo(ptype)) {
buildNewTypeInfo(new JavaClass[]{ptype});
predicateTypeInfo = typeInfo.get(ptype.getQualifiedName());
}
if(predicateTypeInfo != null) {
targetInfo = predicateTypeInfo;
predicatePath = "";
}
}
Property predicateProperty = new Property(helper);
predicateProperty.setType(helper.getJavaClass("java.lang.String"));
if(predicatePath.length() > 0) {
predicatePath += "/";
}
predicatePath += fragment.getPredicate().getXPathFragment().getXPath();
predicateProperty.setXmlPath(predicatePath);
predicateProperty.setIsAttribute(true);
String predschemaName = XMLProcessor.getNameFromXPath(predicatePath, property.getPropertyName(), true);
QName predQname;
if (nsInfo.isAttributeFormQualified()) {
predQname = new QName(nsInfo.getNamespace(), predschemaName);
} else {
predQname = new QName(predschemaName);
}
predicateProperty.setSchemaName(predQname);
if(!targetInfo.hasPredicateProperty(predicateProperty)) {
targetInfo.getPredicateProperties().add(predicateProperty);
}
} else {
currentPath += fragment.getXPath();
}
currentPath += "/";
fragment = fragment.getNextFragment();
}
} else {
property.setSchemaName(getQNameForProperty(property, propertyName, javaHasAnnotations, getPackageInfoForPackage(cls).getNamespaceInfo(), info));
}