Element root = (Element) doc.createElement("username");
root.setAttribute("xdbns","111:222");
doc.appendChild(root);
你弄反了^_^
<?xml version="1.0" encoding="UTF-8" ?>
这个不好去掉,应该是newDocument()就有了,而newDocument()没有参数,如果一定要去的话就把它读进一个文件里去操作吧
root.setAttribute("xdbns","111:222");
doc.appendChild(root);
你弄反了^_^
<?xml version="1.0" encoding="UTF-8" ?>
这个不好去掉,应该是newDocument()就有了,而newDocument()没有参数,如果一定要去的话就把它读进一个文件里去操作吧
Element title = doc.createElement("username");
title.setAttribute("xdbns","111:222");
root.appendChild(title);
?xml version="1.0" encoding="UTF-8" ?> ??
在1.4下成功,不过1.5不知是不是xml解析器换了,toString方法无用