Posted 16 years ago by Jim Ezzell
Version: 4.0.0262
Avatar
I am having a hard time figuring this out. I want to right-click an XML key, and pop a window with the attributes and text parameters. For example, I have a tag:
    <paragraph color="red">Test</paragraph>
I know that to get tag name I can use: (this returns "paragraph")
    string varname = editor.Document.GetSubstring(tok.TextRange);
How do I get the entire contents?

Comments (3)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You could call Document.GetTextStream at the offset and then use that to scan the token range between the < and > tokens. Read the token text as you scan through the tokens.


Actipro Software Support

Posted 16 years ago by Jim Ezzell
Avatar
Okay...I see that, and I can select the entire tag this way, but how do I see what it's parent tag is? Do I have to interate through the entire document?

For example if I have this:
<Document>
    <TagA></TagA>
    <TagB></TagB>
</Document>
How do I see that TagB is a child of Document?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok to do that, you can get an XmlContext via XmlSchemaResolver.GetContext. That object will contain information about the element you are at, along with the complete parent hierarchy.


Actipro Software Support

The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.