Parse a XSD to get allowed elements

SyntaxEditor Web Languages Add-on for WPF Forum

Posted 2 years ago by Estelle Pflieger
Version: 17.1.0651
Avatar

Hi,

I'm using the SyntaxEditor XML Add-On, i would like to know if there are accessible methods to parse a Schema (XSD) to get allowed elements at a given position in a XML document ?

(For example, a method to get the list of elements returned by the word completion tool of the XML Editor)

thank you for your reply.
Best regards

Comments (1)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You can do code like this (which is what we do in our completion provider):

IXmlContext context = new XmlContextFactory().CreateContext(view.Selection.EndSnapshotOffset);

That gives you a context object that provides information about what is at the caret location in the view.  Based on that information, we have logic in our completion provider that builds up the list of items to show in the completion list.  But the context should contain the XmlSchemaElement's in the hierarchy and the current one, exposed via IXmlElementContext objects.


Actipro Software Support

The latest build of this product (v2019.1 build 0682) was released 3 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.