
We recently purchased the Web languages add-on, primarily for schema supported XML editing. Part of our application generates new XmlElements (as part of an underlying XmlDocument) and I need to be able to dynamically insert the new elements into the text representation to synchronise both data stores.
Currently, Im trying to perform the element addition by inserting the XmlElement.OuterXml text into the current document, so I look for the last index of the </ which is the outermost closing element. Im not sure if I have come across a bug or if im doing something incorrectly, but it seems to work ok the first time, but everytime afterwards inserts the text into the wrong positionIs there a better way for performing this sync? I briefly looked into the AstNode documentation and it looked like it may be useful for this purpose?
Currently, Im trying to perform the element addition by inserting the XmlElement.OuterXml text into the current document, so I look for the last index of the </ which is the outermost closing element. Im not sure if I have come across a bug or if im doing something incorrectly, but it seems to work ok the first time, but everytime afterwards inserts the text into the wrong position
_SyntaxEditor.Document.InsertText(DocumentModificationType.Custom, _SyntaxEditor.Document.Text.LastIndexOf("</") - 2, xml);