LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES );
if( this.nullTextIsI18nKey ) {
if( ( this.i18nCatalog != null ) &&
( this.i18nCatalog.trim( ).length( ) > 0 ) ) {
new I18nMessage( this.nullText, this.i18nCatalog ).toSAX( contentHandler );
} else {
new I18nMessage( this.nullText ).toSAX( contentHandler );
}
} else {
contentHandler.characters( this.nullText.toCharArray( ), 0,
this.nullText.length( ) );
}
contentHandler.endElement( FormsConstants.INSTANCE_NS, LABEL_EL,
FormsConstants.INSTANCE_PREFIX_COLON +
LABEL_EL );
}
contentHandler.endElement( FormsConstants.INSTANCE_NS, ITEM_EL,
FormsConstants.INSTANCE_PREFIX_COLON +
ITEM_EL );
}
while(iter.hasNext()) {
String stringValue = "";
Object label = null;
// Get a context on the current item
Pointer ptr = (Pointer)iter.next();
if (ptr.getValue() != null) {
JXPathContext itemCtx = ctx.getRelativeContext(ptr);
// Get the value as a string
Object value = itemCtx.getValue(this.valuePath);
// List may contain null value, and (per contract with convertors),
// convertors are not invoked on nulls.
if (value != null) {
stringValue = this.datatype.convertToString(value, locale);
}
// Get the label (can be ommitted)
if (this.labelPath != null) {
itemCtx.setLenient(true);
label = itemCtx.getValue(this.labelPath);
}
}
// Output this item
AttributesImpl itemAttrs = new AttributesImpl();
itemAttrs.addCDATAAttribute("value", stringValue);
contentHandler.startElement(FormsConstants.INSTANCE_NS, ITEM_EL, FormsConstants.INSTANCE_PREFIX_COLON + ITEM_EL, itemAttrs);
if (label != null) {
contentHandler.startElement(FormsConstants.INSTANCE_NS, LABEL_EL, FormsConstants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
if (label instanceof XMLizable) {
((XMLizable)label).toSAX(contentHandler);
} else if( this.labelIsI18nKey ) {
String stringLabel = label.toString();
if( ( this.i18nCatalog != null ) &&
( this.i18nCatalog.trim( ).length( ) > 0 ) ) {
new I18nMessage( stringLabel, this.i18nCatalog ).toSAX( contentHandler );
} else {
new I18nMessage( stringLabel ).toSAX( contentHandler );
}
} else {
String stringLabel = label.toString();
contentHandler.characters(stringLabel.toCharArray(), 0, stringLabel.length());
}