Java – why do I receive this error “unbound XML namespace prefix”

I almost wrote a simple Android application that seems to work well

This is a small sample in one of my XML files:`

<style name="dialog_title_style" parent="android:Widget.TextView">
    <item name="android:background">@android:color/black</item>
    <item name="android:padding">10dp</item>
</style>

<style name="MySpinnerLook"
       parent="@android:style/TextAppearance.Widget.TextView.SpinnerItem">
    <item name="android:textSize">40dp</item>
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:text">Currency</item>

</style>

`

I searched the question, but I couldn't seem to find an explanation I'm not sure whether the problem is so simple that the solution should be common sense, or it's a vague and uncommon problem

Solution

You have not named the package or program that generated the unbound XML namespace prefix warning, so it is difficult to determine the problem In general, however, the warning indicates that the program complains about XML names with namespace prefixes, especially in attribute values Such as "Android: widget. Textview" or "Android: background" This is just an annoyance of an overly intense (if not actual) code checker

There is nothing wrong with your example itself, but there is some basis for excessive enthusiasm here Some applications can call "QNames" in them, which can appear in attribute values or text contents. (an example that often appears in the Schema Specification: 'XSI: type = "XS: string"'.) Here, if you intend to use QName, the warning will be "correct", but the inspector cannot know this

You'd better investigate whether the checker provides an option to suppress this particular "check"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>