String name = element.getTagName();
String[] atts = null;
Map<String, String> attrMap = element.getAttributes();
if(attrMap != null && attrMap.size() > 0) {
atts = new String[attrMap.size() * 2];
int index = 0;
for (Map.Entry<String, String> entry : attrMap.entrySet()) {
atts[index++] = entry.getKey();
atts[index++] = entry.getValue();
}
}
mWbxmlSerializer.startElement(name, atts);
String contents = element.getContents();
if(contents != null) {
mWbxmlSerializer.characters(contents);
}
if(element.getChildCount() > 0) {
for(PrimitiveElement child : element.getChildren()) {
writeElement(child);
}
}
mWbxmlSerializer.endElement();