xsd - Tridion 'Complex Schema' 升级问题与 'xlink:' 和属性 'ref'

标签 xsd tridion xlink

我们正在升级当前用于将内容从第 3 方系统导入 Tridion 的应用程序。当前的 CMS 是 Tridion 2009,新实例将是 Tridion 2011 SP1 HR1。

我们遇到的挑战是我们无法验证复杂架构。我在下面包含了一个工作示例(在 2009 年工作),这在 SDL Tridion 2009 中进行了验证。但是,当我尝试在 Tridion 2011 中通过 CME 创建相同的模式时,当我选择“验证”时出现错误指示那个

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

我花了一些时间阅读(这是一个传下来的复杂模式,其中有相当多的内容已经被压在上面了!)并且相信吗?我们不能只坚持一个名称和类型(或以某种方式在本地定义这个“全局”参数——如果我们可以的话——这不是“不太好”的做法吗?我相信这可以通过更新 XML(来自 xml problem with <attribute ref="...">)来解决,但这是我们无法修改的。

任何评论/指针都会很棒! 谢谢

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

更新: 为了能够继续,我们对 xsd 架构进行了更改:

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

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

这实际上来自 2011 版本的 cm_lnk.xsd。 ref 实际上应该是对 xlink:href 属性的引用,因此这可能仍然是不正确的 - 任何人都知道我们可能测试/观察的此更改的任何陷阱吗?

更新(来自 CS) CS 表示他们将与 R&D 一起调查这个问题,并且似乎已经同意它在 2009 年是一个有效的模式,现在它在 2011 年无效。票已经关闭,但跟进这件事并看看是否在2013 年还是被接受为不同的方法?

最佳答案

使用

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

代替

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

非常好,因为无论如何您都打算引用 cm_lnk.xsd,这只是意味着如果 cm_lnk.xsd 发生变化,您也应该进行更改您的架构相应。但这只是理论上的,因为 cm_lnk.xsd 模式永远不会改变它的定义。

更有趣的是你提到这在 2009 版本中确实有效,这表明 2011 版本似乎无法处理你的导入

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

因此,正如 Dominic 已经提到的,我确实会为此提出 CS 票,以便对其进行查看。您的解决方法是完全有效的,但最好报告缺陷以便在未来的版本中修复它们。

关于xsd - Tridion 'Complex Schema' 升级问题与 'xlink:' 和属性 'ref',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13568916/

相关文章:

xml - W3C 的 XML 模式语言 (XSD) 是否可以允许一系列元素按任意顺序排列,但仍然限制出现次数?

tridion - 在 tridion 发布时将外部多媒体文件推送到打包中

python - 我应该如何在 python 中使用 lxml 处理 XLink 引用?

css - 如何删除 xlink 默认样式

xsd - XSD 序列中的唯一元素

java - JAXB 多个 xsd

tridion - 如何在创建期间使用 Tridion 2011 SP1 中的核心服务向页面添加组件演示文稿

tridion - OnPageSetPublishedToPost 和 Tridion 2011

java - jaxb:xsd 到 java,可以具有其他两个元素之一的父元素