Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XmlAttribute creation problem

Status
Not open for further replies.

euntair

Programmer
Joined
Sep 13, 2007
Messages
53
Location
US
The code below is placing \ in front of all quotation marks. Is there a way to keep this from happening or remove them?

<system-page>
<name>first_1</name>
</system-page>


XmlDocument xd = new XmlDocument();

xd.LoadXml("<system-page><name>first_1</name></system-page>");

XmlNode xn = xd.SelectSingleNode("system-page");

XmlNode xn_attribute = xn.SelectSingleNode("name");

XmlAttribute xa = xd.CreateAttribute(xn_attribute.Name);

xa.InnerText = xn_attribute.InnerText;

xn.Attributes.Append(xa);


<system-page name=\"[/color red]first_1\"[/color red]><name>first_1</name></system-page>
 
when you say "is placing" do you mean in the output xml, or in the debugger watch window?

if it's the former you've got a problem.

if, as i suspect, it's the latter, it's just the way that visual studio displays them. get used to it, it's not going to change.


mr s. <;)

 
if you open the output xml in notepad, you can see the slashes?


mr s. <;)

 
I do/did. It turned out that I had messed up the line below what I included above. Thanks for helping. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top