* @return <code>true</code> if a reference is written;
* <code>false</code> if a new identifier is written.
*/
public boolean writeReference(Object obj, XMLFormat.OutputElement xml)
throws XMLStreamException {
Index id = (Index) _objectToId.get(obj);
if (id == null) { // New identifier.
id = Index.of(_counter++);
_objectToId.put(obj, id);
_tmp.clear().append(id.intValue());
if (_idURI == null) {
xml.getStreamWriter().writeAttribute(_idName, _tmp);
} else {
xml.getStreamWriter().writeAttribute(_idURI, _idName, _tmp);
}
return false;
}
_tmp.clear().append(id.intValue());
if (_refURI == null) {
xml._writer.writeAttribute(_refName, _tmp);
} else {
xml._writer.writeAttribute(_refURI, _refName, _tmp);
}