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!


3 comments

Hello Taras,

(This is more a question to Sascha Weinreuter than a general OpenAPI
question)


Don't hesitate to email me directly ;)

Let's say I want to reuse (inject) the XPathLanguage into some custom
language...
1) Is it possible?


Yes, absolutely.

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)


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

ps IntelliLang looks very nice!


Thanks :)

0

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)

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.


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.


0

Hello Taras,

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.


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

0

Please sign in to leave a comment.