AnsweredAssumed Answered

alfresco cannot recognize xs:attribute in xsd file

Question asked by johnhelen on Jan 7, 2009
Hello all

I have a xsd file like this


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="www.myweb.com"
    xmlns:my="www.myweb.com"
    elementFormDefault="qualified">

<xs:element name="mytype" type="my:MyType"/>

<xs:complexType name="MyType">
        <xs:sequence>
            <xs:element name="id" type="xs:string"/>
            <xs:element name="attributes" minOccurs="1" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="attribute" type="my:AttributeType" minOccurs="1" maxOccurs="unbounded" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
</xs:complexType>

<xs:complexType name="AttributeType">
        <xs:sequence>
            <xs:element name="value" type="xs:string"/>
        </xs:sequence>
        <xs:attribute name="key" type="xs:string"/>
</xs:complexType>

</xs:schema>


From that xsd file, I want to create  xml files like this:


<my:object>
   <my:id>12</my:id>
      <my:attributes>
         <my:attribute my:key="mykey">
         <my:value>myvalue</my:value>
      </my:attribute>
   </my:attributes>
</my:object>


However, when I create a xml file based on this xsd schema, I always get this error when entering field "Key" in the form:

ERROR [alfresco.ajax] Failed to execute method XFormsBean.setXFormsValue: Exception in Transaction.
org.alfresco.error.AlfrescoRuntimeException: Exception in Transaction.
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:378)

Caused by: org.chiba.xml.xforms.exception.XFormsException: model item for path '/my:mytype/my:attributes/my:attribute[position() != last()][1]/@key' does not exist

Then a xml file is created but the value for my:key is always empty

I do not why, please help
many thanks for any help

john

Outcomes