خرید بک لینک

Vote count: 0

This question is the continuation of this page

PROCESS: The process involved, Opening XML file and do some modification in specific nodes and save it back to another location.

PROBLEM FACING: While Saving after some modifications in XML, unsupported entity references like ö converted into ö. I want to retain the entity as it is in the source (ö)

As ö and ö are same character but i need to retain as it is in source xml.

XML SOURCE

<?xml version="1.0" encoding="US-ASCII"?>
<heads>
    <head type="TRANSFER">
        <headtext xml:lang="ENG" original="y">My Name &#x00F6;is Sinthiya</headtext>
    </head>
</heads>

EXPECTED OUTPUT

<?xml version="1.0" encoding="US-ASCII"?>
<heads>
    <head type="TRANSFER">
        <headtext xml:lang="ENG" original="y">My Name &#x00F6;is Sinthiya</headtext>
    </head>
</heads>

GETTING RIGHT NOW

<?xml version="1.0" encoding="US-ASCII"?>
<heads>
    <head type="TRANSFER">
        <headtext xml:lang="ENG" original="y">My Name &#xF6;is Sinthiya</headtext>
    </head>
</heads>

My Code

string path = @"C:workmyxml.XML";
string pathnew = @"C:workmyxml_new.XML";
XmlDocument doc = new XmlDocument();
doc.Load(path);
using (var writer = XmlWriter.Create(pathnew, new XmlWriterSettings { Indent= true, Encoding = Encoding.ASCII }))
{
    doc.Save(writer);
}

asked 5 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 22 ارديبهشت 1395 ساعت: 18:05

صفحه بندی