我想问一些事情。
我找到了像这样的XML。
<row><?TAGS?><?TAG 024?><?END-TAGS?>
<entry colname="COL1">1</entry>
<entry colname="COL2">2</entry>
<entry colname="COL3">3</entry>
</row>
&#13;
您知道如何在<?TAGS?>
内获取所有TAG值吗?
XML括号<??>
的用途是什么?
目前我正在使用JAXB注释,无法获取这些标记。
谢谢:)
答案 0 :(得分:2)
Database.database().reference().child("posts").observeSingleEvent(of: .value, with: { (snapshot) in
for child in snapshot.children.allObjects as! [DataSnapshot] {
if let dictionary = child.value as? [String: AnyObject] {
let artwork = Artwork(title: dictionary["title"] as! String,
locationName: dictionary["location"] as! String,
discipline: dictionary["category"] as! String,
coordinate: CLLocationCoordinate2D(latitude: dictionary["lat"] as! Double, longitude: dictionary["long"] as! Double))
self.mapView.addAnnotation(artwork)
}
}
})
部分为XML processing instructions。
<强>解组:强>
据我所知,仅JAXB不支持处理指令 在解组时。他们只是被忽略了。
然而,根据this question的答案 您可以通过将JAXB与StAX或SAX一起使用来获取它们。
<强>编组:强>
根据this answer 您可以告诉JAXB marshaller插入XML处理指令 在XML输出的开头。像这样:
<?anything?>