I wrote this little piece of Linq , it may not be very resilient against missing levels/elements.
var doc = XElement.Load(fileName);
Dictionary<string, string> dic = doc
.Descendants("Documentid")
.ToDictionary(e => e.Value,
e => e.Parent.Parent.Parent.Element("Documentcode").Value );
// verify
Console.WriteLine(dic["12"]);
Console.WriteLine(dic["25"]);