What I'm doing here is converting the omnipage xml to alto xml. So I decided to use C#.
And here is my sample XML file
<wd l="821" t="283" r="1363" b="394">
<ch l="821" t="312" r="878" b="394" conf="158">n</ch>
<ch l="888" t="312" r="950" b="394" conf="158">o</ch>
<ch l="955" t="283" r="979" b="394" conf="158">i</ch>
<ch l="989" t="312" r="1046" b="394" conf="158">e</ch>
<ch l="1051" t="312" r="1147" b="394" conf="158">m</ch>
<ch l="1157" t="283" r="1219" b="394" conf="158">b</ch>
<ch l="1224" t="312" r="1267" b="394" conf="198">r</ch>
<ch l="1267" t="283" r="1296" b="394" conf="198">i</ch>
<ch l="1306" t="312" r="1363" b="394" conf="158">e</ch>
</wd>
And here is my code
XDocument document = XDocument.Load(fileName);
var coordinates = from r in document.Descendants("wd").ToList().Where
(r => (string)r.Attribute("l") != "")
select new
{
left = r.Attribute("l").Value,
};
foreach (var item in coordinates)
{
Console.WriteLine(item.left);
}
Console.ReadLine();
My question is, it works when I use a simple XML like in the above, but when I use a long XML like this in the link
http://pastebin.com/LmDHRzC5
it doesn't work?
But it also has a wd
tag and it also has a L
attribute.
Thank you. I paste the long XML in the pastebin because its too long.