Page 1 of 1

<xs:key> and <xs:keyref> support?

Posted: Thu Mar 24, 2005 9:48 pm
by jimithing

I'm using <xs:key> and <xs:keyref> in my schema to link elements together. In my XML file, everything validates ok (ie: I get an error if keys aren't unique or if I reference a nonexistant key), but I thought oXygen was supposed to give me a list with possible values for a key reference, like it does with enumerations. Is this not supported? Did I miss a checkbox somewhere? I tried using the xs:ID and xs:IDREF datatypes before and had the same problem. Validates/errors properly, but no list in the editor.

As an aside, oXygen did provide the list when I was writing the schema. When I wrote the <xs:keyref> tag, it gave me a list of the <xs:key> tags I created.


Posted: Thu Mar 24, 2005 11:33 pm
by george
Hi Kyle,

Oxygen has support for offering the ID values for IDREF fields and also a list of ID values for IDREFS fields. The ID values are collected when the document is validated so you need to run at least one validate action to have the ID values collected. See also

The cotent completion for the XML Schema was enhanced with support for offering dynamic values, computed from the edited document, as you noted on the referred key it presents the already defined keys and there are also many other cases where we do similar things - I think we covered all the possible references inside the document and we also added the built-in schema types where appopriate.

Best Regards,

Posted: Fri Mar 25, 2005 8:33 pm
by jimithing
So you are indeed saying that there's no tag insight support for <xs:key> and <xs:keyref>?

As for ID and IDREF, I couldn't get them to work either. Is the problem that I have IDs spread across multiple locations?

Code: Select all

<referenceElement ref="1" />
<referenceElement ref="4" />
<aKeyElement id="1" />
<aKeyElement id="2" />
<aKeyElement id="3" />
<differentKeyElement id="4" />
<differentKeyElement id="5" />
<differentKeyElement id="6" />

Posted: Tue Mar 29, 2005 11:46 am
by george
Hi Kyle,

I do not see a schema in your sample code. As I said the ID/IDREF support works after the document is validated, that implies a schema. Otherwise oXygen cannot tell that some value is of type ID, IDREF or IDREFS. The demo I pointed you to ( shows how this work on the samples files that come with oXygen and you may give a try to one of those files. The ID/IDREF support is implemented to work with XML Schemas, DTDs and Relax NG Schemas.

Best Regards,