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

This should cover W3C XML Schema, Relax NG and DTD related problems.
jimithing
Posts: 2
Joined: Thu Mar 24, 2005 9:37 pm

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

Post by jimithing » Thu Mar 24, 2005 9:48 pm

Hey,

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.

-Kyle

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu Mar 24, 2005 11:33 pm

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 http://www.oxygenxml.com/demo/ids/ids.html

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,
George

jimithing
Posts: 2
Joined: Thu Mar 24, 2005 9:37 pm

Post by jimithing » Fri Mar 25, 2005 8:33 pm

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


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

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Tue Mar 29, 2005 11:46 am

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 (http://www.oxygenxml.com/demo/ids/ids.html) 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,
George

Post Reply