Code my own xml intellisense

B

Bill

Are there .NET classes for rolling your own xml intellisense based on
an xml schema? Suppose one wanted to write an application in which the
user supplies the xml and a schema and the application lists the
schema-based rules for each xml element. What classes would facilitate
that? The application would have to handle any xml/schema the user
provides. I know I could read the schema and search for the element,
but what if the element occurs at different depths and the schema
rules are different for each depth -can the correct one be determined?

Bill
 
P

Pavel Minaev

Are there .NET classes for rolling your own xml intellisense based on
an xml schema? Suppose one wanted to write an application in which the
user supplies the xml and a schema  and the application lists the
schema-based rules for each xml element. What classes would facilitate
that? The application would have to handle any xml/schema the user
provides. I know I could read the schema and search for the element,
but what if the element occurs at different depths and the schema
rules are different for each depth -can the correct one be determined?

Have a look at XmlSchemaValidator.GetExpectedParticles &
GetExpectedAttributes methods.
 
B

Bill

XmlSchemaValidator appears to work in the opposite direction of what I
want -it gives the valid xml elements for a given schema item. I want
to supply the name of an xml element and get a list of all the schema
items that pertain to it.

Bill
 
P

Pavel Minaev

XmlSchemaValidator appears to work in the opposite direction of what I
want -it gives the valid xml elements for a given schema item.

The specific methods that I've posted to you allow you to determine,
at any given position in the XML file (e.g. where the user's cursor
currently is), what elements and attributes can legally (according to
the schema) follow. My impression was that it is what you want when
you speak of intellisense, since that's how all XML editors that I've
seen do that.
I want
to supply the name of an xml element and get a list of all the schema
items that pertain to it.

If that is not the same thing as what I'm talking about above, then
can you please explain (preferably with an example - i.e. "given this
schema and this XML, I expect to get this") what exactly this means?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top