private void UpdatePlaceholder(ElementPlaceholder elementPlaceholder, ISegment originalTarget, ISegment originalSource, Stack <IAbstractMarkupDataContainer> containers) { var placeholder = GetElement(elementPlaceholder.TagId, originalTarget, originalSource, elementPlaceholder) ?? _segmentBuilder.CreatePlaceholder(elementPlaceholder.TagId, elementPlaceholder.TagContent); var container = containers.Peek(); container.Add(placeholder); }
private ElementPlaceholder ReadElementPlaceholder(XmlReader xmlReader) { var placeholder = new ElementPlaceholder(); var index = 0; while (xmlReader.Read()) { switch (xmlReader.NodeType) { case XmlNodeType.Element: if (index == 0 && string.Compare(xmlReader.Name, "ph", StringComparison.OrdinalIgnoreCase) == 0) { index++; while (xmlReader.MoveToNextAttribute()) { if (string.Compare(xmlReader.Name, "id", StringComparison.OrdinalIgnoreCase) == 0) { // for polyglot support, the segment id is represented by the trans-unit id placeholder.TagId = xmlReader.Value; } if (string.Compare(xmlReader.Name, "equiv-text", StringComparison.OrdinalIgnoreCase) == 0) { placeholder.DisplayText = xmlReader.Value; } } } break; case XmlNodeType.Whitespace: placeholder.TagContent += xmlReader.Value; break; case XmlNodeType.Text: placeholder.TagContent += xmlReader.Value; break; case XmlNodeType.CDATA: placeholder.TagContent += xmlReader.Value; break; case XmlNodeType.EntityReference: placeholder.TagContent += xmlReader.Name; break; } } return(placeholder); }
public void VisitPlaceholderTag(IPlaceholderTag placeholderTag) { if (_ignoreTags) { return; } var element = new ElementPlaceholder { TagId = placeholderTag.TagProperties.TagId.Id, TagContent = placeholderTag.TagProperties.TagContent, DisplayText = placeholderTag.TagProperties.DisplayText, TextEquivalent = placeholderTag.Properties.TextEquivalent }; Elements.Add(element); Text += placeholderTag.Properties.TagContent; }