narayanpatra
narayanpatra

Reputation: 5691

What is wrong with this XML code?

I got this piece of code from a book viz. "sams teach yourself android application development in 24 hours." This is a layout of a main Menu.

   <TextView 
    xmlns:android=”http://schemas.android.com/apk/res/android” 
    android:layout_width=”fill_parent” 
    android:textSize=”@dimen/menu_item_size” 
    android:text=”test string” 
    android:layout_gravity=”center_horizontal” 
    android:layout_height=”wrap_content” 
    android:shadowRadius=”5” 
    android:gravity=”center” 
    android:textColor=”@color/menu_color” 
    android:shadowColor=”@color/menu_glow” 
    android:shadowDy=”3” 
    android:shadowDx=”3” />

I tried this code in Droid draw. It's showing the error "Open qoute is expected for attribute"{1}" associated with an element type "xmlns:android"". I am very new to Android and Java. Can anybody please tell me how to solve this error? Thanks in advance.(I am sing eclipse in win 7.)

EDIT : I understood. ” this type of quote was creating problem. I replaced with ". But now it is showing "Error no layout". Can anybody check the code please?

Upvotes: 0

Views: 3261

Answers (5)

sergeytch
sergeytch

Reputation: 161

Have you tried using correct quotes: " instead of ” ?

Upvotes: 0

Daniel Engmann
Daniel Engmann

Reputation: 2850

I think your is not correct. It should be ". This could happen when you copy code from a pdf or a website.

Upvotes: 1

redGREENblue
redGREENblue

Reputation: 3126

Can you post a little more details, perhaps a few lines of the code. I think it is because you may have just copy pasted the code and sometimes the editor would confuse the quote"". Just delete the lines you are getting error in and type it in manually. It may solve the problem. Also check if you have implemented "" properly (open/close). If it doesn't solve it, then it will be easy if you post the code so I can have a look.

Edit: Okay, The problem is the code you are using. Instead of using

xmlns:android=”http://schemas.android.com/apk/res/android” 

Use,

xmlns:android="http://schemas.android.com/apk/res/android" 

Notice the different quote in these two lines. That is the standard quote. Like I said, it happens mainly when you copy paste a code. So, just type it in manually, it will work.

On the second error: Have you created all the @color, @dimen resources that you are referring to?

Upvotes: 5

user634618
user634618

Reputation: 3593

It seems to me you are not using the standard double-quote character ", instead something else:

Upvotes: 4

d-live
d-live

Reputation: 8036

Looks like this is a general xml validation error having nothing to do with andriod platform. There may be some extra quote somewhere you need to find and remove.

Upvotes: 0

Related Questions