这是我从服务器获得的 XML 文档:
<?xml version="1.0" encoding="UTF-8"?>
<w:createCustomerResponse xmlns:w="{ some namespace :) }">
<w:usernameTaken />
</w:createCustomerResponse>
这就是我的做法:
InputStream inputter = connection.getInputStream();
SAXBuilder builder = new SAXBuilder();
Document docu = new Document();
try
{
docu = builder.build(inputter);
}
catch (JDOMException e)
{
e.printStackTrace();
}
outputter.output(docu, System.out);
所以我在docu中有一个xml文档,但我不知道如何获取值元素“usernameTaken”