optional attributes

My “Capability” schema contains an optional “parent_id” attribute of type xs:IDREF

When creating a CapabilityDocument the following is always initialy true
<xapp:if select=“/Capability/@parent_id” condition=“exist”>

unless @parent_id is explicitly removed by

<xapp:elementaction form=“form_create” select=“/Capability/@parent_id” type=“remove”> command


Eventhough /Capability/@parent_id is declared as an optional attribute in my “Capability” schema, it still shows up as an existing attribute in the newly created CapabilityDocument.

This is behaviour that dose not make sense. I would think if you define an attribute to be optional, that would mean that you explicitly haveto add that attribute or element as a matter of fact to the document that you are creating.


As a side note, when running the “Capability” schema through the X-Application generator, it completely ignores attributes at the root node be they optional or required. This only occurs with the root node of the schema. Child nodes containing attributes are picked up by the X-Application generator and included on the jsp pages that are generated.


I have attached the Capability schema to this post.


–joeycz

X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2k
WebContainer : Tomcat 4.1.18
JDK Version : 1.4.1
Capability.tsd (61.9 KB)

Hello,

there is a possibility to chnage this behavior. My colleague Michael sent a post to the topic

optional elements in create.jsp

that explains the necessary steps.

Your note that attributes of root element are ignored by the generator sounds interesting. We will check it. Could you send me the structure.xml file that was generated for your application?

Many thanks.

Bye,
Christian.

Christian,
Thanks for the heads up… i remember reading that post but it completely skipped my mind to make the requiered modifications … =)

reguarding the attributes at the root node,
I have included the structer.xml file that you have requested allong with a slightly modified Capability.tsd schema

–joeycz

X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2k
WebContainer : Tomcat 4.1.18
JDK Version : 1.4.1

structure_xml-Capability_tsd.zip (10.6 KB)