/** Deserializes the object from XML */ public DataReported parseReported(XMLStreamReader in) throws IOException, XMLStreamException { DataReported reported = new DataReported(); ArrayList<DataField> fieldList = new ArrayList<DataField>(); int tag = in.nextTag(); while (tag > 0) { if (_isFinest) debug(in); if (XMLStreamReader.END_ELEMENT == tag) { reported.setFieldList(fieldList); return reported; } if (XMLStreamReader.START_ELEMENT == tag && "field".equals(in.getLocalName())) { fieldList.add(parseField(in)); } else if (XMLStreamReader.START_ELEMENT == tag) { log.finer(this + " <" + in.getLocalName() + "> is an unknown tag"); skipToEnd(in, in.getLocalName()); } tag = in.nextTag(); } skipToEnd(in, "reported"); return reported; }
private void toXml(XmppStreamWriter out, DataReported reported) throws IOException, XMLStreamException { out.writeStartElement("reported"); DataField[] fields = reported.getField(); if (fields != null) { for (int i = 0; i < fields.length; i++) { toXml(out, fields[i]); } } out.writeEndElement(); // </reported> }