The MU forums have moved to WordPress.org

Unable to display XML code in post- but showing HTML code works fine (4 posts)

  1. DanYork
    Member
    Posted 14 years ago #

    I am trying to display some XML code in a WPMU (1.3.1) post and am unable to do so despite trying various plugins. Using those plugins, I can get HTML code to display fine, but not XML code. Is anyone aware of solutions to do this?

    In a "developer blog" I want to be able to include code snippets of XML code. I would like to do this without having to manually convert all the < and > tags into the appropriate character entities. I have tried the following plugins:

    - Code Markup:
    http://www.thunderguy.com/semicolon/wordpress/code-markup-wordpress-plugin/

    - Code Autoescape:
    http://priyadi.net/archives/2005/09/27/wordpress-plugin-code-autoescape/

    - Preserve Code Formatting:
    http://www.coffee2code.com/archives/2005/03/29/plugin-preserve-code-formatting/

    I also looked at Code Viewer ( http://elasticdog.com/2004/09/code-viewer/ ) but would prefer NOT to store my XML code in separate files.

    In all of these cases, I have followed the relevant instructions and installed the files into /plugins/. I have gone into WPMU Site Admin and allowed the plugin to be activated. I have then gone into a specific blog and enabled the plugin. I have then followed the instructions for how to markup the code, generally all with < code > . I have rich text editing turned OFF (although I did also try this with text editing turned on). I have also tried posting via MarsEdit as well.

    For HTML code, these plugins are working fine. I can see the HTML code displayed in the blog post.

    However, for XML code, the code just... disappears.

    Here is an example of some XML code that I'm trying to display (let's see if it displays here):

    <?xml version= "1.0"?>
    <grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US"
    root = "MYRULENAME">
    <rule id="MYRULENAME">
    <one-of>
    <item>
    utterance
    <tag> <![CDATA[ <mySlotName "my return value"> ]]> </tag>
    </item>
    </one-of>
    </rule>
    </grammar>

    In all posts, this XML code gets removed.

    Does anyone have any suggestions for what is going on here?

    Thank you in advance,
    Dan

  2. DanYork
    Member
    Posted 14 years ago #

    The XML code did come across here fine.

    As far as other plugins running in this WPMU installation, this blog only has:
    - Spam Karma 2
    - ShareThis
    - WPMU Mobile Edition

    The mu-plugins directory doesn't look to have any plugins that would affect formatting. (Some relating to OpenID and others relating to our main blog portal page.)

  3. andrea_r
    Moderator
    Posted 14 years ago #

    Check out the kses.php file. That controls what tags are allowed in posts. Everything else gets stripped.

  4. DanYork
    Member
    Posted 14 years ago #

    andrea_r - I meant to reply back here earlier and say "thanks" for pointing me to kses.php.

    Unfortunately, it looks to me like if I want to go this route of using one of those plugins, I'll have to basically enter the entire VoiceXML / CCXML vocabulary into the kses.php file... which seems like a great bit of work. For the meantime, I think I'll stick with just using one of the various text editors that can convert all the special characters (like angle brackets) to their appropriate HTML character entities. :-)

    Thanks for pointing me to the file that explained why all my XML was being stripped out.

    Dan

About this Topic