标签云

微信群

扫码加入我们

WeChat QR Code

I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it.Unfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros and cons are of the XML models in Python.Anyone have experience doing XML processing in Python? Where would you suggest I start? The XML files I'll be building will be fairly simple.


Dive Into Python has a chapter. Can't vouch for how good it would be though.

2019年07月20日04分24秒

Isn't pulldom is a tool for parsing XML, not generating it (which is what the question asks about)?

2019年07月20日04分24秒

To complete your answer, can you add that lxml also support XML schema and XPath, which is not supported by ElementTree?And it's indeed shipped with Python 2.5.

2019年07月20日04分24秒

ElementTree is good until you need to deal with namespaces then it falls apart and it's unusable.

2019年07月20日04分24秒

In Python, there are others ways, such as ElementTree (see Gareth Simpson's reply)

2019年07月20日04分24秒