-
Notifications
You must be signed in to change notification settings - Fork 153
Closed
Description
We translated some html files with MS document translators, all html files are well-formed, but translation of some html files failed with error message: Error while processing document: xxxx.html Object reference not set to an instance of an object.
Here is the example file which failed to be translated.
The sample file is a little complicated, we created a small one to reproduce the error.
if
While if we put some text between
and
we don't know why, but we are wondering if something wrong with the code below:
private static void AddNodes(HtmlNode rootnode, ref List<HtmlNode> nodes)
{
string[] DNTList = { "script", "#text", "code", "col", "colgroup", "embed", "em", "#comment", "image", "map", "media", "meta", "source", "xml"}; //DNT - Do Not Translate - these nodes are skipped.
HtmlNode child = rootnode;
while (child != rootnode.LastChild)
{
if (!DNTList.Contains(child.Name.ToLowerInvariant())) {
if (child.InnerHtml.Length > maxRequestSize)
{
AddNodes(child.FirstChild, ref nodes);
}
else
{
if (child.InnerHtml.Trim().Length != 0) nodes.Add(child);
}
}
child = child.NextSibling;
}
}
Sorry that i failed to upload the sample files, either in html or in .docx format.
Has someone met the similar issue with MS document translator? And does anyone know how to fix this issue? Many thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels