Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 21, 2019 @ 16:24
    Ismail Mayat
    0

    Umbraco xpath issue

    I am trying todo the following in umbraco 7.5.3

        string feedXpath = "/root/HomePage/ListPage//*[@nodeType='" + @docTypeId + "']";
    
    var feedItems = Umbraco.TypedContentAtXPath(feedXpath);
    

    This xpath gives me 44 items. However I have more than that. When i open the xml config cache file in notepad++ and run generated xpath i.e

    /root/HomePage/ListPage//*[@nodeType='1599']
    

    I get the right number. Is there a bug with xpath in Umbraco?

    Regards

    Ismail

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Aug 21, 2019 @ 18:21
    Chriztian Steinmeier
    0

    Hi Ismail,

    I'd say you should look in the implementation of TypedContentAtXPath() - it may filter out nodes that for some reason can't be converted to complete models?

    Are the 44 you get by any chance "top" levels (i.e., are all the missing ones descendants of those 44)?

    /Chriztian

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 22, 2019 @ 12:15
    Ismail Mayat
    0

    Seems like missing ones are descendants. For now i am going to do it with Descendants() and linq (somewhere some kittens have died) but this page is a one off so not to fussed about performance.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft