Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top