Reusing XPathLanguage
(This is more a question to Sascha Weinreuter than a general OpenAPI question)
Let's say I want to reuse (inject) the XPathLanguage into some custom language...
1) Is it possible?
2) It seems that XPathLanguage can provide completion for element and attribute
names from a given (queried) document.
How do I tell the language where to look (eg what xml document to use)
Regards,
Taras
ps IntelliLang looks very nice!
Please sign in to leave a comment.
Hello Taras,
Don't hesitate to email me directly ;)
Yes, absolutely.
This is done by an implementation of a special ContextProvider class that is
responsible for things like name-completion, error highlighting (variables,
namespaces), etc. The specific logic to learn all names from a given XML
document or XML schema/dtd is currently implemented in the XSLT support's
ContextProvider.
Unfortunately, the plugin repository refused to accept the source code last time
I tried to upload it, so I'm afraid it is not gonna be available publicly. But
I'll send you a copy via email later.
Sascha
Thanks :)
Hello Sascha,
>> 2) It seems that XPathLanguage can provide completion for element and
>> attribute names from a given (queried) document.
>> How do I tell the language where to look (eg what xml document to
>> use)
If I understand correctly, you're able to extract suggestions from just a
DTD/Schema as well?
Not to sound stupid, but isn't that quite complex? I mean in the context
of XSD schema, it can be pretty messy to find out whether a given element
is allowed at a given location.
Hello Taras,
It's not that clever. It just tries to extract all element/attribute names
that are mentioned in a schema with the help of XmlNSDescriptor and friends.
"Smart Completion" might come in the future though.
Sascha