<hr>文件头里没有写 xmlns:xsi、xsi:schemaLocation 这两句,IDEA为啥也能校验xsd文件?
<?xml version="1.0" encoding="utf-8" ?> <!--文档类型使用xsd文件进行语义约束--> <!--文档注释--> <hr xmlns="http://www.given.com" > <employee no="3000"> <name>张三</name> <age>18</age> <salary>10000</salary> <department> <dname>会计部</dname> <address>漳州市龙文区</address> </department> </employee> <employee no="3001"> <name>李四</name> <age>19</age> <salary>5000</salary> <department> <dname>研发部</dname> <address>漳州市芗城区</address> </department> </employee> </hr>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.given.com" elementFormDefault="qualified" > <element name="hr"> <complexType> <sequence> <element name="employee" minOccurs="1" maxOccurs="9999"> <complexType> <sequence> <element name="name" type="string"></element> <element name="age"> <simpleType> <restriction base="integer"> <minInclusive value="18"></minInclusive> <maxInclusive value="65"></maxInclusive> </restriction> </simpleType> </element> <element name="salary" type="integer"></element> <element name="department"> <complexType> <sequence> <element name="dname" type="string"></element> <element name="address" type="string"></element> </sequence> </complexType> </element> </sequence> <attribute name="no" type="string" use="required"></attribute> </complexType> </element> </sequence> </complexType> </element> </schema>
17
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星