Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. Please fix the XML pre tags

Please fix the XML pre tags

Scheduled Pinned Locked Moved Site Bugs / Suggestions
helpwpfcomxmlcode-review
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ron Beyer
    wrote on last edited by
    #1

    Whenever you insert XML into a Q&A answer, it removes all capitalization. Since you don't have an XAML language type, using <pre lang="xml"> removes all the capitalization inside the tags. This is a problem when posting answers about xml configuration files since the attributes inside an xml tag is case-sensitive. It doesn't allow the user to copy/paste XML/XAML from an answer into code. See Convert this XAML in Code[^], I had posted the answer with XAML that has capitalized tags and attributes, but when submitting it turns it all lower case. [Edit] The preview at the bottom shows the code block is correct, with the proper capitalization, but after submitting the capitalization is removed. Choosing to "Improve Answer" shows that the text inside the edit box has the capitalization removed so something after submitting is transforming the text to lower case.

    T 1 Reply Last reply
    0
    • R Ron Beyer

      Whenever you insert XML into a Q&A answer, it removes all capitalization. Since you don't have an XAML language type, using <pre lang="xml"> removes all the capitalization inside the tags. This is a problem when posting answers about xml configuration files since the attributes inside an xml tag is case-sensitive. It doesn't allow the user to copy/paste XML/XAML from an answer into code. See Convert this XAML in Code[^], I had posted the answer with XAML that has capitalized tags and attributes, but when submitting it turns it all lower case. [Edit] The preview at the bottom shows the code block is correct, with the proper capitalization, but after submitting the capitalization is removed. Choosing to "Improve Answer" shows that the text inside the edit box has the capitalization removed so something after submitting is transforming the text to lower case.

      T Offline
      T Offline
      Thomas Daniels
      wrote on last edited by
      #2

      Ron Beyer wrote:

      removes all the capitalization inside the tags.

      Let's try that:

      <pre lang="xml">
      <CapitalizedTag>Value</CapitalizedTag>
      </pre>

      Result:

      <CapitalizedTag>Value</CapitalizedTag>

      Strange, it doesn't remove the capitalization (perhaps because this is a message and not an answer). EDIT: I found the reason!!! Probably, you wrote something like this:

      <pre lang="xml">
      <CapitalizedTagHere>Value</CapitalizedTagHere>
      </pre>

      This will result in this (only in answers, in messages it gives a proper result):

      <capitalizedtaghere>Value</capitalizedtaghere>

      You need to change the < and > into the HTML entities &lt; and &gt; because otherwise, when posting an answer, the server thinks that your tags are real HTML tags, and removed the capitalization, but when rendering them, they are not real HTMl tags, so it will render the lowercase HTML tags as text. So that's why you need to use the HTML entities also in code blocks.

      The quick red ProgramFOX jumps right over the Lazy<Dog>. My latest article: Create an HTML5 (and JavaScript) Maze Game with a timer My group: C# Programmers Group

      R 1 Reply Last reply
      0
      • T Thomas Daniels

        Ron Beyer wrote:

        removes all the capitalization inside the tags.

        Let's try that:

        <pre lang="xml">
        <CapitalizedTag>Value</CapitalizedTag>
        </pre>

        Result:

        <CapitalizedTag>Value</CapitalizedTag>

        Strange, it doesn't remove the capitalization (perhaps because this is a message and not an answer). EDIT: I found the reason!!! Probably, you wrote something like this:

        <pre lang="xml">
        <CapitalizedTagHere>Value</CapitalizedTagHere>
        </pre>

        This will result in this (only in answers, in messages it gives a proper result):

        <capitalizedtaghere>Value</capitalizedtaghere>

        You need to change the < and > into the HTML entities &lt; and &gt; because otherwise, when posting an answer, the server thinks that your tags are real HTML tags, and removed the capitalization, but when rendering them, they are not real HTMl tags, so it will render the lowercase HTML tags as text. So that's why you need to use the HTML entities also in code blocks.

        The quick red ProgramFOX jumps right over the Lazy<Dog>. My latest article: Create an HTML5 (and JavaScript) Maze Game with a timer My group: C# Programmers Group

        R Offline
        R Offline
        Ron Beyer
        wrote on last edited by
        #3

        So why does it correctly render in the preview, but get mangled after submit? Shouldn't the system change everything between the pre tags into HTML-compatible stuff? I can only imagine what kind of giant PITA it would be to go through a 25+ line XML/XAML file and change every < > into its html escape code. I thought that was the purpose of pre tags?

        T 1 Reply Last reply
        0
        • R Ron Beyer

          So why does it correctly render in the preview, but get mangled after submit? Shouldn't the system change everything between the pre tags into HTML-compatible stuff? I can only imagine what kind of giant PITA it would be to go through a 25+ line XML/XAML file and change every < > into its html escape code. I thought that was the purpose of pre tags?

          T Offline
          T Offline
          Thomas Daniels
          wrote on last edited by
          #4

          Ron Beyer wrote:

          So why does it correctly render in the preview, but get mangled after submit?

          I don't know the internals of the Preview feature, so I actually have no idea.

          Ron Beyer wrote:

          I can only imagine what kind of giant PITA it would be to go through a 25+ line XML/XAML file and change every < > into its html escape code

          To avoid that, just choose "Encode HTML" when pasting your code, then it will automatically change < and > into its HTML entity.

          The quick red ProgramFOX jumps right over the Lazy<Dog>. My latest article: Create an HTML5 (and JavaScript) Maze Game with a timer My group: C# Programmers Group

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups