public boolean isWhitespaceAware() { return !xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByEmptyNode(); }
public void endElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord) { XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField(); if (!xmlField.getLastXPathFragment().nameIsText()) { return; } Object value = unmarshalRecord.getStringBuffer().toString(); Object collection = unmarshalRecord.getContainerInstance(this); unmarshalRecord.resetStringBuffer(); if (xmlCompositeDirectCollectionMapping.usesSingleNode()) { StringTokenizer stringTokenizer = new StringTokenizer((String) value); while (stringTokenizer.hasMoreTokens()) { addUnmarshalValue(unmarshalRecord, stringTokenizer.nextToken(), collection); } } else { if (value.equals(XMLConstants.EMPTY_STRING)) { if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByEmptyNode() || xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil()) { return; } } addUnmarshalValue(unmarshalRecord, value, collection); } }
elements.addElement(element); } else { if (getNullPolicy() == null) { elements.addElement(null); } else { if (getNullPolicy().getMarshalNullRepresentation() == XMLNullRepresentationType.XSI_NIL) { elements.addElement(XMLRecord.NIL); } else if (getNullPolicy().getMarshalNullRepresentation() == XMLNullRepresentationType.ABSENT_NODE) {
public boolean startElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord, Attributes atts) { XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField(); if (xmlField.getLastXPathFragment().nameIsText()) { String type = atts.getValue(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_TYPE_ATTRIBUTE); if (null != type) { String namespaceURI = null; int colonIndex = type.indexOf(XMLConstants.COLON); if (colonIndex > -1) { String prefix = type.substring(0, colonIndex); namespaceURI = unmarshalRecord.resolveNamespacePrefix(prefix); type = type.substring(colonIndex + 1); } unmarshalRecord.setTypeQName(new QName(namespaceURI, type)); } if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil() && xmlCompositeDirectCollectionMapping.getNullPolicy().valueIsNull(atts)) { getContainerPolicy().addInto(null, unmarshalRecord.getContainerInstance(this), unmarshalRecord.getSession()); } } else if (xmlField.getLastXPathFragment().isAttribute()) { if (!this.xmlCompositeDirectCollectionMapping.usesSingleNode()) { String namespaceURI = xmlField.getLastXPathFragment().getNamespaceURI(); if (namespaceURI == null) { namespaceURI = XMLConstants.EMPTY_STRING; } String value = atts.getValue(namespaceURI, xmlField.getLastXPathFragment().getLocalName()); Object collection = unmarshalRecord.getContainerInstance(this); addUnmarshalValue(unmarshalRecord, value, collection); } } return true; }
elements.addElement(element); } else if(!usesSingleNode()){ AbstractNullPolicy nullPolicy = getNullPolicy(); if (nullPolicy == null) { elements.addElement(null);
elements.addElement(element); } else if(!usesSingleNode()){ AbstractNullPolicy nullPolicy = getNullPolicy(); if (nullPolicy == null) { elements.addElement(null);
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord, Object value, Object collection) { if (null == value) { return; } if (xmlCompositeDirectCollectionMapping.getNullPolicy().isNullRepresentedByXsiNil() && xmlCompositeDirectCollectionMapping.getNullPolicy().valueIsNull(unmarshalRecord.getAttributes())) { return; } if ((!isWhitespaceAware() && XMLConstants.EMPTY_STRING.equals(value))) { return; } XMLField xmlField = (XMLField) xmlCompositeDirectCollectionMapping.getField(); XMLConversionManager xmlConversionManager = (XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager(); if (unmarshalRecord.getTypeQName() != null) { Class typeClass = xmlField.getJavaClass(unmarshalRecord.getTypeQName()); value = xmlConversionManager.convertObject(value, typeClass, unmarshalRecord.getTypeQName()); } else { value = xmlField.convertValueBasedOnSchemaType(value, xmlConversionManager, unmarshalRecord); } if (xmlCompositeDirectCollectionMapping.hasValueConverter()) { if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) { value = ((XMLConverter) xmlCompositeDirectCollectionMapping.getValueConverter()).convertDataValueToObjectValue(value, unmarshalRecord.getSession(), unmarshalRecord.getUnmarshaller()); } else { value = xmlCompositeDirectCollectionMapping.getValueConverter().convertDataValueToObjectValue(value, unmarshalRecord.getSession()); } } unmarshalRecord.addAttributeValue(this, value, collection); }
Object fieldValue = domRecord.getValues(this.getField(), this.getNullPolicy()); if (fieldValue == null) { if (reuseContainer) {
Object fieldValue = domRecord.getValues(this.getField(), this.getNullPolicy()); if (fieldValue == null) { if (reuseContainer) {
Object fieldValue = domRecord.getValues(this.getField(), this.getNullPolicy()); if (fieldValue == null) { if (reuseContainer) {
if (xmlCompositeDirectCollectionMapping.getNullPolicy().getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) { marshalRecord.openStartElement(xPathFragment, namespaceResolver); XPathFragment nextFragment = xPathFragment.getNextFragment(); xmlCompositeDirectCollectionMapping.getNullPolicy().directMarshal(nextFragment, marshalRecord, object, session, namespaceResolver);
if (mapping.getNullPolicy().isNullRepresentedByXsiNil()) { element.setNillable(true);