This project is read-only.

RC 2.0: Editor won't insert xml code

Topics: Business Logic Layer, Controls
Dec 19, 2010 at 7:58 AM
Edited Dec 19, 2010 at 8:09 AM


I am quite new to BE and maybe I just need to tweak I thing or two but the internal editor won't add any xml code snippet to my first blog post
Could it be caused by IE8?

I click add code, change type of code to xml, paste my xml snippet etc but code doesnt show. If I change to html view there is no code but the tags shows
I can then add the code but changing between html and wysiwyg will remove the code again

Will the latest stable release be a better choice? Or should I use windows live writer instead?
I am a bit afraid to start using BE atm as opening any page in the internal editor might crash the content

[EDIT] More ordinary code eg C# is not a problem, I assume it's the tags in the xml code which gives the greef?

Any ideas? Thanks in advance  /Peter

Dec 19, 2010 at 10:04 AM

Hi Peter, thanks very for bringing this up.  This is a problem and I just checked in a fix for it.  I noticed a symptom of this recently, but didn't realize it was this bad.  We need to HTML encode the values you enter into the Syntax Highlighter plugin window.  BE has this fixed.

You can either upgrade to that version ... you would need to compile the BE core project if you download from the Source Code tab above.  Or to make it easier on you, I ZIP'd up the latest version of the plugin.  You can download it here.  Inside the ZIP is a folder named "insertcode".  This should replace the "insertcode" folder you will find at:


Please give it a try when you have a chance ... thanks.

Dec 19, 2010 at 12:13 PM

Thanks a trillion, I have enough grey hair as it is :)
My blog will include a lot of xml and xslt snippets

I will grab the sourcecode and try it this evening

Dec 19, 2010 at 7:28 PM

Seems to be working much better :-)
I'll upload the code to my blog and publish my first post

Jan 6, 2011 at 2:13 AM
Edited Jan 6, 2011 at 4:02 AM

I've installed this update and still cannot post ASPX content - can be viewed here:


    <asp:DropDownList ID="InstrumentDDL" AutoPostBack="true" 
            Width="100" runat="server">
        <asp:ListItem Text="Select" Value="Select"></asp:ListItem>
        <asp:ListItem Text="Guitar" Value="Guitar"></asp:ListItem>
        <asp:ListItem Text="Mandolin" Value="Mandolin"></asp:ListItem>

    <asp:DropDownList ID="GuitarDDL" AutoPostBack="true" 
            Enabled="false" Width="100" runat="server">
        <asp:ListItem Text="Select" Value="Select"></asp:ListItem>
        <asp:ListItem Text="Fender" Value="Fender"></asp:ListItem>
        <asp:ListItem Text="Gibson" Value="Gibson"></asp:ListItem>
        <asp:ListItem Text="Gretsch" Value="Gretsch"></asp:ListItem>
        <asp:ListItem Text="Martin" Value="Martin"></asp:ListItem>


Jan 6, 2011 at 3:51 AM

I pasted your code in as "xml".  Here's what it looks like for me -- link.

I wonder if the lines breaking is theme related.  If you switch to the Standard theme, does it come out okay?

In your screenshot, the markup seems to look good.  It's just that it's not wrapping.  Is the non-wrapping part of it what you are unsatisfied with?

Jan 6, 2011 at 4:06 AM
Edited Jan 6, 2011 at 3:47 PM

Hi Ben,

I tried it with several of the other themes, to no avail. When I'm WYSIWYG mode, I click on the "Insert Code" icon and paste in the markup then select XML from the drop down. It then renders empty, just showing the line numbers.

If I then go back into the raw HTML view and paste in the markup again, between the generated pre tags, it appears as in the screen shot. Line breaks are not recognized even though I have selected wrap lines in config...

If I could get the line breaks to work, I'd be good :-)


Jan 6, 2011 at 8:36 AM

I realized the reason why my lines wrapped is because I copied and pasted the code you entered above ... and that code already has hard line breaks in it.  So when I tested it, it wasn't really wrapping -- there were just hard breaks in it.

If I remove the hard breaks, then I get a horizontal scrollbar too.  Even at CodePlex here, you may have noticed that the code doesn't normally wrap.

It looks like in SyntaxHighlighter version 2, there was a wrapping option that was removed in version 3.  BE is using version 3, btw.

I found this thread where one guy has some suggestions on getting wrapping to work.  Here's the options page for SyntaxHighlighter.  There's a number of options, but I don't see anything about wrapping.  Making those changes that person brought up is something you could try doing.

Jan 6, 2011 at 5:06 PM

Hi Ben,

Thanks for the feedback. I tried the other person's CSS hack but that didn't work. It seems there is more going on than the line breaks. When I copy the markup into the WYSIWYG editor it renders blank - only shows line numbers?

I've lost two days on this and it's a real disappointment because the tool is basically unusable in its present state (at least for me). I think my only option now is to see if version 2 of the highlighter tool can be swapped into BE 2.0? or maybe give Live Writer a try-out. I'm guessing I may be able to find a similar code highlighter tool for LW...



Jan 6, 2011 at 9:14 PM

The part I'm not sure is the same for you and me is .... I click the toolbar icon to paste in the code.  In the popup dialog, I select XML from the dropdown list and paste in the ASP.NET code.  Then I click the "Insert" button.  When I do this, the ASP.NET markup appears in the WYSIWYG editor -- i.e. it's not blank.  See this screenshot.

It sounds like after you click the "Insert" button, you are not seeing any of the ASP.NET markup?  If so, that's not correct.  Before I made that change to this plugin, I was also not seeing the markup.  But the updated plugin now shows the markup since it's HTML encoding the code that you paste into the popup dialog window.

After I paste in the code, while I'm still on the Add Entry page with the WYSIWYG editor, if I click the "HTML" toolbar icon, here is what I see.  You can see how the tags are HTML encoded.  For example, it starts off as:  &lt;asp:DropDownList .....   Before I made this change, the HTML tags were not being HTML encoded, so it was incorrectly starting off as:  <asp:DropDownList .......

I'm curious how it's working on your end.

Jan 6, 2011 at 10:22 PM
Edited Jan 7, 2011 at 11:32 AM

Correct. After I click Insert in the pop-up, I cannot see the markup in the WYSIWYG editor, as shown in your first screen shot.

Do I also have to update the version of BE?

Jan 6, 2011 at 10:47 PM
Edited Jan 6, 2011 at 10:47 PM

What version of BE are you using?  The final 2.0 release includes this updated plugin.  Before the final 2.0 release, I updated the plugin and make it downloadable here.  My notes from above are:

Inside the ZIP is a folder named "insertcode".  This should replace the "insertcode" folder you will find at:

........ as a quick check, in the /insertcode folder is a subfolder named /js.  In there, there should be a file named encoder.js.  This was one of the files that was added for this plugin update.  There were some other changes too.

EDIT:  Updating BE for this plugin update isn't necessary.  The plugin can be updated by itself.