How can I get a XmlNode or AstNode using line/offset data?

SyntaxEditor for Silverlight Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0111
Avatar
I'm using the Silverlight SyntaxEditor with an XML document, and I'd like to be able to get the Xml node or an AstNode (using the editor's Document's XmlParseData).

Is there a mechanism that will return either if I provide the document's text and line/offset information? I tried using

parseData.Ast.FindChildNode(offset);
but that didn't seem to help as it only returned the top level node for the entire document.

Thanks,

-Craig

[Modified at 06/20/2011 05:45 PM]

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Craig,

That is correct... FindChildNode only scans through the direct children. We use a method internally that recurses the tree to find a descendant node and have been toying with making it public. We'll add an IAstNode.FindDescendantNode method for the next build that does this.


Actipro Software Support

Posted 13 years ago by Craig - Varigence, Inc.
Avatar
Is there an internal method in the current build that I could expose through reflection to get this behavior?
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Craig,

Sorry but no since it's obfuscated. It's just a recursive loop through, so you should be able to easily write a method that does it in a few lines of code, then switch to ours after next build.


Actipro Software Support

The latest build of this product (v18.1 build 0233) was released 4 years ago, which was after the last post in this thread.