- protected void writeAttr(JsonGenerator g, Content content, String attr) {
- writeAttr(g, content, NamespaceUtils.parsePrefixedName(attr));
- }
-
- protected void writeAttr(JsonGenerator g, Content content, QNamed attr) {
- writeAttr(g, content, attr.qName());
- }
-
- protected void writeAttr(JsonGenerator g, Content content, QName attr) {
- // String value = content.attr(attr);
- Object value = content.get(attr);
- if (value != null) {
- // TODO specify NamespaceContext
- String key = NamespaceUtils.toPrefixedName(attr);
- if (value instanceof Double v)
- g.write(key, v);
- else if (value instanceof Long v)
- g.write(key, v);
- else if (value instanceof Integer v)
- g.write(key, v);
- else if (value instanceof Boolean v)
- g.write(key, v);
- else
- g.write(key, value.toString());
- }
- }
-