A
Aray
Let us see the test file following:
-------file nowork.xsd begin-----------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.bonc.com.cn" targetNamespace="http://www.bonc.com.cn"
elementFormDefault="qualified">
<xs:attribute name="testAttribute" type="xs:string"/>
<xs:attributeGroup name="testAttributeGroup">
<xs:attribute ref="testAttribute"/>
</xs:attributeGroup>
<xs:complexType name="testType">
<xs:attributeGroup ref="testAttributeGroup"/>
</xs:complexType>
<xs:element name="test" type="testType"/>
</xs:schema>
-------file nowork.xsd end-----------
-------file nowork.xml end-----------
<?xml version="1.0" encoding="UTF-8"?>
<test
xmlns="http://www.bonc.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bonc.com.cn nowork.xsd"
testAttribute="a"
I validate the nowork.xml with xmlSpy 2007. the following error countered:
------------error message begin----------------
File F:\work\temp\xmlStudy\form\nowork.xml is not valid.
Attribute 'testAttribute' is not allowed in element <test>
Error location: test / @testAttribute
Details
cvc-complex-type.3.2.1: Complex type definition 'testType' of element
<test> does not allow attribute 'testAttribute' and no attribute wildcard
matches it.
cvc-elt.5.2.1: The element <test> is not valid with respect to the actual
type definition 'testType'.
------------error message end----------------
What I expect is, The nowork.xml is a valid xml file. But it doesn't.
I am newbie to xml and schema. I have just fished to read the XML Schema
Tutorial on http://www.w3schools.com/schema/default.asp. Did I miss
something?
Any help will be preciouse
--
-------file nowork.xsd begin-----------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.bonc.com.cn" targetNamespace="http://www.bonc.com.cn"
elementFormDefault="qualified">
<xs:attribute name="testAttribute" type="xs:string"/>
<xs:attributeGroup name="testAttributeGroup">
<xs:attribute ref="testAttribute"/>
</xs:attributeGroup>
<xs:complexType name="testType">
<xs:attributeGroup ref="testAttributeGroup"/>
</xs:complexType>
<xs:element name="test" type="testType"/>
</xs:schema>
-------file nowork.xsd end-----------
-------file nowork.xml end-----------
<?xml version="1.0" encoding="UTF-8"?>
<test
xmlns="http://www.bonc.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bonc.com.cn nowork.xsd"
testAttribute="a"
-------file nowork.xml end-----------</test>
I validate the nowork.xml with xmlSpy 2007. the following error countered:
------------error message begin----------------
File F:\work\temp\xmlStudy\form\nowork.xml is not valid.
Attribute 'testAttribute' is not allowed in element <test>
Error location: test / @testAttribute
Details
cvc-complex-type.3.2.1: Complex type definition 'testType' of element
<test> does not allow attribute 'testAttribute' and no attribute wildcard
matches it.
cvc-elt.5.2.1: The element <test> is not valid with respect to the actual
type definition 'testType'.
------------error message end----------------
What I expect is, The nowork.xml is a valid xml file. But it doesn't.
I am newbie to xml and schema. I have just fished to read the XML Schema
Tutorial on http://www.w3schools.com/schema/default.asp. Did I miss
something?
Any help will be preciouse
--