Reputation: 1510
I can't figure out how to get proper XML Structure for resources in Android.
I've saved recepies.xml into values folder, and would like to pars them.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recepies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<recepie name="recepie1">
<item></item>
<NumberOfPersons>1</NumberOfPersons>
<Ingredients>
<string></string>
<string></string>
</Ingredients>
<Preparation></Preparation>
<Energy>342</Energy>
<Protein>8</Protein>
<RecipeCategory>3</RecipeCategory>
</recepie>
But, I get or "Invalid start tag",
if I format it without recipies tag like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?>
I get, no more pseudo attributes allowed.
If I use only this:
<?xml version="1.0" encoding="UTF-8"?>
I get that markup is not well formed.
I guess I'm missing something in basics of XML formatting, but I can't figure out what.
Upvotes: 1
Views: 893
Reputation: 3772
/res/values
folder is only for android resources. You can only define one of these type of resources here.
http://developer.android.com/guide/topics/resources/available-resources.html
If you want your own xml file, place it in /assets
folder.
Upvotes: 4
Reputation: 17932
Your resources in values.xml must look like this
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name="string_name">text_string</string>
</resources>
You can check the documentation on string resources or on TypedArray to get more information.
Upvotes: 1