Я хочу создать документ XML, который выглядит следующим образом, но я не знаю, как:
<bo type="Employee" id="0000012f41bce2a865f8616b0010007c0008008b">
<username>marv</username>
</bo>
это то, что у меня есть, я просто запутался, как добавить элемент username
:
Element bo = testDoc.createElement("bo");
bo.setAttribute("type", "Employee");
bo.setAttribute("id", emp.getId());