2

I'm having some trouble loading the document (see link http://pastebin.com/FE3nDX9h) in pugixml.
I'm getting an error code of 16: No document element found which indicates that the XML file is invalid or empty which I think is neither.
I am using the default parsing method. Is there something I am missing?

edit: as requested heres some source code http://pastebin.com/USUjLC4q you will need to edit the paths.

user3102241
  • 487
  • 1
  • 7
  • 18

1 Answers1

7

You need xml_document::load_file but xml_document::load.

From pugi documentation:

There is also a simple helper function, xml_document::load, for cases when you want to load the XML document from null-terminated character string.

So, load's argument has to be xml by itself, not file name.

Evgeny Timoshenko
  • 3,119
  • 5
  • 33
  • 53
  • Thanks, that did the trick annoying how the little things just slip the mind. To anyone else reading this give johny an upvote! – user3102241 Jul 03 '14 at 11:15
  • 1
    "No document element found" error was added exactly because of load vs load_file confusion, so it works... In retrospect load should have been called load_string, but it's impossible to change at this moment :( – zeuxcg Jul 03 '14 at 15:10