Inserting XML Code

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

Inserting XML Code

Post by meritweb »

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?
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Inserting XML Code

Post by yellowled »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Inserting XML Code

Post by garvinhicking »

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 3:40 am

Re: Inserting XML Code

Post by meritweb »

Garvin, thank you so much. That did it!
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Inserting XML Code

Post by Timbalu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Inserting XML Code

Post by garvinhicking »

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