0
如何在java中解析XML。 我有如下一個XML:用JAVA解析XML,從一個Schema轉換爲其他
<?xml version="1.0" ?>
<metabase>
<response status="SUCCESS"/>
<item>
<id>10147417040</id>
<description>
<title>What part of the constitiution states the goals?</title>
<language>English</language>
</description>
<pubDate>2012-03-27 07:25:33.0</pubDate>
</item>
<item>
<id>10147417018</id>
<description>
<title>What is the work envelope of a robot car?</title>
<language>English</language>
</description>
<pubDate>2012-03-27 07:25:33.0</pubDate>
</item>
</metabase>
我要分析此XML並將其轉換爲表格:
<?xml version="1.0" ?>
<add>
<doc>
<field name="id">10147417040</field>
<field name="title">What part of the constitiution states the goals?</field>
<field name="language">English</field>
<field name="pubDate">2012-03-27 07:25:33.0</field>
</doc>
<doc>
<field name="id">10147417018</field>
<field name="title">What is the work envelope of a robot car?</field>
<field name="language">English</field>
<field name="pubDate">2012-03-27 07:25:33.0</field>
</doc>
</add>
請給一些Java代碼示例做這個任務。
感謝 Shariq