Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1347 posts 1608 karma points
    Feb 08, 2012 @ 12:20
    Gordon Saxby
    0

    Difference between @nodeTypeAlias and @alias

    I am currently working on converting a v4.0 Umbraco site (old schema) to v4.7.1.1 (new schema)

    There is LOTS of code in User Controls, classes, etc and this is typical:

    xpath = string.Format("//node [@nodeTypeAlias = '{0}' and data[@alias = 'adSpendHeavyweight'] = 1]", Library.GetDocumentTypeAlias("BrandOwner"));

    Can I just check how this should be changed to suit the new schema please

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Feb 08, 2012 @ 12:26
    Chriztian Steinmeier
    0

    Hi Gordon,

    This should do it:

    xpath = string.Format("//{0}[adSpendHeavyweight = 1]", Library.GetDocumentTypeAlias("BrandOwner"));

     

    /Chriztian

  • Gordon Saxby 1347 posts 1608 karma points
    Feb 08, 2012 @ 12:33
    Gordon Saxby
    0

    Thanks for the fast reply Chriztian!

    So, to make it clear in my mind!!!

    @nodeTypeAlias value replaces "node" - could I also do this:     /* [name() = '{0}']  (I am concerned that some of the names may contain spaces!!)

    data[@alias = 'adSpendHeavyweight'] = 1 converts to "adSpendHeavyweight = 1"

     

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Feb 08, 2012 @ 12:42
    Chriztian Steinmeier
    0

    Hi Gordon,

    You can do the name() thing, but it won't matter - if any of the nodeTypeAliases had spaces in them I *think* they should have been replaced with an underscore ...

    The translations are a little bit dependent on the context, but sometimes you just need to see the before & after versions, e.g:

    <!-- v4.1 and lower: -->
    <node id="4" nodeTypeAlias="Cantina">
        <data alias="greedo">1</data>
    </node>
    
    <!-- v4.5++ -->
    <Cantina id="4" isDoc="">
        <greedo>1</greedo>
    </Cantina>

    /Chriztian

  • Gordon Saxby 1347 posts 1608 karma points
    Feb 08, 2012 @ 12:52
    Gordon Saxby
    0

    Yes, I agree it's a "context" issue but judging by how this project looks I wouldn't be surprised if some nodeTypeAliases had spaces!!

    Thanks again for your help.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies