我有 xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<products xmlns="http://www.myapp.com/shop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.myapp.com/shop shop.xsd">
<category name="yyy">
<subcategory name="yyy1">
<goods name="yyy11">
<model>ferrari</model>
</goods>
</subcategory>
</category>
</products>
我尝试将元素的值<model>
作为
SAXBuilder builder = new SAXBuilder();
File xmlProductFile = new File("shop.xml");
Document document = builder.build(xmlProductFile);
Element rootNode = document.getRootElement();
String category = rootNode.getChild("model").getText();
但我得到空值