Inserting XML Code

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
meritweb
Regular
Posts: 43
Joined: Fri Jan 25, 2008 4:40 am

Inserting XML Code

Post by meritweb » Wed Jan 07, 2015 8:39 pm

We have a blog where some of our Software Developers post code best practices, etc...

I am trying to insert some XML Code Snippets into my article using the GeShi markup up - but nothing is showing up in my article. When I put the code in the Article's HTML Source Editor, and then switch over to the WYSIWYG Editor - nothing is there.

Any advice on what I'm doing wrong? How do I display Markup XML Code?

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Inserting XML Code

Post by yellowled » Wed Jan 07, 2015 8:54 pm

meritweb wrote:When I put the code in the Article's HTML Source Editor, and then switch over to the WYSIWYG Editor - nothing is there.
Wild guess – do you “mask” the angle brackets in your XML code? Because those are special characters in HTML (basically meaning: HTML uses angle brackets as well), so you'd probably have to enter them as HTML entities.

So not

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
but

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Inserting XML Code

Post by garvinhicking » Fri Jan 09, 2015 1:12 pm

Hi!

Most probably, straight XML markup and WYSIWYG editor don't mix well.

If you enter it in sourcecode mode, when sewitching back the WYSIWYG editor will "Kill" that invalid markup. If you enter it in the WYSIWYG mode, then Geshi will not properly pick it up because it contains HTML special characters.

Ideally you should turn off the WYSIWYG editor if you plan to post code snippets with a syntax highlighter. Or you should not use syntax highlighters, and highlight/markup the text on your own in the WYSWIYG editor...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

meritweb
Regular
Posts: 43
Joined: Fri Jan 25, 2008 4:40 am

Re: Inserting XML Code

Post by meritweb » Sat Jan 10, 2015 5:16 am

Garvin, thank you so much. That did it!

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Inserting XML Code

Post by Timbalu » Sat Jan 10, 2015 11:17 am

garvinhicking wrote:Ideally you should turn off the WYSIWYG editor if you plan to post code snippets with a syntax highlighter. Or you should not use syntax highlighters, and highlight/markup the text on your own in the WYSWIYG editor...
Or use the Serendipity CKEDITOR event plugin seulement, which comes by default with an excellent, extra added codesnippet/highlighter plugin to avoid the CKEDITOR ACF Filter removing snips like this, changing the view mode or saving the entry. It has a XML highlight language too.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Inserting XML Code

Post by garvinhicking » Sat Jan 10, 2015 1:52 pm

Thanks Timbalu for that addition, wasn't aware of that. Good to know!
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply