I am almost finished writing a simple android application which seems to be working well. However, when I run a code analysis I am getting around 100 warnings regarding xml files The error I am recieving is 'Unbound XML namespace prefix' and 'Namespace is not bound'
here is a small sample from 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 have googled this problem but I cant seem to find an explanation. I amn't sure whether this problem is just so elementary that the solution should be common sense or if this is an obscure uncommon problem
You haven't named the package or program that generated the "Unbound XML namespace prefix" warning, so it's difficult to pinpoint the problem. In general terms, however, the warning suggests that the program is complaining about what look like namespace prefixed XML names, perhaps especially in attribute values. Such as "android:Widget.TextView" or "android:background". This is simply an annoyance from an overenthusiastic (if not actually broken) code checker.
There is nothing wrong with your example per se, but the overenthusiasm here does have some basis. There are applications where "qnames", as they are called, can appear in attribute values or text content. (An example quite often found in schema specs: 'xsi:type="xs:string"'.) Here, the warning would have been "correct" if a qname were intended, but the checker has no means of knowing that.
You're best off investigating whether the checker offers an option to suppress this particular "check".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With