Schemaの簡単な例、Schhema validate xml doc
2100 ワード
ツール:XML spyの方が使いやすいと思われていますが、商業版です。
EditiX:Free Edition for non commerical useage、無料版は非商業用です。
ウェブサイトをダウンロード:
http://free.editix.com/ しかし、壁によっては
華軍ソフトウェアパーク:
http://www.newhua.com/soft/56597.htm
私の最新のダウンロードバージョン:
Version:2010[Build 020110]
Company:http://www.japisoft.com
本人が使用した特性:schema validate xml、pretty format for xml document。
schema:
ローカルファイルなら、直接パスを書けばいいです。 note.xsd
編集後、このxmlがschemaの定義に合っているかどうかを確認することができます。
EditiX:Free Edition for non commerical useage、無料版は非商業用です。
ウェブサイトをダウンロード:
http://free.editix.com/ しかし、壁によっては
華軍ソフトウェアパーク:
http://www.newhua.com/soft/56597.htm
私の最新のダウンロードバージョン:
Version:2010[Build 020110]
Company:http://www.japisoft.com
本人が使用した特性:schema validate xml、pretty format for xml document。
schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://192.168.10.254:9999/schemaExample/1.0.0" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://192.168.10.254:9999/schemaExample/1.0.0">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
ターゲットNamespaceは任意です。<?xml version="1.0" encoding="UTF-8"?>
<note xsi:schemaLocation="http://192.168.10.254:9999/schemaExample/1.0.0 http://192.168.10.254:9999/note.xsd"
xmlns="http://192.168.10.254:9999/schemaExample/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<from>Jani</from>
<to> </to>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
xsi:schemaLocationの一番目のパラメータはxmlの名前空間で、二つ目のパラメータは、schemaが格納されている位置です。この時: http://192.168.10.254:9999/note.xsd ローカルファイルなら、直接パスを書けばいいです。 note.xsd
編集後、このxmlがschemaの定義に合っているかどうかを確認することができます。