SDL Tridion SiteEdit 2009 SP2 XPath error when editing some components

330 views Asked by At

I am receiving the following error when trying to edit some of my Component Presentations using SiteEdit.

Sys.FormatException: Could not get the type info from component xml schema. Field: cf_tcm:32-204267_title XPath: Content/custom:Content/custom:title[1]

It's strange because some of the Components with the same Template work fine (these do not have an image set,but the ones with an image set do not work).

Here is the code for my CT:

<div class="column v-2 siteedit">
  <!-- TemplateBeginIf cond = "Component.thumbnail" -->
    <!-- TemplateBeginIf cond = "Component.image" -->
      <a href="@@Component.Fields.image@@" class="fb ajax">
    <!-- TemplateEndIf -->
    <img src="@@Component.Fields.thumbnail@@"  class="align-left"
         alt="@@thumbnail0.Metadata.alt@@" height="69" width="99"/>
    <!-- TemplateBeginIf cond = "Component.image" -->
      </a>
    <!-- TemplateEndIf -->
  <!-- TemplateEndIf -->    
  <h2>
    <tcdl:ComponentField name="title">@@Component.Fields.title@@</tcdl:ComponentField>
  </h2>
  <p>@@Component.Fields.summary@@</p>
</div>

(I have removed other editable fields just to make sure that it wasn't a problem with a specific field)

Any ideas?

Update
As requested here's my (anonymized) HTML, the 1st and 3rd components have the issue, the middle one is fine:

<div class="general-content columns-three">
    <div class="column v-2 siteedit" style="height: 209px; ">
        <!-- Start SiteEdit Component Presentation: {
            "ID" : "97829119-68f0-4e41-9862-b042d480cb71",
            "ComponentID" : "tcm:32-204859",
            "ComponentTemplateID" : "tcm:32-204536-32",
            "Version" : "2",
            "IsQueryBased" : false
        } -->
        <a href="http://REDACTED:84/_images/REDACTED.png?__Proxy=0" class="fb ajax" target="_self">
            <img src="/_images/REDACTED.gif" class="align-left" alt="REDACTED" height="69" width="99">
        </a>

        <h2>
            <span style="">
            <!-- Start SiteEdit Component Field: {
                "ID" : "cf_tcm:32-204267_title", 
                "XPath" : "tcm:Content/custom:Content/custom:title[1]", 
                "IsMultiValued" : false
            } -->REDACTED
            </span>
        </h2>
      <p>REDACTED</p>
    </div>      

    <div class="column v-2 siteedit" style="height: 209px; ">
        <!-- Start SiteEdit Component Presentation: {
            "ID" : "2933b5e0-2006-440d-bc03-2224650bdd7d",
            "ComponentID" : "tcm:32-204268",
            "ComponentTemplateID" : "tcm:32-204536-32",
            "Version" : "5",
            "IsQueryBased" : false
        } -->
        <h2> <span style="">
            <!-- Start SiteEdit Component Field: {
                "ID" : "cf_tcm:32-204268_title", 
                "XPath" : "tcm:Content/custom:Content/custom:title[1]", 
                "IsMultiValued" : false} -->REDACTED</span>
           </h2>
           <p>REDACTED</p>
    </div>      

    <div class="column v-2 siteedit" style="height: 209px; ">
        <!-- Start SiteEdit Component Presentation: {
            "ID" : "fac3c467-7c71-4be9-b319-8a35524ee172",
            "ComponentID" : "tcm:32-204860",
            "ComponentTemplateID" : "tcm:32-204536-32",
            "Version" : "2",
            "IsQueryBased" : false
        } -->
        <a href="http://REDACTED:84/_images/REDACTED.png?__Proxy=0" class="fb ajax" target="_self">
            <img src="/_images/REDACTED.gif" class="align-left" alt="REDACTED" height="69" width="99">
        </a>
        <h2> <span style="">
            <!-- Start SiteEdit Component Field: {
                "ID" : "cf_tcm:32-204269_title", 
                "XPath" : "tcm:Content/custom:Content/custom:title[1]", 
                "IsMultiValued" : false
            } -->REDACTED</span>
        </h2>
        <p>REDACTED</p>
    </div>      
</div>
1

There are 1 answers

4
Frank van Puffelen On BEST ANSWER

I explained when that error message appears here: "Could not get the type info from component xml schema" when loading a page in SiteEdit 2009

Your use-case may be different from that question, the product always shows this for the same reason: it can't find a field (that is identified in a <!-- Start SiteEdit Component Field command) in the current Component (that is identified in the enclosing <!-- Start SiteEdit Component Presentation command).

Given your error message:

cf_tcm:32-204267_title XPath: Content/custom:Content/custom:title[1]

It seems like Component tcm:32-204267 doesn't have a field named title.

In these cases it is always easiest if you look at the HTML that SiteEdit ends up processing, so what your staging/preview server returns. Find the title field and its enclosing Component Presentation and verify that indeed that Component Presentation has a field named title.

If you'd like a more direct answer to "what am I doing wrong?", add the relevant HTML-with-the-SiteEdit-commands to your question and I'll update my answer to match.


Update based on the HTML provided

If I look at the IDs of the Component and Fields you provided:

  1. Component: tcm:32-204859 Field: cf_tcm:32-204267_title
  2. Component: tcm:32-204268 Field: cf_tcm:32-204268_title
  3. Component: tcm:32-204860 Field: cf_tcm:32-204269_title

The ID in the JSON is only used by SiteEdit to ensure some meaningless uniqueness. But in this case the Field ID seems to indicate from which Component the field comes.

If you then look at the data closely, you can see that for Component 2 the field points to the same Component. For Components 1 and 3 the fields actually point to another Component. Again, the ID properties of the Field commands are in themselves not used. But the relation between what works and what doesn't seems to coincide pretty well with the knowledge that SiteEdit loads the Schema of the Component indicated in the containing Component Presentation command and cannot find the field at the XPath indicated in the Component Field command.

I suspect that in #1 and #3 you have put some regular Component on the page, but are rendering the title of a Multimedia Component that is linked that Component. In #2 you are most likely rendering the title of an MMC that is explicitly put on the page.