如何为对象创建xsd

时间:2012-06-25 18:55:12

标签: xsd wsdl xsd.exe

我有一种方法,我需要在发布方法中传递参数值。

facebookclient. publish("me/events", FacebookType.class,Parameter.with("name", "Party"));

我没有将它作为三个参数传递,而是试图将它作为对象传递给对象记录中的这三个参数。

例如:

facebookclient.publish(record);

所以在发布方法中,我可以得到这个

void publish(Record record)
{
String event= record.getEvent();
}

我正在尝试为这些参数创建一个xsd。请指导我如何做到这一点。对于我/事件我可以在xsd中创建一个元素

<element name="events" type="string" />

并在对象中引用它

<element name="Record">
    <complexType>
        <sequence>
            <element ref="fb:events" />
            // how to specify for FacebookType.class,Parameter.with("name", "Party"))?
        </sequence>
    </complexType>
</element>

请指导我,如何在xsd中指定元素FacebookType.class,Parameter.with(“name”,“Party”))?

1 个答案:

答案 0 :(得分:0)

您可以使用schemagen应用程序(http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.wsfep.multiplatform.doc%2Finfo%2Fae%2Fae%2Ftwbs_jaxbjava2schema.html)通过命令行或JAXB类(http://jaxb.java.net/guide/Invoking_schemagen_programatically.html)以编程方式执行此操作...这是假设您已使用相应的注释注释类。