public void writeAttribute(String p, String ns, String local, String value) throws XMLStreamException {
if (convention.isElement(p, ns, local)) {
writeStartElement(p, local, ns);
writeCharacters(value);
writeEndElement();
return;
}
String key = convention.createAttributeKey(p, ns, local);
try {
if (current instanceof JSONArray) {
JSONArray array = ((JSONArray) current);
current = array.get(array.length() - 1);
}
makeCurrentJSONObject();
if (current instanceof JSONObject) {
Object o = ((JSONObject) current).opt(key);
if (o == null) {
((JSONObject) current).put(key, value);
}
}
} catch (JSONException e) {
throw new XMLStreamException(e);
}
}