scala xml系列化
来源:互联网 发布:安全生产网络知识竞赛 编辑:程序博客网 时间:2024/05/14 15:50
scala 从内部数据结构到xml的转化,目前要用的只有xml字面量和转义符
例如:
/** * xml 序列化 */abstract class CCTherm { val description: String val yearMade: Int val dateObtained: String val bookPrice: Int val purchasePrice: Int val condition: Int override def toString = description def toXML = <cctherm> <description>{description}</description> <yearMade>{yearMade}</yearMade> <dateObtained>{dateObtained}</dateObtained> <bookPrice>{bookPrice}</bookPrice> <purchasePrice>{purchasePrice}</purchasePrice> <condition>{condition}</condition> </cctherm>}object xmlTest { def main(args: Array[String]): Unit = { val therm = new CCTherm { val description = "hot dog #5" val yearMade = 1952 val dateObtained = "March 14,2014" val bookPrice = 2199 val purchasePrice = 500 val condition = 9 } println(therm.toXML) }}
运行的结果
<cctherm> <description>hot dog #5</description> <yearMade>1952</yearMade> <dateObtained>March 14,2014</dateObtained> <bookPrice>2199</bookPrice> <purchasePrice>500</purchasePrice> <condition>9</condition> </cctherm>
0 0
- scala xml系列化
- XML---对象系列化与反系列化
- xml的系列化和解析
- C#实现XML系列化和反系列化的总结
- 系列化
- Android中XML文件解析、系列化及JSON解析
- scala xml
- Java系列化
- Scala And XML
- scala实现xml配置
- Scala的XML操作
- scala 简要: xml处理
- scala xml操作
- Scala 使用XML
- scala解析xml
- Scala XML解析库
- Scala XML处理
- scala xml操作
- python - 动态加载模块和类
- CSU 1612: Destroy Tunnels 强连通分量 Kosaraju算法
- imageNamed 与 imageWithContentsOfFile的区别
- python–ntohll和htonll的实现(转载)
- Cocos2d-x 3.6 vs2012 更新设置
- scala xml系列化
- SQLServer---查询过程中的数据类型转化
- fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- 188 Best Time to Buy and Sell Stock IV
- iOS中将汉字转换成拼音
- Solr5 快速开始
- sgu214:Weird Dissimilarity(DP)
- 2440+zc301摄像头 无线网络视频监控系统
- hadoop文件系统错误could only be replicated to 0 nodes, instead of 1解决方法