Copied to clipboard

Flag this post as spam?

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


  • Arvind 4 posts 24 karma points
    May 19, 2013 @ 17:35
    Arvind
    0

    Richtext XML Editor in Umbraco

    Hi,

    I have an asp.net application, input to this application is XML files. I have a requirement of implementing rich text XML editor(using Umbraco) for editing XML files. These files have to be validated against pre-defined XSD schema files. I am using umbraco v4.7.2

    I tried to find if there is any plug-in available in Umbraco to acheive this. Or any pointer for implementing this.

    If someone can share the code or implementation, it will be a great help to me.

    Thanks in advance for all the help !

    Regards,

    Arvind

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    May 19, 2013 @ 21:04
    Chriztian Steinmeier
    0

    (Deleted a wrongful response)... will reply properly afterwards. Sorry.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    May 19, 2013 @ 21:25
    Chriztian Steinmeier
    0

    Hi Arvind,

    If you need to be able to edit the actual XML files, I don't think Umbraco is the proper tool, but if you need to "humanize" editing of data to be published as XML files, you'll definitely be able to do it with Umbraco. For example:

    Let's say you have a simple XML format like this:

    <Movies>
        <Movie id="3456">
            <title>LEGO Star Wars Episode XII: The Missing Pieces</title>
            <rating>5</rating>
            <director>Lawrence E. Gopher</director>
        </Movie>
        <Movie id="1762">
            <title>Ping Pong — The Movie</title>
            <rating>3</rating>
            <director>Paul Ongular</director>
        </Movie>
    </Movies>

    You could setup "Director" and "Movie" Document Types, and three DataTypes - a Textstring type for the title, a Dropdown with the numbers 1 to 5 for the rating, and an XPathDropdownList for the director. Possibly "Directors" and "Movies" Document Types too, as containers for the items.

    In Content you'd create something like this:

    Content
        Movies (Movies type)
            LEGO Star Wars XII (Movie type)
            Ping Pong (Movie)
            ...
        Directors (Directors)
            Lawrence E. Gopher (Director)
            Pong Ongular  (Director)
            ...
    
    Then you'd create an XSLT file (create macro as well - leave the checkbox checked) and paste in this sample code:
    <?xml version="1.0" encoding="utf-8" ?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:umb="urn:umbraco.library"
        exclude-result-prefixes="umb"
    >
    
        <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
    
        <xsl:param name="currentPage" />
        <xsl:variable name="root" select="$currentPage/ancestor-or-self::root" />
    
        <xsl:variable name="movies" select="$root/Movies/Movie" />
        <xsl:variable name="directors" select="$root/Directors/Director" />
    
        <xsl:template match="/">
            <Movies>
                <xsl:apply-templates select="$movies" />
            </Movies>
        </xsl:template>
    
        <xsl:template match="Movie">
            <Movie id="{@id}">
                <title><xsl:value-of select="title" /></title>
                <rating><xsl:value-of select="rating" /></rating>
                <director><xsl:value-of select="$directors[@id = current()/director]/@nodeName" /></director>
            </Movie>
        </xsl:template>
    
    </xsl:stylesheet>
    Then you need to put the macro on a mastertemplate and you're close to having a movie database with up-to-date info in an XML feed whenever you publish a new node.
    Please note: I have not told you everything needed to get this going, but at least enough for you to know the steps involved in getting started... hopefully you can decide if this is what you need...

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft