xml xsdファイルを生成する方法

10117 ワード

ダウンロードJArアドレス:http://download.csdn.net/detail/luoww1/8957991
ダウンロードしたパッケージをd:xmlToxsdに配置
ステップ3 XSDの生成
d:xmlToxsdの下にxmlファイルpersonがあるとします.xml
?
1
2
3
4
5
6
7 xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?>
< person NAME = "ZhangSan" >        < address country = "China" >               < state >beijing state >        address >   
    < Job >IT Job > person >
Windowsコマンドラインを き、 をd:xmlToxsdに

java -jar trang.jar  person.xml  person.xsd
(trang.jarは2つのパラメータを け れ、1つ はソースファイル、2つ はターゲットファイル)
ok!d:の でpersonが されていることがわかります.xsdファイル
  xml  xsd     _ 1
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 xml version = "1.0" encoding = "UTF-8" ?>
< xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema" elementFormDefault = "qualified"     < xs:element name = "person" >           < xs:complexType >              < xs:sequence >                   < xs:element ref = "address" />                   < xs:element ref = "Job" />               xs:sequence >     
         < xs:attribute name = "NAME" use = "required" type = "xs:NCName" />           xs:complexType >
     xs:element
     < xs:element name = "address" >           < xs:complexType >              < xs:sequence >                   < xs:element ref = "state" />                xs:sequence >     
         < xs:attribute name = "country" use = "required" type = "xs:NCName" />           xs:complexType
     xs:element
     < xs:element na style = "color:#000000;" >me=" span >state" type="xs:NCName"/>       < xs:element name = "Job" type = "xs:NCName" /> xs:schema >