問題描述
我想從一個 RelaxNG Schema 中生成一個對象模型.
I want to generate an object model out of an RelaxNG Schema.
因此我想使用 RNGOM 對象模型/解析器(主要是因為我找不到任何替代方案- 雖然我什至不關(guān)心解析器編寫/生成的語言).現(xiàn)在我從 SVN 查看了 RNGOM 源代碼,我不知道怎么做使用 RNOM,因為沒有任何關(guān)于使用的信息.
Therefore I want to use the RNGOM Object Model/Parser (mainly because I could not find any alternative - although I don't even care about the language the parser is written in/generates). Now that I checked out the RNGOM source from SVN, I don't have ANY idea how to use RNGOM, since there is not any piece of information out there about the usage.
一個有用的提示如何開始使用 RNGOM - 一個鏈接、示例或任何描述,使我不必閱讀理解 RNGOM 的整個源代碼 - 將作為答案授予.更好的是如何使用解析器從 RNG 文件生成對象模型的簡單示例.
A useful hint how to start with RNGOM - a link, example, or any description which saves me from having to read understand the whole source code of RNGOM - will be awarded as an answer. Even better would be a simple example how to use the parser to generate an Object model out of an RNG file.
更多信息:
我想從下面的 RelaxNG Schema 中生成 Java 類:
http://libvirt.org/git/?p=libvirt.git;a=tree;f=docs/schemas;hb=HEAD
I want to generate Java classes out of the following RelaxNG Schema:
http://libvirt.org/git/?p=libvirt.git;a=tree;f=docs/schemas;hb=HEAD
我發(fā)現(xiàn) Glassfish 的人正在使用 rgom 來生成我需要的相同對象模型,但我還不知道他們是如何使用 rgom 的.
I found out that the Glassfish guys are using rngom to generate the same object model I need, but I could not yet find out how they are using rngom.
推薦答案
一種方法可以是:
- 使用 jing 從 Relax NG 轉(zhuǎn)換為 XML Schema(看這里)
- 使用更常用的工具來生成類(例如 JaxB).
這篇關(guān)于使用 RNOM 從 RelaxNG 模式生成對象模型 - 如何開始?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!