Ejemplo n.º 1
0
 @Override
 public void writeEndDocument() throws XMLStreamException {
   super.writeEndDocument();
   try {
     if (getScope().getInfo().isArray()) {
       target.endArray();
     }
     target.endObject();
   } catch (IOException e) {
     throw new XMLStreamException("Cannot end document", e);
   }
   getScope().getInfo().startObjectWritten = false;
 }
Ejemplo n.º 2
0
 @Override
 protected void writeEndElementTag() throws XMLStreamException {
   try {
     if (getScope().getInfo().hasData()) {
       if (getScope().getInfo().startObjectWritten) {
         target.name("$");
       }
       target.value(getScope().getInfo().getData());
     }
     if (autoEndArray && getScope().getInfo().isArray()) {
       writeEndArray();
     }
     if (getScope().getInfo().startObjectWritten) {
       target.endObject();
     } else if (!getScope().getInfo().hasData()) {
       target.value(null);
     }
   } catch (IOException e) {
     throw new XMLStreamException(
         "Cannot write end element: "
             + getFieldName(getScope().getPrefix(), getScope().getLocalName()),
         e);
   }
 }