}
return newXPath;
}
public Field getXPathForField(Property property, NamespaceInfo namespaceInfo, boolean isTextMapping, boolean isAny) {
Field xmlField = null;
String xPath = property.getXmlPath();
if (null != xPath) {
String newXPath = prefixCustomXPath(xPath, property, namespaceInfo);
xmlField = new XMLField(newXPath);
} else {
xPath = "";
if (property.isSetXmlElementWrapper()) {
XmlElementWrapper wrapper = property.getXmlElementWrapper();
String namespace = wrapper.getNamespace();
if (namespace.equals(XMLProcessor.DEFAULT)) {
if (namespaceInfo.isElementFormQualified()) {
namespace = namespaceInfo.getNamespace();
} else {
namespace = "";
}
}
if (namespace.equals("")) {
xPath += (wrapper.getName() + "/");
} else {
String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolverForDescriptor());
xPath += getQualifiedString(prefix, wrapper.getName() + "/");
}
if (isAny || property.isMap()) {
xPath = xPath.substring(0, xPath.length() - 1);
xmlField = new XMLField(xPath);
return xmlField;
}
}
if (property.isAttribute()) {
if (property.isSetXmlPath()) {
xPath += property.getXmlPath();
} else {
QName name = property.getSchemaName();
String namespace = name.getNamespaceURI();
if (namespace.equals("")) {
xPath += (ATT + name.getLocalPart());
} else {
String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolverForDescriptor());
xPath += ATT + getQualifiedString(prefix, name.getLocalPart());
}
}
xmlField = new XMLField(xPath);
} else if (property.isXmlValue()) {
if(isBinaryData(property.getActualType())){
xmlField = new XMLField(".");
}else{
xmlField = new XMLField("text()");
}
} else {
QName elementName = property.getSchemaName();
xmlField = getXPathForElement(xPath, elementName, namespaceInfo, isTextMapping);
}
}
QName schemaType = (QName) userDefinedSchemaTypes.get(property.getActualType().getQualifiedName());
if (property.getSchemaType() != null) {
schemaType = property.getSchemaType();
}
if (schemaType == null) {
String propertyActualTypeRawName = property.getActualType().getRawName();
if(QName.class.getCanonicalName().equals(propertyActualTypeRawName)) {
schemaType = (QName) helper.getXMLToJavaTypeMap().get(propertyActualTypeRawName);
}
}
if(schemaType !=null && !schemaType.equals (Constants.NORMALIZEDSTRING_QNAME)){
xmlField.setSchemaType(schemaType);
}
return xmlField;
}