Dear Community members,
I am developing a bilingual file type. In the Sample BIL parser, the "CreateSegment" function is implemented as follows:
private ISegment CreateSegment(XmlNode seg, ISegmentPairProperties pair)
{
ISegment segment = ItemFactory.CreateSegment(pair);
foreach (XmlNode item in seg.ChildNodes)
{
if (item.NodeType == XmlNodeType.Text)
{
segment.Add(CreateText(item.InnerText));
}
if (item.NodeType == XmlNodeType.Element)
{
segment.Add(CreateTagPair(item));
}
}
return segment;
}
How should I proceed if I want to re-use this same function in the CreateTagPair function, if I detect that the tagpair contains further tags for example.
Currently, I just copied/pasted the code but this is not nice and I would prefer if I could use the same function for both calls. Should I use a IMarkupDataContainer? If yes, how should I declare it? How can I convert it back to ISegment or insert it in my tagpair?
Thanks in advance for your support.
Regards,
Laurent