Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 19th, 2006, 09:25 AM
Aray
Guest
 
Posts: n/a
Default <xs:attribute> with ref attribute nested in <xs:attribteGroup> does't work problem

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"
Quote:
></test>
-------file nowork.xml end-----------

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
<testdoes not allow attribute 'testAttribute' and no attribute wildcard
matches it.
cvc-elt.5.2.1: The element <testis 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

--



 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles