例如,我们有以下 xml 文件(简明扼要):
<doc>some text <deprecated> some more text <ref> even more text</ref></deprecated>
我可以访问 deprecated 和 ref 的信息,但不幸的是,我似乎无法获得文档的值,即“某些文本”。
您会期望 root.doc 会返回该值,但它不会返回:
<asdf_classes.documentation object at 0x7fb6ba3f2780>
但是,root.doc.deprecated 返回一个值,root.doc.ref 也一样。
查看从 PyXB 生成的文件,.doc 似乎是一个名为“documentation”的类,其中包含 ref 并已弃用。那么如果生成的类没有,我如何访问 doc 的值呢?