Skip to main content
12-Amethyst
March 6, 2011
Question

Editor handling of required/fixed schema attributes

  • March 6, 2011
  • 1 reply
  • 2595 views

Hello,

I was wondering if anyone here can shed some light on why the default behaviour of AE appears a little strange when creating new XML instances using an schema with fixed/required attributes.

<xs:attribute name="tipo" type="tf:tipoAttribsNotes" fixed="Fred" use="required" />

Problems being:

  • It does not insert them automaticaly when 'insert markup' (like XML Spy or Oxygen!) even though they are the only valid value, and are required for the XML to be valid against the schema.
  • The modify attributes menu lists all possible values of the attribute from the schema, instead of the only valid one you can insert in a particular context.
  • The only apparent work-around (from support) ‘set writeunspecifiedattrs=fixed’ saves a required attributes populated and valid file ok, but does not refresh so you dont see the result until it is reopened!?

Maybe i'm missing something, but any experiences and resolutions are most appreciated.

Regards

Chris

    1 reply

    5-Regular Member
    March 8, 2011

    Hi,

    In Editor, if a default value is specified by the DTD or schema, we don't automatically set it. This helps to keep the document smaller and it's actually how customers have asked us to implement this. The instance is still valid (and any errors would still be found by the Completeness checker). We added the preference you mentioned, for those customers who've needed the attribtues written in for other downstream applications.

    Is your desire for a setting to always write the default value or fixed value into the instance? If so, can you (and anyone else reading this and who desires this feature) please open an enhancement request via www.ptc.com with your suggestion and use case. It will help me to understand and keep track for future relases of Editor.

    Thanks,

    Pushpinder Toor

    12-Amethyst
    March 9, 2011

    Hi Pushpinder,

    Thanks for responding here.

    The default/fixed value behaviour with 'implied' attributes makes sense and thats no problem thanks.

    My issue is when the attribute is 'required' in the schema, (i.e. invalid without it), it is also not being inserted automaticaly AND not being picked up by the Completeness checker.

    A case is now open with support also so i'll hope to follow this up later.

    Regards

    Chris

    12-Amethyst
    March 30, 2011

    FYI: 1 part of this issue is now in motion with SPR 2061084