1,下载xig工具,xml-xig-0.1.1.jar可以到一下链接下载
2.编写schema文件,如下:
<?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://my.soa.com" targetNamespace="http://my.soa.com" elementFormDefault="qualified"> <xs:element name="person" > <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
3.运行命令行:
4.person.xsd.xml文件如下:
<person> <firstname>?{string}</firstname> <lastname>?{string}</lastname> </person>
<xig:template document='person' schema='e:/xmlw?/person.xsd' xmlns:xds='http://xml-xsd.sourceforge.net/schema/XmlXsd-0.1'> <person> <firstname>${xs:string}</firstname> <lastname>${xs:string}</lastname> </person> <xig:generate> <!-- Generate instance documents from template document above --> <loop count='10'> </loop> </xig:generate> </xig:template>
原文地址:http://blog.csdn.net/u013998070/article/details/44921617