public final String getMessage() {
JAXBContext jaxbContext;
StringWriter sw = new StringWriter();
try {
jaxbContext = JAXBContext.newInstance(Login.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty("jaxb.encoding", "ISO-8859-1");
jaxbMarshaller.marshal(this, sw);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sw.toString();
}
Đây là mã tôi đang sử dụng..và tôi nhận được kết quả như sau.Xóa standalone = "yes" khỏi jaxb được tạo xml
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
Ở đây tôi muốn loại bỏ độc = "yes" và muốn đầu ra như
<?xml version="1.0" encoding="ISO-8859-1"?>
Tôi đã kiểm tra link JAXB - Remove 'standalone="yes"' from generated XML nhưng câu trả lời ở đây là loại bỏ hoàn toàn
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
phần
Tôi không muốn điều đó ...
Xin hãy giúp tôi ..
Cảm ơn bạn rất nhiều Blaise Doughan.It làm việc !! – vg123