Falsh Format XML & from c# -
hi everybody, can find solution problem, xml format & amp; want &, "12" , want 12, code:
static void main(string[] args) { string[] lines = file.readalllines(@"h:\epgvividtvaugust2017.csv", encoding.getencoding("windows-1252")); int id = 1; var doc = new xdocument( new xdeclaration("1.0", "utf-8", null), new xelement("event_information", new xattribute("data_set_type", "replace"), new xelement("service", new xattribute("name", "tv"), str in lines let columns = str.split(';') select new xelement("event", new xattribute("start", columns[0] + " " + columns [1]), // new xattribute("duration", columns[5]), new xelement("short-event-descriptor", new xattribute("language", "deu"), new xelement("name", columns[3]), new xelement("text", columns[4])), new xelement("extended-event-descriptor", new xattribute("language", "deu"), new xelement("text", columns[5])) //new xelement("parental_rating", //new xelement("contry", new xattribute("code", " "), new xattribute("rating", "15"))), //new xelement("content", //new xelement("content_nibbles", new xattribute("level_1", "1"), new xattribute("level_2" ,"8"), new xattribute("user_1", "0"), new xattribute("user_2", "0"))) ) ))); using (var writer = new xmltextwriter("h:\\xmlfile.xml", new utf8encoding(false))) { writer.formatting = formatting.indented; doc.save(writer); } }
as @cbroe wrote in comment, &
make xml display &
(see below code , image result in web browser).
<?xml version="1.0" encoding="utf-8"?> <event_information data_set_type="replace"> <service name="tv"> <event start="2017/07/31 23:00:30"> <short-event-descriptor language="deu"> <name>all & </name> <text></text> </short-event-descriptor> </event> </service> </event_information>
will result in :
when opened in web browser.
you might want open whole file in web browser , see if same applies 'problem' "12"
.
Comments
Post a Comment