Live AuthorNode offset values.
Posted: Wed Nov 18, 2009 5:22 pm
Hi,
I have a search component I am building. It searches through the document for text strings that match a cerai regular expression, and then stores the AuthorNode in which the match occurs and the offset from the start of the node to the start of the matching text. This way I can find the node and the text inside the node.
A second function allows user to replace wcah of these search results with new XML. e.g. replace text that looks like a URL with a <xref> element. This function simply loops through the search results and creates an approipriate XML fragement, and then replaces the old text with the new XML. Unfortunately after the first such insert the offsets to all the susequent cached AuthorNodes is incorrect. This, I assume, is due the AuthorNodes not being 'backed' by the document model, so chnages to the document model are not reflceted in all live AuthorNode instances.
Is this something that should be happending, if so what might I being doing wrong that is preventing this updating, and if it's working as intended, is there a way to get an updated instance of an AuthorNode given an out of date instance?
Many Thanks,
Simon.
I have a search component I am building. It searches through the document for text strings that match a cerai regular expression, and then stores the AuthorNode in which the match occurs and the offset from the start of the node to the start of the matching text. This way I can find the node and the text inside the node.
A second function allows user to replace wcah of these search results with new XML. e.g. replace text that looks like a URL with a <xref> element. This function simply loops through the search results and creates an approipriate XML fragement, and then replaces the old text with the new XML. Unfortunately after the first such insert the offsets to all the susequent cached AuthorNodes is incorrect. This, I assume, is due the AuthorNodes not being 'backed' by the document model, so chnages to the document model are not reflceted in all live AuthorNode instances.
Is this something that should be happending, if so what might I being doing wrong that is preventing this updating, and if it's working as intended, is there a way to get an updated instance of an AuthorNode given an out of date instance?
Many Thanks,
Simon.