default property of an attribute

Hello everyone,

hopefuly someone can correct my possibly flawed thinking.

If I declare an attribute optional, but give it a default value, it seems to me (if I recal correctly from the documentation and logically thinking about it) that if the document instance omits this attribute, Tamino will insert the attribute nevertheless with the default value.

However, this is not what happens. Tamino just doesn’t insert it. It’s as if the default property of the value doesn’t kick in.

It’s pretty important feature for me and IO was wondering if anyone has any comments on this?

Thank you very much,

Peter Endisch

---------------------------------------
I’m a Zen Garden Maintenance Engineer
---------------------------------------

Hello Peter,

I just tried this with Tamino 4.1.4.4, and it worked precisely as you expected.
Which version of Tamino are you using?

Cheers,
Trevor.

Hello Trevor,

thank you fro your answer and thank you for being so active in these forums.

I am running Tamino 4.1.4.4, just as you. My schema is rather complex. My attribute with default property is defined for a complex element.

Would you mind posting to me your schema and doc instance that worked for you? I’d run it on my server and see if it works. If so, then I will investigate and see why it doesn’t work on mine.

I just find it extremely peculiar, I mean this shouldn’t be this complicated!

Thank you very much

Peter Endisch

---------------------------------------
I’m a Zen Garden Maintenance Engineer
---------------------------------------

Hi Peter,

my schema and document were extremely simple!

I’m attaching the schema, but here is the highlight:

   <xs:element name = "optAtt">
      <xs:complexType>
         <xs:attribute name = "myAtt" type = "xs:string" default = "this is the default value"></xs:attribute>
      </xs:complexType>
   </xs:element></pre><BR>I inserted the following document:<BR><pre class="ip-ubbcode-code-pre">   <?xml version="1.0" encoding="UTF-8"?>
   <optAtt>
   </optAtt></pre><BR>Querying the database showed the following result:<BR><pre class="ip-ubbcode-code-pre">   <xql:result>
      <optAtt ino:id="1" myAtt="this is the default value" /> 
   </xql:result>


I hope that helps!
Trevor.
optAtt.TSD (1006 Bytes)