如何从相应的 xsd'S 获取自己的 xml-editor 的信息?

How to get information for an own xml-editor from corresponding xsd'S?

我想在 java 中编写一个 xml 编辑器,并希望获取 xml 元素的信息,例如可能的子元素,使用相应 xsd。 为了验证,我可以使用这个简单的代码片段,但我认为它不能帮助我获取 xml:

中某个特定元素的信息
 StreamSource[] schemaDocuments = { new StreamSource("layout.xsd") };
        /* created by your application */;
        Source instanceDocument = new StreamSource("BEW.xml");
        /* created by your application */;

        SchemaFactory sf = SchemaFactory.newInstance(
                "http://www.w3.org/2001/XMLSchema");
        Schema s = sf.newSchema(schemaDocuments);

        Validator v = s.newValidator();

        v.validate(instanceDocument);

EMF 项目是一个建模框架和代码生成工具,用于构建基于结构化数据模型的工具和其他应用程序。

https://www.eclipse.org/modeling/emf/

有关示例项目,请参阅 http://blog.xequtor.com/post/2017/06/12/emf-create-ecore-model-from-xsd-file

我看到它非常成功地用于为各种复杂的数据模型生成编辑器,并且我编写了代码来加载 XSDs 并使用 EMF 迭代它们的内容。它对 XSD 标准的实现非常彻底 - 它将加载 xs:includes 和 xs:imports 并将根据 W3C 规范中的规则验证 XSDs。