Step into Kotlin - 22 - Xml
发布时间:2020-12-16 09:01:20 所属栏目:百科 来源:网络整理
导读:目录 Xml 解析 XML 摘要 解析 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 = "Par
目录
摘要
Xml解析 XMLxml <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())
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |