问题描述
我工作的一个Adobe Flex应用程序,这需要分析一个relativley大的XML文件。 ATM只有35MB,但在一个理想的世界将在未来获得更大。**编辑:我已经在XML文件中没有控制
I am working on an Adobe Flex app, which needs to parse a relativley large XML file. ATM it is only 35MB, but in an ideal world would get much larger in the future.** I have no control over the XML file
我基本上丢弃它的内容的权利成为一个SQLite数据库,所以我可以通过它使用的SimpleXML类变成一个对象,然后重复,但我很担心,这将是一个不错的办法作为文件变大。我是不是偏执,还是有这样做的更好的办法?
I am essentially dropping it's contents right into an SQLITE database, so I could use the SimpleXML class to turn it into an object and then iterate through it, but I am worried that this would be a bad approach as the file gets larger. Am I being paranoid, or is there a better way of doing this?
推荐答案
您肯定会遇到解析XML文件大一些性能问题。返回Flex 2中日子里,我们使用SOAP的服务,并有一个数据呼叫回落大约5K记录和Flash Player会挂起/浏览器去响应约10秒钟,在相当快的机器。我不记得是SOAP消息的大小,但它已经不能超过1-2 MB。
You will definitely run into some performance issues parsing an XML file that large. Back in Flex 2 days we used SOAP for services and had one data call that pulled back about 5K records and the Flash Player would hang / browser go unresponsive for about 10 seconds on a reasonably fast machine. I can't remember the size of that SOAP message but it couldn't have been more than 1-2 MB.
如果有可能为您的后端,以XML转换成一个对象图,它发回了AMF,你会看到更好的性能。 Flash播放器确实很好用大型数据集,只要它们是连接在AMF codeD(压缩二进制格式)。
If it's possible for your backend to transform the XML into an object graph and send it back over AMF you will see much better performance. Flash Player does really well with large datasets provided they're encoded in AMF (condensed binary format).
甚至还是老样子,我真的考虑是否要发送一个结果,大型把它分解成块。至少这样你有更好的缩放路径,可以给用户一些更好的反馈,即显示一个消息,如加工项目6 35 ......
Even stil, I'd really consider whether you want to send a single result that large of break it up into pieces. At least that way you have a path for better scaling and can give the user some better feedback, i.e. displaying a message such as "Processing Item 6 of 35..."
这篇关于解析在Adobe Flex的大型XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!