Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
前段时间,我在工作中使用 XmlBeans,必须以编程方式从模式创建 xml。那时,我使用 XmlBeans 编译架构,然后使用一些 XmlBeans 功能(我现在不记得它的名字)来创建一个有效的 xml,它具有所有可选和必需的标记和属性。
我把这个问题留在这里,所以也许有人可以帮我回忆一下如何做到这一点......(我还记得使用过 Axis 2,所以我开始认为它可能是 Axis2 的功能?)
非常感谢,如果我记得,我会发布它......
我找到了它,它是以下XmlSampleUtil课程的一部分org.apache.xmlbeans.impl.xsd2inst:
XmlSampleUtil
org.apache.xmlbeans.impl.xsd2inst
// for some xmldocument doc String s = SampleXmlUtil.createSampleForType(doc.schemaType());