Commit 5699fe470df543c800fa95fd67e815db8eff9c96
1 parent
85df15af
Changes for Ignoring Illegal character from xml (XMLTOJSON Utility)
Showing
1 changed file
with
15 additions
and
11 deletions
350-UTILITIES/Parser/XMLtoJSON_utility/XMLtoJSON_utility/Default.aspx.cs
... | ... | @@ -35,7 +35,11 @@ namespace XMLtoJSON_utility |
35 | 35 | FileUploader.SaveAs(Server.MapPath(DefaultFileName) + |
36 | 36 | FileUploader.FileName); |
37 | 37 | string path = Server.MapPath("~/Upload/" + FileUploader.PostedFile.FileName); |
38 | - doc.Load(path); | |
38 | + string encodedXml = System.Security.SecurityElement.Escape(path); | |
39 | + | |
40 | + StreamReader reader = new StreamReader(encodedXml, Encoding.ASCII); | |
41 | + | |
42 | + doc.Load(reader); | |
39 | 43 | txtXml.Text = doc.InnerXml; |
40 | 44 | string JSON = XmlToJSON(doc); |
41 | 45 | txtJson.Text = JSON; |
... | ... | @@ -158,16 +162,16 @@ namespace XMLtoJSON_utility |
158 | 162 | StringBuilder sbOut = new StringBuilder(sIn.Length); |
159 | 163 | foreach (char ch in sIn) |
160 | 164 | { |
161 | - if (Char.IsControl(ch) || ch == '\'') | |
162 | - { | |
163 | - int ich = (int)ch; | |
164 | - sbOut.Append(@"\u" + ich.ToString("x4")); | |
165 | - continue; | |
166 | - } | |
167 | - else if (ch == '\"' || ch == '\\' || ch == '/') | |
168 | - { | |
169 | - sbOut.Append('\\'); | |
170 | - } | |
165 | + //if (Char.IsControl(ch) || ch == '\'') | |
166 | + //{ | |
167 | + // int ich = (int)ch; | |
168 | + // sbOut.Append(@"\u" + ich.ToString("x4")); | |
169 | + // continue; | |
170 | + //} | |
171 | + //else if (ch == '\"' || ch == '\\' || ch == '/') | |
172 | + //{ | |
173 | + // sbOut.Append('\\'); | |
174 | + //} | |
171 | 175 | sbOut.Append(ch); |
172 | 176 | } |
173 | 177 | return sbOut.ToString(); | ... | ... |