Dentro de una clase con los atributos privados: pedidoid, estado, fecha y total; y usando el xml parser de oracle version 2 (xmlparserv2.jar) public Node toXML() { XMLDocument doc = new XMLDocument(); Element pedido = doc.createElement("PEDIDO"); doc.appendChild(pedido); Element pedidoid = doc.createElement("PEDIDOID"); pedidoid.appendChild(doc.createTextNode(this.idPedido.toString())); pedido.appendChild(pedidoid); Element fecha = doc.createElement("FECHAPEDIDO"); fecha.appendChild(doc.createTextNode(this.fecha.getFullDateString())); pedido.appendChild(fecha); Element total = doc.createElement("TOTAL"); total.appendChild(doc.createTextNode(this.total.toString())); pedido.appendChild(total); Element estado = doc.createElement("ESTADO"); estado.appendChild(doc.createTextNode(this.estado.toString())); pedido.appendChild(estado); return (Node)doc; }