2 Replies Latest reply: Oct 29, 2012 1:49 PM by user213133 RSS

    Using LegacyCustomSectionExtensibilityHandler outside of CSS

    user213133
      In the first Dev to Dev Q&A call, there was a question about pulling all of a spec's custom section attribute values during a workflow action for a spec type that's not able to use CSS (a Master Spec). The goal was to create an XML output for the sections similar to that which CSS creates, and Ron suggested using the same handler class that CSS uses in the exportExtensions.xml configuration file. We're running into some issues with that.

      If we try to use the LegacyCustomSectionExtensibilityHandler like the config file does, the Format method expects a RenderingContext object, which we don't have. In looking at how to instantiate a RenderingContext object, most of the overloads require a current object, a root object and and INodeType object. The current and root are shown as generic objects, but it appears they actually need to be a Tip-related object. We're also not sure what the INodeType refers to.

      We also tried using the GenerateXML method of the CustomSectionXMLGenerator (and LegacyCustomSectionXMLGenerator) class. This seemed to be pretty basic with straightforward parameters, but we had mixed results in that we were able to generate some XML related to the custom section unless a row or column name in the section contained a colon. In that case, it throws an XML-related exception about that character not being allowed in a name.

      So, the questions: Is there a way to use the LegacyCustomSectionExtensibilityHandler class when having only the specification object and the ILinearTransitionContext context from which it came (or IValidationContext as we're using for easier testing during development)? Failing that, is there a way to utilize the GenerateXML method without it choking on names with colons? It was such a great answer during the Q&A, so I'm hoping to avoid writing something that does what these classes basically already do.

      Thanks,
        • 1. Re: Using LegacyCustomSectionExtensibilityHandler outside of CSS
          Ron M-Oracle
          I think you have to stick with the CustomSectionXMLGenerator, but since it doesn't handle colons (:) properly you have two options:
          1) Log an enhancement/bug request.

          2) If you can't wait for that to be fixed, you theoretically could temporarily modify the value of the custom section name in memory prior to passing it to the GenerateXML method.
          -> instanceDO.SectionTemplate.NameML.Name -- replace the colon with an underscore or something similar. If you wind up using the instanceDO again after, you could restore the value, but if you don't use it, then it doesn't need to be restored (assuming you aren't saving the DO or its parent object.

          If you need to update the rows too, you could do so by looping through the rows
          foreach (IExtendedAttributeRowInstanceDO rowInstanceDO in instanceDO.Rows.OrderedValues)
          {
          ...
          rowInstanceDO.RowTemplate.NameML.Name
          • 2. Re: Using LegacyCustomSectionExtensibilityHandler outside of CSS
            user213133
            Thanks Ron, the workaround should be fine in our case. We'll put in a SR/request as well.