以下XML模式无法使用以下XML实例文档进行验证.有没有办法重写模式,以便实例文档在给定的约束内验证?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="sample-attribute" type="xs:string" />
<xs:element name="sample-element">
<xs:complexType>
<xs:attribute ref="sample-attribute" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
<?xml version="1.0" encoding="utf-8"?>
<sample-element xmlns="http://tempuri.org/XMLSchema.xsd" sample-attribute="test" />
Run Code Online (Sandbox Code Playgroud)