• 0

How do I output a backslash \ character in XML?


Question

4 answers to this question

Recommended Posts

  • 0

If it is an attribute, then it will just work, but I'm assuming you're trying to put it as text between tags:

<someXml>\a path\to\a\file</someXml>

In that case, you need to use a CDATA section.

<someXml>
<![CDATA[
	  \a path\to\a\file
   ]]>
</someXml>

  • 0
  $phinX said:

Ive found a couple of articles saying use: \ but that still errors.

LoL, just noticed that didnt come out... or it did... that backslash is actually a '&' followed by hex number, which obviously works for HTML but not XML.

  weenur said:

If it is an attribute, then it will just work, but I'm assuming you're trying to put it as text between tags:

Yeah im trying to up it between tags as text. Is CDATA the only way? There is no escape character sequence?

  • 0
  $phinX said:

LoL, just noticed that didnt come out... or it did... that backslash is actually a '&' followed by hex number, which obviously works for HTML but not XML.

Yeah im trying to up it between tags as text. Is CDATA the only way? There is no escape character sequence?

Wasn't really thinking, but you should be able to use the ASCII code equivalent.

& #92;

Gah! This is actually rendering the \ . lol It's ampersand, pound, ninety-two, and semicolon.

You may want to try using HttpServerUtility.HtmlEncode if you want to encode on the fly before you insert into a node's value.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • It's just exactly what it looks like. The facial polygon count is low and rigid, and the background appears heavily blurred. You can clearly see jagged edges around the car window as it exits the tunnel. The character animations feel like they're from 2010. The Xbox Series S has performance similar to an RX 570 or GTX 1660, which is disappointing and contributes to holding back game development. The Switch GPU is roughly on par with a 2050 or 3050, which is even worse. Developers have often discussed the challenges and limitations of developing for outdated/low end hardware, noting how it can hold back progress. This isn't a new issue. I am sure we will hear about the "Challenges" they had to overcome here and sacrifices that had to be made for compatibility with the outdated/low end hardware.
    • Whether on Edge or Firefox, I don't get this prompt to accept cookies, because they're already whitelisted by the Cookie AutoDelete extension, both on Edge and Firefox. And, as I've already said, using Edge (yesterday), Neowin isn't whitelisted (I never use Edge), and I didn't get that pop-up. And this morning, after checking, still no pop-up, and everything is activated, the proof (screenshot), I have no ads on the right side. I must add that I block the following trackers Doubleclick, and Scorecardresearch, as well as a few other undesirable ones, via the Host file. Back to square one! After all, it's a simple click to continue, so I'll do with it. 🤷🏽‍♂️ Thank You
    • F'ing FIIINALLY! Much easier to ask people what their hardware is 🙏 and could also very well just say DDR4 or DDR5 without asking to bloat it too much. I'm also curious to see what it will say in More device info...
    • Sure, that must be why it was revealed at the Sony showcase... the game was announced 5 years ago and the visuals are far from poor, what the hell are you smoking, plus the Switch 2 is pretty much on par with an Xbox Series S. It would be absolutely insane for a dev to build a game "with the Switch 2 in mind" when it's coming to all platforms where the majority of sales will happen.
  • Recent Achievements

    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
    • First Post
      James courage Tabla earned a badge
      First Post
    • Reacting Well
      James courage Tabla earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      400
    2. 2
      +FloatingFatMan
      178
    3. 3
      snowy owl
      170
    4. 4
      ATLien_0
      167
    5. 5
      Xenon
      134
  • Tell a friend

    Love Neowin? Tell a friend!