<xs:attribute> with ref attribute nested in <xs:attribteGroup> does't work problem

Discussion in 'XML' started by Aray, Dec 19, 2006.

  1. Aray

    Aray Guest

    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"
    ></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
    <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

    --
     
    Aray, Dec 19, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    341
  2. Replies:
    22
    Views:
    762
    peter koch
    Apr 30, 2008
  3. Replies:
    6
    Views:
    352
    James Kanze
    Apr 29, 2008
  4. Navindra Umanee

    strong ref from weak ref?

    Navindra Umanee, Feb 12, 2005, in forum: Ruby
    Replies:
    2
    Views:
    145
    Navindra Umanee
    Feb 12, 2005
  5. Juha Nieminen
    Replies:
    13
    Views:
    620
    Edek Pienkowski
    Aug 29, 2012
Loading...

Share This Page