Copied to clipboard

Flag this post as spam?

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


  • Maxim 3 posts 23 karma points
    Jan 16, 2015 @ 11:04
    Maxim
    0

    Umbraco 7.2.1 will not publish empty elements

    I'm having trouble getting Umbraco to publish empty elements. I upgraded from 4.5.2 to 7.2.1 and the published XML no longer shows empty elements, for example <subject/> until i give it a value and it shows up as <subject>value</subject>.

    If i want to publish the empty elements, where is that done? In a config, the XSLT file, template or macro?

    Any help would be appreciated.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 17, 2015 @ 09:05
    Jan Skovgaard
    0

    Hi Maxim and welcome to our :)

    What issues are you having since the empty elements are no longer published in the umbraco.config? If you're using XSLT for rendering your pages then you should not have issues since empty elements or non-existing elements would not be parsed anyway...so it should act the same. Perhaps you need to add some checks in different places though.

    You can't do anything in order to publish empty elements yourself. That's a Umbraco core thing.

    But why do you need to have the empty elements published? What's the scenario/use case?

    /Jan

  • Maxim 3 posts 23 karma points
    Jan 19, 2015 @ 09:07
    Maxim
    0

    We use Umbrco as a content tree for CMS and not much more, we simply render the XML and parse it ourselves in our application.

    We use empty attributes for routing, for example we want to tell our application where a node should be rendered by typing in empty labels like so;

    <routing_controller_content/>
    <routing_action_show/>

    since we want all nodes of that type to be renderd by that action in that controller we do not want to specify it in every single item in the tree, and the way to do that was "hard coding" it as an element name. The one option i found as a solution was to change it from a label to a bool that always has a default value and not care about the value when parsing the XML. The problem with this was that I had to do a lot of manual publishing and republishing.

    If you say that this is done in Umbraco Core, could you help me find the position in the code that determines that empty elements should not be published, and I could compile my own version.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 19, 2015 @ 09:23
    Jan Skovgaard
    0

    Hi Maxim

    I don't know where in the core this happens since I'm a frontend-developer I don't digg that much down in the core and inner workings.

    But since the behavior apparently has changed it must be related to a core change. But perhaps you can find your way through the source code with the hints from this article http://24days.in/umbraco/2014/traveller-guide/

    As you probably already know the source code is here https://github.com/umbraco/Umbraco-CMS/ - Be aware that there is a new branching strategy from HQ, which may also be nice to know about https://umbraco.com/follow-us/blog-archive/2014/12/18/new-source-control-branching-structure

    /Jan

  • Maxim 3 posts 23 karma points
    Jan 19, 2015 @ 09:47
    Maxim
    0

    Thank you for your answer, I will have a look into the core project and see if I can find a simple solution to my problem, otherwise i will go with the other soultion of turning the element into a bool.

Please Sign in or register to post replies

Write your reply to:

Draft