0

I want to write a fb2 book parser. I am trying to parse it like xml in this way:

XmlDocument doc = new XmlDocument();
doc.Load("file name");

foreach(XmlNode item in doc.DocumentElement.ChildNodes)
{
    using(StreamWriter sw=new StreamWriter("text.txt"))
    {
        sw.WriteLine(item.InnerText);
    }
}

But I'm getting unreadable set of letters. Also I have a question: If the book contains an image, how should I get it correctly?

demonplus
  • 5,613
  • 12
  • 49
  • 68
IceStrength
  • 83
  • 1
  • 1
  • 5
  • have you read this? http://gribuser.ru/xml/fictionbook/index.html.en – Sebastian L May 15 '17 at 11:33
  • The image needs to be convert to a string. An image consists of binary (0x00 - 0xFF) and not all binary characters are ASCII Text. So you need to use Convert.ToBase64String(). – jdweng May 15 '17 at 11:47

0 Answers0