Created
April 6, 2015 16:40
-
-
Save witoong623/6ed4d355b0b4fc18b6f3 to your computer and use it in GitHub Desktop.
the code that use for load xml file with specific encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.IO; | |
using System.Xml; | |
namespace testParseXml1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.OutputEncoding = Encoding.UTF8; | |
Parse(); | |
Console.ReadKey(); | |
} | |
private static void Parse() | |
{ | |
var doc = new XmlDocument(); | |
string xmlText = File.ReadAllText("kanjidic2.xml", Encoding.Default); | |
doc.LoadXml(xmlText); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try putting try/catch around the doc.LoadXml() method and checking the exception.