CoreDBのリンク データベースの再構築時のエラー


解説

Coreデータベースのリンク データベースを再構築する際に、Attempted to load invalid xml エラーが発生することがあります。この問題は、EXMアイテムのFinal Renderings フィールドにコロン記号(:)が含まれている場合に発生します。ログ ファイルには、次のような例外が出力される可能性があります。

ManagedPoolThread #0 2018:03:07 09:37:00 
ERROR Attempted to load invalid xml.
Exception: System.Xml.XmlException
Message: Data at the root level is invalid. Line 1, position 1.
Source: System.Xml
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at Sitecore.Xml.XmlUtil.LoadXml(String xml)
ManagedPoolThread #0 2018:03:07 09:37:00 ERROR First 200 characters: :
ManagedPoolThread #0 2018:03:07 09:37:00 ERROR Call stack: at Sitecore.MainUtil.GetCallStack()
   at Sitecore.Xml.XmlUtil.LoadXml(String xml)
   at Sitecore.Data.Fields.LayoutField..ctor(Field innerField)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
   at Sitecore.Data.Fields.FieldType.GetField(Field field)
   at Sitecore.Data.Fields.DefaultFieldTypeManager.GetField(Field field, String runtimeValue)
   at Sitecore.Links.ItemLinks.AddLinks(Field field, List`1 links, ItemLinkState linkState)
   at Sitecore.Links.ItemLinks.GetLinks(ItemLinkState linkState, Boolean allVersions, Boolean includeStandardValuesLinks)
   ...

解決策

この問題を解決するには、以下のことをお試しください:

  1. Coreデータベースをバックアップします。
  2. 以下のSQLスクリプトを実行し、影響を受けるFinal Renderingsフィールドを含む項目を調べます:
    SELECT * FROM [coreDbName].[dbo].[VersionedFields] where [FieldId]='{04BF00DB-F5FB-41F7-8AB7-22408372A981}' and [Value]=':'
  3. 以下のスクリプトを実行し、Final Renderingsフィールドを削除します。
    DELETE FROM [coreDbName].[dbo].[VersionedFields] where [FieldId]='{04BF00DB-F5FB-41F7-8AB7-22408372A981}' and [Value]=':'
  4. Sitecore XPインスタンスを再起動します。