Handling namespaced attribute in Code Inspections Follow
Answered
I'm running code inspection for an XML file and need to handle a namespaced attribute.
For this tag:
<tag1 ns:attr="value" />
I currently have
interface Tag1 : DomElement {
@get:Required
@get:Attribute("ns:attr")
val attr: GenericAttributeValue<String?>
}
But it errors out because com.intellij.util.xml.Attribute doesn't handle namespaces.
What's the right way to create the appropriate interface for Tag1?
Please sign in to leave a comment.
Specify com.intellij.util.xml.Namespace to specify namespace for given tag/attribute in DOM model.
Hi Yann, could you provide an example of what that would look like for an attribute?
I've tried
as well as a few other variants but I couldn't get it to work.
I've scoured code examples, but I've only seen Namespace used with tags and not with Attributes. Any additional guidance you can provide would be really helpful.
Yann Cebron Do you have any examples of com.intellij.util.xml.Namespace working on Attributes and not tags?
org.jetbrains.android.dom.AndroidAttributeValue
Thanks, Yann! That worked for attributes like "app:foobar" and "android:foobar"!
Great, thanks for the feedback