Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:04:15+00:00 2026-06-15T18:04:15+00:00

I’m using XmlTextWriter to generate XML from a C# app. The initial input will

  • 0

I’m using XmlTextWriter to generate XML from a C# app. The initial input will be in this format, 1″ , but I can replace it with whatever. I need to end up with 1" but I keep getting 1"

C#

    xml.WriteStartElement("data");
    xml.WriteAttributeString("type", "wstring");
    xml.WriteString("1"");
    xml.WriteEndElement();

Ha! When I past the XML I need in here it converts it to 1″. But whats I really need to show is the actual 1" in the 3rd line of the code.

I also need to use / and Ø. How can I do this, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:04:17+00:00Added an answer on June 15, 2026 at 6:04 pm

    I need to end up with 1" but I keep getting 1"

    That’s because you’re trying to do the XML API’s job for it.

    Your job is to provide just text – its job is to handle escaping and anything else XML needs to do.

    So you should just use

    xml.WriteString("1\"");
    

    … where the backslash is just for the sake of C#’s string literal handling, and has nothing to do with XML. The logical value you’re trying to write out is a 1 followed by a double-quote. Whether it’s escaped as " or not should be irrelevant to anything processing it. If you’ve got something which is over-sensitive, you should fix that.

    If you desperately need this (and I would again strongly urge you not to), try:

    xml.WriteString("1");
    xml.WriteEntityRef("quot");
    

    (I’d also urge you to use LINQ to XML unless you’re in a situation where you really need to use XmlWriter. It’ll make your life significantly simpler.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
For some reason, after submitting a string like this Jack’s Spindle from a text
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am using Paperclip to handle profile photo uploads in my app. They upload
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.