I'm looking for a tool that will play nicely with Python. Except for my Python requirement, my question is the same as this one:
我正在寻找一种能与Python很好地配合使用的工具。除了我的Python要求,我的问题与此问题相同:
"I am looking for a tool which will take an XML instance document and output a corresponding XSD schema."
“我正在寻找一种工具,它将采用XML实例文档并输出相应的XSD架构。”
3 个解决方案
#1
1
Currently, there is no module that will run within your python program and do this conversion. But I see the problem of creating a XSD schema from XML as a tooling problem. It's the kind of functionality that I'll use once, to get a schema started but after that I'll be maintaining the schema myself. From reading a single XML file the XSD generator will create a starting point for a real schema, it cannot infer all the functionality and options offered by XSD. Basically, I don't see the need to have this conversion run as a module inside of my code, generating new XSDs every time the XML changes. After all, it's the schema that defines the XML not the other way around.
目前,没有模块可以在你的python程序中运行并进行这种转换。但我发现从XML创建XSD架构作为工具问题的问题。这是我将使用一次的功能,以获得一个架构,但之后我将自己维护架构。通过读取单个XML文件,XSD生成器将为真实模式创建起点,它无法推断XSD提供的所有功能和选项。基本上,我认为不需要将此转换作为我的代码中的模块运行,每次XML更改时都会生成新的XSD。毕竟,它是定义XML而不是相反的模式。
As end-user pointed out you could use xsd.exe but you might also want to look at other tools such as trang (a bit old) for Java and stylusstudio (XML tool).
最终用户指出你可以使用xsd.exe,但你可能还想看看其他工具,例如Java和stylusstudio(XML工具)的trang(有点旧)。
#2
2
Are you looking for something like pyxsd? (primarily used for validation against a schema) Or maybe PyXB? (can generate classes based on xml) Otherwise, I don't think there's a tool [yet] that will generate the schema from within Python. Can you do it on demand using something like xsd.exe? Does it have to be programmatic/repeatable?
你在寻找像pyxsd这样的东西吗? (主要用于对模式进行验证)或者PyXB? (可以基于xml生成类)否则,我认为还没有一个工具可以从Python中生成模式。你能用xsd.exe之类的东西按需进行吗?它必须是程序化/可重复的吗?
#3
0
According to the PyCharm docs, PyCharm has a facility for this. This is not exactly accessible by a program as an API. You are probably better off using XML Schema Learner as a separate program since it is a command line program (subprocess friendly!).
根据PyCharm文档,PyCharm有一个设施。作为API,程序无法完全访问它。您最好将XML Schema Learner用作单独的程序,因为它是一个命令行程序(子进程友好!)。
#1
1
Currently, there is no module that will run within your python program and do this conversion. But I see the problem of creating a XSD schema from XML as a tooling problem. It's the kind of functionality that I'll use once, to get a schema started but after that I'll be maintaining the schema myself. From reading a single XML file the XSD generator will create a starting point for a real schema, it cannot infer all the functionality and options offered by XSD. Basically, I don't see the need to have this conversion run as a module inside of my code, generating new XSDs every time the XML changes. After all, it's the schema that defines the XML not the other way around.
目前,没有模块可以在你的python程序中运行并进行这种转换。但我发现从XML创建XSD架构作为工具问题的问题。这是我将使用一次的功能,以获得一个架构,但之后我将自己维护架构。通过读取单个XML文件,XSD生成器将为真实模式创建起点,它无法推断XSD提供的所有功能和选项。基本上,我认为不需要将此转换作为我的代码中的模块运行,每次XML更改时都会生成新的XSD。毕竟,它是定义XML而不是相反的模式。
As end-user pointed out you could use xsd.exe but you might also want to look at other tools such as trang (a bit old) for Java and stylusstudio (XML tool).
最终用户指出你可以使用xsd.exe,但你可能还想看看其他工具,例如Java和stylusstudio(XML工具)的trang(有点旧)。
#2
2
Are you looking for something like pyxsd? (primarily used for validation against a schema) Or maybe PyXB? (can generate classes based on xml) Otherwise, I don't think there's a tool [yet] that will generate the schema from within Python. Can you do it on demand using something like xsd.exe? Does it have to be programmatic/repeatable?
你在寻找像pyxsd这样的东西吗? (主要用于对模式进行验证)或者PyXB? (可以基于xml生成类)否则,我认为还没有一个工具可以从Python中生成模式。你能用xsd.exe之类的东西按需进行吗?它必须是程序化/可重复的吗?
#3
0
According to the PyCharm docs, PyCharm has a facility for this. This is not exactly accessible by a program as an API. You are probably better off using XML Schema Learner as a separate program since it is a command line program (subprocess friendly!).
根据PyCharm文档,PyCharm有一个设施。作为API,程序无法完全访问它。您最好将XML Schema Learner用作单独的程序,因为它是一个命令行程序(子进程友好!)。