- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我在几个在线示例中看到了以下方法,但没有找到任何关于解析 XML 提要的推荐方法的文档。
方法一:
protected function xmlResponseHandler(event:ResultEvent):void
{
var atom:Namespace = new Namespace("http://www.w3.org/2005/Atom");
var microsoftData:Namespace = new Namespace("http://schemas.microsoft.com/ado/2007/08/dataservices");
var microsoftMetadata:Namespace = new Namespace("http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
var ac:ArrayCollection = new ArrayCollection();
var keyValuePairs:KeyValuePair;
var propertyList:XMLList = (event.result as XML)..atom::entry.atom::content.microsoftMetadata::properties;
for each (var properties:XML in propertyList)
{
keyValuePairs = new KeyValuePair(properties.microsoftData::FieldLocation, properties.microsoftData::Locationid);
ac.addItem(keyValuePairs);
}
cb.dataProvider = ac;
}
方法二:
protected function xmlResponseHandler(event:ResultEvent):void
{
namespace atom = "http://www.w3.org/2005/Atom";
namespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
namespace m = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
use namespace d;
use namespace m;
use namespace atom;
var ac:ArrayCollection = new ArrayCollection();
var keyValuePairs:KeyValuePair;
var propertyList:XMLList = (event.result as XML)..entry.content.properties;
for each (var properties:XML in propertyList)
{
keyValuePairs = new KeyValuePair(properties.FieldLocation, properties.Locationid);
ac.addItem(keyValuePairs);
}
cb.dataProvider = ac;
}
方法三:
protected function xmlResponseHandler(event:ResultEvent):void
{
var ac:ArrayCollection = new ArrayCollection();
var keyValuePairs:KeyValuePair;
var propertyList:XMLList = (event.result as XML)..*::entry.*::content.*::properties;
for each (var properties:XML in propertyList)
{
keyValuePairs = new KeyValuePair(properties.*::FieldLocation, properties.*::Locationid);
ac.addItem(keyValuePairs);
}
cb.dataProvider = ac;
}
示例 XML 提要:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<feed xml:base="http://www.test.com/Test/my.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Test_Locations</title>
<id>http://www.test.com/test/my.svc/Test_Locations</id>
<updated>2010-04-27T20:41:23Z</updated>
<link rel="self" title="Test_Locations" href="Test_Locations" />
<entry>
<id>1</id>
<title type="text"></title>
<updated>2010-04-27T20:41:23Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Test_Locations" href="http://www.test.com/id=1" />
<category term="MySQLModel.Test_Locations" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:FieldLocation>Test Location</d:FieldLocation>
<d:Locationid>test0129</d:Locationid>
</m:properties>
</content>
</entry>
<entry>
<id>2</id>
<title type="text"></title>
<updated>2010-04-27T20:41:23Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Test_Locations" href="http://www.test.com/id=2" />
<category term="MySQLModel.Test_Locations" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:FieldLocation>Yet Another Test Location</d:FieldLocation>
<d:Locationid>test25</d:Locationid>
</m:properties>
</content>
</entry>
</feed>
最佳答案
第三种方法通过忽略 namespace 而完全违背了拥有 namespace 的目的。所以这是一个不。
在前两种方法中,虽然它可能会导致几次额外的击键,但我更喜欢第一种方法,因为它明确说明了每个标识符所指的 namespace 。
我还必须补充一点,第二种方法对我来说是新的 - 还没有遇到过。
关于xml - 使用 ActionScript 3.0 解析具有多个命名空间的 XML 提要的推荐方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2725504/
嗨, 我是 Spark 的新手,我正在尝试使用 ML 推荐。 我的代码 df = sqlContext.createDataFrame( [(0, 0, 4.0), (0, 1, 2.0), (1,
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
平台工程是为软件开发人员创建高效生态系统的过程,帮助他们自主执行软件开发生命周期的端到端操作。平台工程旨在减少开发人员的整体认知负荷并消除流程中的瓶颈,让开发团队的体验更佳。平台工程工具通过改善开发
最近在ubuntu系统中使用自带的firefox浏览器,发现有写问题,比如登陆后,书签,历史记录等,原本在windows下同步的数据无法同步,添加书签的功能也无法使用。 经过查询资料后得知,unb
Remax是蚂蚁开源的一个用React来开发小程序的框架,采用运行时无语法限制的方案。整体研究下来主要分为三大部分:运行时原理、模板渲染原理、编译流程;看了下现有大部分文章主要集中在Reamx的运行
实验室拟态存储的项目需要通过lvs-nat模式通过lvs服务器来区隔内外网的服务,所以安全防护的重心则落在了lvs服务器之上。笔者最终选择通过firewalld放行端口的方式来实现需求,由于fire
如今,随着我们身体各类数据的指数级增长,人们需要接受的信息量越来越大,系统必须处理的难度也是越来越高。而这些正是我们需要通过交互式图表和仪表盘,来实现数据可视化的根本原因。在大幅节省用户的时间和精力
vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点。 vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linux、
1、实现memcpy 将src所指向的内容拷贝到dst所指向的位置,拷贝len个字节。 memcpy是内存拷贝函数 memcpy在使用的时候不用考虑类型,以字节为单位进行拷贝
现在有3台服务器 s1(主),s2(从), s3(从)需要实现文件实时同步,我们可以安装Nfs服务端和客户端来实现! 1、安装 NFS 服务器所需的软件包:
本文基于Free Code Camp基本算法脚本“查找字符串中最长的单词”。 在此算法中,我们要查看每个单词并计算每个单词中有多少个字母。然后,比较计数以确定哪个单词的字符最多,并返回最长单词的长
I/O简介 I/O是Input/output的缩写,在java中,对于数据的输入和输出以流的方式进行。java.io包下提供了各种“流”类和接口,用以获取不同种类的数据,并通过标准的方法输入或输出
目录 docker容器源码部署httpd,用存储卷部署网站 创建一个httpd镜像 部署nfs 挂载 创建容器并映射
python代码如下: import webbrowser as wbimport foliumif __name__ == '__main__': loc = [30.679943, 104.0
近日,微软在 Github 上开源了一个 Python 静态类型检查工具:pyright ,引起了社区内的多方关注。 微软在开源项目上的参与力度是越来越大了,不说收购 Github 这种大的战略野
在编写多线程代码时,经常面临线程安全退出的问题。 一般情况下,选择检查标志位的方式: 在线程的while循环中,执行完例程后,都对标志位进行检查,如果标志位指示继续执行则再次执行例程,如果标志
前言 在程序中我们经常可以看到有很多的加密算法,比如说MD5 sha1等,今天我们就来了解下这下加密算法的吧,在了解之前我们需要知道一个模块嘛就是hashlib,他就是目前Python一个提供字符
java 泛型(generics)是 jdk 5 中引入的一个新特性, 泛型提供了编译时类型安全检测机制,该机制允许程序员在编译时检测到非法的类型。 泛型的本质是参数化类型,也就是说所操作的数据类型
在Python中,当我们有两个字典需要合并的时候,可以使用字典的 update 方法,例如: a = {'a': 1, 'b': 2} b = {'x': 3, 'y': 4}
有的时候我们在获取到目标电脑时候如果对方电脑又python 编译环境时可以利用python 反弹shell 主要用到python os库和sokect库 这里的服务端在目标机上运行
我是一名优秀的程序员,十分优秀!