0

Problem:

Field 'subsection' (in MVC model Artikel property below) contains null.

public List ArticleBody { get; set; }

I can't see what I did wrong. ISyndicationFeedItemProvider?

  • SDL Web Template builder does what expected (Pagetemplate with Page).
    'subsection' refers to an ArticleBody. It has fields title, text.
          "Content": {
            "title": "Lorem Ipsum",
            "intro": "MyIntro Neque porro quisquam est qui dolorem ipsum",
            "publishDate": "2020-11-11T21:38:06.455",
            "subsection": {
              "$type": "ContentModelData[]",
              "$values": [
                {
                  "title": "What is Lorem Ipsum?",
                  "text": "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,"
                },
                {
                  "title": "Why do we use it?",
                  "text": {
                    "$type": "RichTextData",
                    "Fragments": [
                      "<span style=\"color: rgb(0, 0, 0); font-family: &quot;Open Sans&quot;, Arial, sans-serif; font-size: 14px; text-align: justify;\">Curabitur id purus at urna efficitur aliquet auctor at tellus. Nullam finibus enim arcu, at ultrices justo mattis et. Donec molestie sapien metus, ac porttitor ligula convallis ut. Ut dignissim lectus et laoreet varius. Sed sem ante, gravida et maximus sit amet, egestas a mi. Ut nec semper metus. Sed blandit lectus elit, et dapibus sem egestas suscipit. Praesent varius felis et sem ullamcorper porttitor.</span>"
                    ]
                  }
                },
                {
                  "title": "Where can I get some? ",
                  "text": "It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures"
                }
              ]
            }
          },
  • Schema Artikel (contains Embedded schema Paragraaf)

enter image description here

  • DXA models
    [SemanticEntity(Vocab = SchemaOrgVocabulary, EntityName = "Artikel", Prefix = "s", Public = true)]
    [Serializable]
    public class Artikel : EntityModel
    {
        [SemanticProperty("s:title")]
        public string Title { get; set; }
        ...

        [SemanticProperty("s:subsection")]
        public List<Paragraaf> ArticleBody { get; set; }
    [Serializable]
    public class Paragraaf : EntityModel
    {
        public string Title { get; set; }
        public RichText Text { get; set; }
    }

UPDATE:
I removed mymodule, and started again with content.
Is that possible?

  • old namespace Artikel:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sdl.com/web/schemas/mymodule" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" elementFormDefault="qualified" targetNamespace="http://www.sdl.com/web/schemas/mymodule">

  • new namespace Artikel:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="uuid:8498dbbe-4892-4d51-904e-4c41d879d22e" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" elementFormDefault="qualified" targetNamespace="uuid:8498dbbe-4892-4d51-904e-4c41d879d22e">

  • namespace Paragraaf:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns="" elementFormDefault="qualified">
        <xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance" schemaLocation="cm_xml_inst.xsd"></xsd:import>
        <xsd:annotation>
          <xsd:appinfo>
            <tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
              <tcm:Label ElementName="title" Metadata="false">Titel</tcm:Label>
              <tcm:Label ElementName="text" Metadata="false">Tekst</tcm:Label>
            </tcm:Labels>
          </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexType name="Paragraaf">
          <xsd:sequence>
            <xsd:element name="title" minOccurs="0" maxOccurs="1" type="xsd:normalizedString">
              <xsd:annotation>
                <xsd:appinfo>
                  <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:ExtensionXml>
                </xsd:appinfo>
              </xsd:annotation>
            </xsd:element>
            <xsd:element name="text" minOccurs="0" maxOccurs="1" type="xsd:normalizedString">
              <xsd:annotation>
                <xsd:appinfo>
                  <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:ExtensionXml>
                </xsd:appinfo>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:schema>

1 Answer 1

1

It seems you want to map View Model property Artikel.ArticleBody (nice mix of Dutch and English, BTW) to a CM field called subsection.

That is possible using a [SemanticProperty] annotation, but you currently only have one for the schema.org Vocabulary (which doesn’t define a type called “Artikel”, BTW), whereas you should use the Core Vocabulary for CM mapping. So: try adding [SemanticProperty(“subsection”)] (and remove the schema.org annotations for simplicity).

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.