1
XML我使用這個代碼從Java Bean或使用JAXB
JAXBContext jc = JAXBContext.newInstance(Bookdata.class);
Bookdata bookdata=new Bookdata();
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(bookdata, (OutputStream) output);
但它生成XML創建XSD但我需要XSD 我需要這樣的創建XSD:
<ArrayOfCommandInfoDTO>
<CommandInfoDTO>
<a:allowAddingGameCenterFriends>true</a:allowAddingGameCenterFriends>
<a:enter code here>allowAppInstallation>true</a:allowAppInstallation>
<a:allowAssistant>true</a:allowAssistant>
<a:allowAssistantWhileLocked>true</a:allowAssistantWhileLocked>
<a:allowCamera>true</a:allowCamera>
</CommandInfoDTO>
</ArrayOfCommandInfoDTO>
所以請告訴我如何從Java Beans或XML創建XSD
請參閱http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.wsfep.multiplatform.doc%2Finfo%2Fae%2Fae% 2Ftwbs_jaxbjava2schema.html –
http://stackoverflow.com/questions/5239284/can-any-tool-generate-xsd-from-xml –
@GV,但我需要在Web應用程序中實現此。 – pankaj369