Need help? Check out our Support site, then

saving destroys xml source code with namespace prefixes

  1. Hi,

    I've chosen WordPress to start a technical blog because of its support for source code syntax highlighting ( However, when I enter XML source code containing namespace prefixes, this gets all cluttered when saving. For example, after saving, following fragment:
    <br /> [sourcecode language="xml"]<br /> <test:test xmlns:test="test"><br /> <test:hello>world</test:hello><br /> </test:test><br /> [/sourcecode]<br />
    is mutilated to:
    <br /> [sourcecode language="xml"]<br /> <test :test xmlns:test=""><br /> </test><test :hello>world</test><br /> [/sourcecode]<br />

    Note that this is *not* a highlighting issue; the problem occurs when saving a post, and only with namespace-prefixed XML source code. Is there any workaround?

    Kind regards,

    Ron Van den Branden

  2. Sigh,

    The issue isn't limited to namespace prefixes: it is triggered as well when XML elements have hyphens in their name.

    <br /> [sourcecode language="xml"]<br /> <test-test><br /> <test-hello>world</test-hello><br /> </test-test><br /> [/sourcecode]<br />

    is saved as
    <br /> [sourcecode language="xml"]<br /> <test -test><br /> </test><test -hello>world</test><br /> [/sourcecode]<br />

    ...which turns marking up XML source code examples on my blog into a pretty useless exercise... I hope it can be fixed?

    Kind regards,


  3. Aha,

    I have found the cause: the formatting option "WordPress should correct invalidly nested XHTML automatically" was responsible. If I disable this option, all goes well.

    Quite a relief for me (since WP generally seems a great tool), and hopefully WP developers know where to look now.


    Ron Van den Branden

  4. Thanks so much for this tip. I experienced a similar problem when trying to include regexes for HTML (such as <\/b&#gt;) in source code: a space was introduced into the tag. Disabling the XHTML correction worked for me.

Topic Closed

This topic has been closed to new replies.

About this Topic