ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Problems with email in XML

September 01, 2009 10:13pm

Subscribe [4]
  • #1 / Sep 01, 2009 10:13pm

    Help!  Just need to pull this email field (which exists) from the weblog into an XML template, but keep on getting an error:

    XML Parsing Error: mismatched tag.


    This XML template works fine…

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        {exp:weblog:entries weblog="jobs"}
            <item>
                {if mantra_title!=""}
                    <title>
                        <![CDATA[{mantra_title}]]>
                    </title>
                {/if}
                {if mantra_subtitle!=""}
                    <subtitle>
                        <![CDATA[{mantra_subtitle}]]>
                    </subtitle>
                {/if}
                {if mantra_desc!=""}
                    <desc>
                        <![CDATA[{mantra_desc}]]>
                    </desc>        
                {/if}
            </item>
        {/exp:weblog:entries}
    </root>


    But if I add this “if” statement, it fails…invalid.

    {if mantra_url!=""}
                    <email>
                        <![CDATA[{mantra_url}]]>
                    </email>        
                {/if}

    {mantra_url}[email protected]

    I tried installing the XML encode plugin, but that just kicks out garbage.

    Help!  Just need to pull this email field (which exists) from the weblog, how is that done?

  • #2 / Sep 01, 2009 10:17pm

    Greg Aker

    6022 posts

    Greetings!

    You have a link we can see?  What version/build of ExpressionEngine are you running?

    What is the “junk” that is spit out?

    -greg

  • #3 / Sep 01, 2009 10:23pm

    Wow!  Hi there.

    Yep, sure…E.E 1.6.8.  To preview the ‘junk’ see this….

    <a href="http://mantradesign.tv.s41725.gridserver.com/xml/jobs/">http://mantradesign.tv.s41725.gridserver.com/xml/jobs/</a>

    Here’s the template that produces that….

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        {exp:weblog:entries weblog="jobs"}
            <item>
                {if mantra_title!=""}
                    <title>
                        <![CDATA[{mantra_title}]]>
                    </title>
                {/if}
                {if mantra_subtitle!=""}
                    <subtitle>
                        <![CDATA[{mantra_subtitle}]]>
                    </subtitle>
                {/if}
                {if mantra_desc!=""}
                    <desc>
                        <![CDATA[{mantra_desc}]]>
                    </desc>        
                {/if}
                    <email>
                        <![CDATA[{mantra_url}]]>
                    </email>        
            </item>
        {/exp:weblog:entries}
    </root>

    and here’s a screengrab of an example post…

    http://img.skitch.com/20090902-mts8aqgfkj3d2gxryf2f2pdx4u.jpg

  • #4 / Sep 02, 2009 1:33am

    John Henry Donovan

    12339 posts

    dream-village,

    The junk you refer to is actually an EE feature that encodes the email address using javascript and HTML entities to make it more difficult for spam harvesters to grab an email address from your site. You should be able to disable it by going here

    Admin ›  Weblog Administration ›  Weblog Management ›  Edit Weblog Preferences


    Under Weblog Posting Preferences switch Automatically turn URLs and email addresses into links? off.

  • #5 / Sep 02, 2009 11:25am

    Yahooo!

    This forum rocks.

    Thanks.

  • #6 / Sep 02, 2009 11:30am

    Ingmar

    29245 posts

    So, you’re all good? Just making sure.

  • #7 / Sep 02, 2009 11:38am

    Yes, all good.  Now the email field renders as simple CDATA from the XML template.  Thanks again

  • #8 / Sep 02, 2009 11:41am

    Sue Crocker

    26054 posts

    Glad things are working again. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases