3

We're in the process of upgrading an application that's currently used to import content from a 3rd party system into Tridion. The current CMS is Tridion 2009 and the new instance will be Tridion 2011 SP1 HR1.

The challenge we've come across is that we can't get a Complex Schema to validate. I've included a working example (working in 2009 that is) below and this validates in SDL Tridion 2009. However, when I try to create this same schema through the CME in Tridion 2011 I get an error when I select 'Validate' indicating that

The value for the 'ref' attribute is invalid = 'xlink:href' is an invalid value for the 'ref' attribute.

I've spent some time reading around (this is a hand-me-down complex schema with considerable content already being pressed against it!) and believe? that we can't just stick in a name and type (or define this 'global' parameter locally somehow - and if we could - wouldn't this be 'not so good' practice?. I believe this can be resolved updating the XML (from xml problem with <attribute ref="...">) but this is something we are unable to amend.

Any comments/pointers would be splendid! Thanks

<xs:schema targetNamespace="http://www.ccc.com/tridion/pelements" elementFormDefault="qualified" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI" xmlns="http://www.ccc.com/tridion/pelements" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="cm_lnk.xsd"/>
    <!--maps to DITA element: xref -->
    <xs:element name="link" type="reference"/>
  <xs:complexType name="reference">
    <xs:sequence>
      <xs:element name="title" minOccurs="1" maxOccurs="1" type="xs:string"/>
      <xs:choice>
        <xs:element name="internal">
          <xs:complexType>
            <xs:attribute ref="xlink:href" use="required"/>
            <xs:attribute ref="xlink:title" use="optional"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="external">
          <xs:complexType>
            <xs:attribute name="href" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:choice>
      <xs:element name="text" minOccurs="0" maxOccurs="1" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="type" type="referenceType" use="required"/>
  </xs:complexType>
  <!-- ******************** Enumerations ************************** -->
  <xs:simpleType name="referenceType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="normal"/>
      <xs:enumeration value="binary"/>
      <xs:enumeration value="embedded"/>
      <xs:enumeration value="reusable"/>
      <xs:enumeration value="component"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

UPDATE: To be able to continue, we made a change to the xsd schema:

<xs:attribute ref="xlink:href" use="required"/>
<xs:attribute ref="xlink:title" use="optional"/>

to

<xs:attribute name="href" type="xs:anyURI" use="required"/>
<xs:attribute name="title" type="xs:string" use="optional"/>

This actually comes from the cm_lnk.xsd from the 2011 version. The ref should actually be a reference to the xlink:href attribute, so this might still be incorrect - anyone aware of any pitfalls with this change we might test/watch for?

UPDATE (from CS) CS have stated they will look into this with R&D and appear to have agreed it was a valid schema in 2009 and now it's not valid in 2011. The ticket's been closed but it will be interesting to follow this up and see if this is resolved in 2013 or accepted as a different approach?

Community
  • 1
  • 1
  • 1
    Is the schema location for cm_lnk.xsd correct? – Dominic Cronin Nov 26 '12 at 16:32
  • Hi Dominic, I had tried without the schemaLocation="cm_lnk.xsd" in the Tridion 2009 instance and it still validated - this is Tridion CME side in validating the schema. – Dylan .. Mark Saunders Nov 26 '12 at 16:36
  • In Tridion 2011, the xlink namespace is imported via the 'instance' import. `` If you add this instead of the cm_lnk.xsd import, does it help? – Dominic Cronin Nov 27 '12 at 10:49
  • Afraid not Dominic. I changed xsd: to xs:. I did try with the schemaLocation and with the tag being self-closing for tests if nothing else. Its strange that the change from ref= to name= & type= validates - this is inline with the Tridion XSD so perhaps ref= just isn't supported (at least in the context originator of the Schema intended). Also - could you confirm where you found the update to the xlink namespace import & I can update as part of moving the schema across and also use the same doc/method to ensure we check other items too. Thanks for your response on this question by the way! – Dylan .. Mark Saunders Nov 27 '12 at 16:20
  • 2
    My reading of this is that ref needs to refer to a type that's in scope. So therefore we look for failed imports. As the schemaLocation attribute appears to be irrelevant, we must assume the location is being provided by Tridion in code. Perhaps you should raise a CS ticket asking for the algorithm for locating schemas, or whether there's a means of tracing the location process. Have you tried creating a brand new schema in 2011, and examining how it locates the xlink definitions? That's what I did. – Dominic Cronin Nov 27 '12 at 22:09

1 Answers1

2

Using

<xs:attribute name="href" type="xs:anyURI" use="required"/>
<xs:attribute name="title" type="xs:string" use="optional"/>

instead of

<xs:attribute ref="xlink:href" use="required"/>
<xs:attribute ref="xlink:title" use="optional"/>

Is perfectly fine, as you were intending to refer to the cm_lnk.xsd anyways, it just means that if the cm_lnk.xsd would ever change you should also change your schema accordingly. But this is just in theory, since the cm_lnk.xsd schema will never change its definition.

More interesting is that you mention this did work in the 2009 version, which is indicating that the 2011 release doesn't seem to be able to handle your import

<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="cm_lnk.xsd"/>

So as Dominic already mentioned, I would indeed raise a CS ticket for this so it can be looked at. Your workaround is perfectly valid, but it's always good to report defects allowing them to be fixed in a future release.

Bart Koopman
  • 4,835
  • 17
  • 30
  • Thanks very much Bart (and Dominic). I will report the issue through Tridion Support and we can continue with the solution in place. – Dylan .. Mark Saunders Nov 28 '12 at 10:03
  • Issue reported to CS, response... Thank you for the feedback - since it was a valid schema in 2009 and now it's not valid in 2011, we will contact R&D on this matter to know if something else need to be address in 2011 or 2013 version. – Dylan .. Mark Saunders Dec 04 '12 at 14:18