Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jordan van Gogh 2 posts 22 karma points
    Apr 07, 2011 @ 12:46
    Jordan van Gogh
    0

    Access XML property data of custom data type using dynamic object

    Hi,
    I'm just getting started with Umbraco, and I've just created my first custom data type. The data of this custom type is stored correctly as XML in the dataNtext column of the "cmsPropertyData" table. When using the XMLDump package to investigate the output XML, the XML data of the custom type seems to be incorporated correctly in the XML tree. However, when I try to access the data (using a statement like @Model.CustomDT.TestNode) I get the following exception:
    'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'TestNode'
    I've tested similar code for some of the uComponents data types, which also store their data using XML, and it doesn't seem to be working for those either.
    Does this mean that the dynamic object used by Umbraco cannot look into the XML data of custom types?
    Thanks,
    Jordan.

  • Alex 78 posts 136 karma points
    Apr 07, 2011 @ 12:51
    Alex
    0

    Hi Jordan, yes you should be able to do that. Can you provide some samples of the XML stored in the datatype and the Razor code in the Macro?

  • Jordan van Gogh 2 posts 22 karma points
    Apr 07, 2011 @ 14:27
    Jordan van Gogh
    0

    Hi Alex,

    Thanks for your quick reply. I just managed to figure out what I did wrong: The root node of the XML output of the data type is substituted by the alias of the custom data type. So "@Model.customDT.TestNode.aProperty" should actually be "@Model.customDT.aProperty". 

Please Sign in or register to post replies

Write your reply to:

Draft