Skip to content

Commit

Permalink
set xml data element xsi:nil='true' attribute of data is null
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Sep 19, 2008
1 parent 50d8afc commit e915a33
Showing 1 changed file with 19 additions and 10 deletions.
Expand Up @@ -55,17 +55,17 @@ public class XmlPublisherFilter implements IPublisherFilter, INodeGroupExtension
private String xmlTagNameToUseForGroup = "batch";

private List<String> groupByColumnNames;

private String[] nodeGroups;

private boolean loadDataInTargetDatabase = true;

private boolean autoRegister = true;

public boolean isAutoRegister() {
return autoRegister;
}

public String[] getNodeGroupIdsToApplyTo() {
return nodeGroups;
}
Expand Down Expand Up @@ -120,12 +120,15 @@ private StringBuilder getXmlFromCache(IDataLoaderContext ctx, String[] data, Str
}
return xml;
}

/**
* Give the opportunity for the user of this publisher to add in additional attributes.
* The default implementation adds in the nodeId from the {@link IDataLoaderContext}.
* Give the opportunity for the user of this publisher to add in additional
* attributes. The default implementation adds in the nodeId from the
* {@link IDataLoaderContext}.
*
* @param ctx
* @param xml append XML attributes to this buffer
* @param xml
* append XML attributes to this buffer
*/
protected void addFormattedExtraGroupAttributes(IDataLoaderContext ctx, StringBuilder xml) {
xml.append("nodeid='");
Expand Down Expand Up @@ -173,9 +176,15 @@ private void toXmlElement(DataEventType dml, StringBuilder xml, IDataLoaderConte
String col = colNames[i];
xml.append("<data key='");
xml.append(col);
xml.append("'>");
xml.append(data[i]);
xml.append("</data>");
xml.append("'");

if (data[i] == null) {
xml.append(" xsi:nil='true'/>");
} else {
xml.append(">");
xml.append(data[i]);
xml.append("</data>");
}
}
xml.append("</row>");
}
Expand Down

0 comments on commit e915a33

Please sign in to comment.