包类似于XML :: Simple [英] package similar to XML::Simple

查看:89
本文介绍了包类似于XML :: Simple的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有人知道一个Python包,

能够加载XML,如XML :: Simple

Perl包是吗?


对于那些不知道的人,这个包

将XML文件映射到字典。


当然我可以自己建造这样的包装

但如果它已经存在会更好:)


-

Paulo Pinto

Hi,
does anyone know of a Python package that
is able to load XML like the XML::Simple
Perl package does?

For those that don''t know it, this package
maps the XML file to a dictionary.

Of course I can build such a package myself
but it would be better if it already exists :)

--
Paulo Pinto

推荐答案

我正在使用pyRXP,它很棒。

它使用的是一个元组,而不是字典。

非常快。

顺便说一下我刚开始使用这个软件包,任何人都遇见过

pyRXP的问题?


- Pierre

周三,2004-01-28 09:53,Paulo Pinto写道:
I''m using pyRXP, and it''s great.
It''s using one tuple, not dictionnaries.
Very very fast.
By the way I''m just starting using this package, anybody met any
problems with pyRXP?

-- Pierre
On Wed, 2004-01-28 at 09:53, Paulo Pinto wrote:


有没有人知道一个Python包,它能够像XML一样加载XML :: Simple
Perl包对于那些做的人。

我不知道,这个软件包将XML文件映射到字典。

我当然可以自己构建这样的软件包
但如果它已经更好了会更好存在:)

- Paulo Pinto
Hi,
does anyone know of a Python package that
is able to load XML like the XML::Simple
Perl package does?

For those that don''t know it, this package
maps the XML file to a dictionary.

Of course I can build such a package myself
but it would be better if it already exists :)

--
Paulo Pinto



Paulo Pinto
Paulo Pinto
有没有人知道一个Python包能够像XML :: Simple
Perl包一样加载XML吗?
does anyone know of a Python package that
is able to load XML like the XML::Simple
Perl package does?




好问!我知道至少有3个包裹做某事。类似的。


- Fredrik Lundhs elementtree

- D. Merzs gnosis xml实用工具

- handyxml

只为他们谷歌。



Good to ask! I know of at least 3 packages that do sth. similiar.

- Fredrik Lundhs elementtree
- D. Merzs gnosis xml utilities
- handyxml

just google for them.


Paulo Pinto写道:
Paulo Pinto wrote:

有没有人知道一个Python包
能够像XML :: Simple
Perl包一样加载XML吗?

对于那些不知道它的人来说,这个包
映射XML文件到字典。


一般来说,一个简单的字典不足以表示XML,所以也许你在谈论XML的一个子集,也许没有

属性,以及子元素的顺序不是什么?b $ b重要吗?或其他什么?


或者你真的是指一个多重嵌套的

字典,也许还有列表?

我当然可以自己构建这样的软件包
但是如果它已经存在会更好:)

does anyone know of a Python package that
is able to load XML like the XML::Simple
Perl package does?

For those that don''t know it, this package
maps the XML file to a dictionary.
A simple dictionary is insufficient to represent XML in general,
so perhaps you''re talking about a subset of XML, maybe with no
attributes, and where the order of the child elements doesn''t
matter? Or something else?

Or do you really mean something like a multiply-nested
dictionary, perhaps with lists as well?
Of course I can build such a package myself
but it would be better if it already exists :)




我们能够通过剥离来构建类似的东西下来

Fredrik Lundh的元素树,直到我们只有对expat解析器的

调用(即我们使用他的源代码作为教程

使用expat :-),所以如果这就像我上面提到的XML子集

那样,你可以在一小时左右的时间内从头开始

如果你很了解Python。


-Peter



We were able to build something similar by stripping down
Fredrik Lundh''s elementtree until we had little more than the
calls to the expat parser (i.e. we used his source as a tutorial
on using expat :-), so if this is something like the XML-subset
I mention above, you could do it in an hour or so from scratch
if you knew Python well.

-Peter


这篇关于包类似于XML :: Simple的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆