目录
解析 xml
Xml
解析 XML
xml
<RSS>
<channel>
<title>Yahoo! Weather - Boulder,CO</title>
<item>
<title>Conditions for Boulder,CO at 2:54 pm MST</title>
<forecast day="Thu" date="10 Nov 2011" low="37" high="58" text="Partly Cloudy" code="29"/>
<forecast day="Fri" date="11 Nov 2011" low="39" high="58" text="Mostly Cloudy" code="28"/>
<forecast day="Sat" date="12 Nov 2011" low="32" high="49" text="Cloudy" code="27"/>
</item>
</channel>
</RSS>
Kotlin
val f = File("coffeetime-kotlin/src/main/resources/weather.xml")
val builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
println(builder.parse(f).toXmlString())