Class PlainTextExtractionVisitor
Visitor implementation that can be used to build a plain text representation from editor nodes.
Inheritance
Inherited Members
Namespace: Sdl.DesktopEditor.EditorApi.Implementation
Assembly: Sdl.DesktopEditor.EditorApi.dll
Syntax
public class PlainTextExtractionVisitor : INodeVisitor
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
Constructors
PlainTextExtractionVisitor()
Use a new string builder for the result.
Declaration
public PlainTextExtractionVisitor()
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
PlainTextExtractionVisitor(StringBuilder)
Append text to an existing string builder.
Declaration
public PlainTextExtractionVisitor(StringBuilder appendResultTo)
Parameters
Type | Name | Description |
---|---|---|
StringBuilder | appendResultTo |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
Properties
AppendLineBreakForSegments
When true
a line break will be appended for every segment end
Used when copying
When false
no text is appended for segments.
Declaration
public bool AppendLineBreakForSegments { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
AppendTextEquivalentForPlaceholders
When true
placeholder tags will yield text
corresponding to their TextEquivalent property.
When false
no text is appended for placeholder tags.
Declaration
public bool AppendTextEquivalentForPlaceholders { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
Result
The resulting string.
Declaration
public StringBuilder Result { get; set; }
Property Value
Type | Description |
---|---|
StringBuilder |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
Methods
VisitBookmarkNode(IBookmarkNode)
Do nothing.
Declaration
public void VisitBookmarkNode(IBookmarkNode node)
Parameters
Type | Name | Description |
---|---|---|
IBookmarkNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitCommentContainerNode(ICommentContainerNode)
Do nothing.
Declaration
public void VisitCommentContainerNode(ICommentContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
ICommentContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitCommentMarker(ICommentMarker)
Do nothing.
Declaration
public void VisitCommentMarker(ICommentMarker commentMarker)
Parameters
Type | Name | Description |
---|---|---|
ICommentMarker | commentMarker |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitDocumentContainerNode(IDocumentContainerNode)
Do nothing.
Declaration
public void VisitDocumentContainerNode(IDocumentContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
IDocumentContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitFileContainerNode(IFileContainerNode)
Do nothing.
Declaration
public void VisitFileContainerNode(IFileContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
IFileContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitLocationMarker(ILocationMarker)
Do nothing.
Declaration
public void VisitLocationMarker(ILocationMarker location)
Parameters
Type | Name | Description |
---|---|---|
ILocationMarker | location |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitLocationMarkerNode(ILocationMarkerNode)
Do nothing.
Declaration
public void VisitLocationMarkerNode(ILocationMarkerNode node)
Parameters
Type | Name | Description |
---|---|---|
ILocationMarkerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitLockedContent(ILockedContent)
Visit all locked items.
Declaration
public void VisitLockedContent(ILockedContent lockedContent)
Parameters
Type | Name | Description |
---|---|---|
ILockedContent | lockedContent |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitLockedContentContainerNode(ILockedContentContainerNode)
Visit the locked content.
Declaration
public void VisitLockedContentContainerNode(ILockedContentContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
ILockedContentContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitMarkerContainerNode(IOtherMarkerContainerNode)
Do nothing.
Declaration
public void VisitMarkerContainerNode(IOtherMarkerContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
IOtherMarkerContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitNode(IAbstractContentNode)
Cast the node to a framework node and visit it.
Declaration
public void VisitNode(IAbstractContentNode node)
Parameters
Type | Name | Description |
---|---|---|
IAbstractContentNode | node |
Remarks
This approach is convenient when used with the content node iterator.
VisitOtherMarker(IOtherMarker)
Do nothing.
Declaration
public void VisitOtherMarker(IOtherMarker marker)
Parameters
Type | Name | Description |
---|---|---|
IOtherMarker | marker |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitParagraphUnitContainerNode(IParagraphUnitContainerNode)
Do nothing.
Declaration
public void VisitParagraphUnitContainerNode(IParagraphUnitContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
IParagraphUnitContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitPlaceholderTag(IPlaceholderTag)
Append text for the placeholder, depending on settings.
Declaration
public virtual void VisitPlaceholderTag(IPlaceholderTag tag)
Parameters
Type | Name | Description |
---|---|---|
IPlaceholderTag | tag |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitPlaceholderTagNode(IPlaceholderTagNode)
Append text for the placeholder, depending on settings.
Declaration
public void VisitPlaceholderTagNode(IPlaceholderTagNode node)
Parameters
Type | Name | Description |
---|---|---|
IPlaceholderTagNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitRevisionMarker(IRevisionMarker)
Do nothing.
Declaration
public void VisitRevisionMarker(IRevisionMarker revisionMarker)
Parameters
Type | Name | Description |
---|---|---|
IRevisionMarker | revisionMarker |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitRevisionMarkerContainerNode(IRevisionMarkerContainerNode)
Do nothing.
Declaration
public void VisitRevisionMarkerContainerNode(IRevisionMarkerContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
IRevisionMarkerContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitSegment(ISegment)
Do nothing here: since the typical use case for this class is to be used with a ContentNodeIterator we should handle segments in VisitStartEndNode.
Declaration
public void VisitSegment(ISegment segment)
Parameters
Type | Name | Description |
---|---|---|
ISegment | segment |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitSegmentContainerNode(ISegmentContainerNode)
Do nothing.
Declaration
public void VisitSegmentContainerNode(ISegmentContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
ISegmentContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitStartEndNode(IStartEndNode)
Do nothing unless we have a segment container node: if we do we may want to insert a line break.
Declaration
public void VisitStartEndNode(IStartEndNode node)
Parameters
Type | Name | Description |
---|---|---|
IStartEndNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitTagPair(ITagPair)
Do nothing.
Declaration
public void VisitTagPair(ITagPair tagPair)
Parameters
Type | Name | Description |
---|---|---|
ITagPair | tagPair |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitTagPairContainerNode(ITagPairContainerNode)
Do nothing.
Declaration
public void VisitTagPairContainerNode(ITagPairContainerNode node)
Parameters
Type | Name | Description |
---|---|---|
ITagPairContainerNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitText(IText)
Append text to the result.
Declaration
public void VisitText(IText text)
Parameters
Type | Name | Description |
---|---|---|
IText | text |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.
VisitTextNode(ITextNode)
Append text to the result.
Declaration
public void VisitTextNode(ITextNode node)
Parameters
Type | Name | Description |
---|---|---|
ITextNode | node |
Remarks
Typically used together with a ContentNodeIterator to extract text content from a range in a document.
To use, call VisitNode(IAbstractContentNode) for a single content node to be processed, or pass this object to AcceptNodeVisitor(INodeVisitor) for the node to be processed.