Android: attribute type is required in declaration of “CDATA”
First error solved, please read my comment on Daniel Haley's answer.
I pretty new to Android developing and used changed the size of a picture in a layout XML file.
Since then im always getting this error:
Error:(1, 151) The attribute type is required in the declaration of attribute "CDATA" for element "LinearLayoutxmlns:android".
And I have no idea, what it's telling me... Google only seems to give me very few results all with similar code.
Here is the content of my XML file:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayoutxmlns:android CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:gravity CDATA #REQUIREDandroid:orientation CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingLeft CDATA #REQUIREDandroid:paddingRight CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageViewandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextViewandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginLeft CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:text CDATA #REQUIREDandroid:textSize CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
android dtd cdata
add a comment |
First error solved, please read my comment on Daniel Haley's answer.
I pretty new to Android developing and used changed the size of a picture in a layout XML file.
Since then im always getting this error:
Error:(1, 151) The attribute type is required in the declaration of attribute "CDATA" for element "LinearLayoutxmlns:android".
And I have no idea, what it's telling me... Google only seems to give me very few results all with similar code.
Here is the content of my XML file:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayoutxmlns:android CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:gravity CDATA #REQUIREDandroid:orientation CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingLeft CDATA #REQUIREDandroid:paddingRight CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageViewandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextViewandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginLeft CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:text CDATA #REQUIREDandroid:textSize CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
android dtd cdata
add a comment |
First error solved, please read my comment on Daniel Haley's answer.
I pretty new to Android developing and used changed the size of a picture in a layout XML file.
Since then im always getting this error:
Error:(1, 151) The attribute type is required in the declaration of attribute "CDATA" for element "LinearLayoutxmlns:android".
And I have no idea, what it's telling me... Google only seems to give me very few results all with similar code.
Here is the content of my XML file:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayoutxmlns:android CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:gravity CDATA #REQUIREDandroid:orientation CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingLeft CDATA #REQUIREDandroid:paddingRight CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageViewandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextViewandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginLeft CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:text CDATA #REQUIREDandroid:textSize CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
android dtd cdata
First error solved, please read my comment on Daniel Haley's answer.
I pretty new to Android developing and used changed the size of a picture in a layout XML file.
Since then im always getting this error:
Error:(1, 151) The attribute type is required in the declaration of attribute "CDATA" for element "LinearLayoutxmlns:android".
And I have no idea, what it's telling me... Google only seems to give me very few results all with similar code.
Here is the content of my XML file:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayoutxmlns:android CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:gravity CDATA #REQUIREDandroid:orientation CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingLeft CDATA #REQUIREDandroid:paddingRight CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageViewandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextViewandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginLeft CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:text CDATA #REQUIREDandroid:textSize CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
android dtd cdata
android dtd cdata
edited Nov 13 '18 at 6:45
Twisterado
asked Nov 12 '18 at 22:23
TwisteradoTwisterado
85
85
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In the attlist declarations, your attribute names aren't separated by spaces.
For example LinearLayoutxmlns:android
(from the error message) should be LinearLayout xmlns:android
.
Another example is #REQUIREDandroid:layout_width
should be #REQUIRED android:layout_width
.
Here's a version with the attlist declarations fixed.
It validates now but since I don't know anything about android development I don't know what changes you made and if they're going to work the way you intended.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [
<!ELEMENT LinearLayout (ImageView|TextView)*>
<!ATTLIST LinearLayout
xmlns:android CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:background CDATA #REQUIRED
android:gravity CDATA #REQUIRED
android:orientation CDATA #REQUIRED
android:paddingBottom CDATA #REQUIRED
android:paddingLeft CDATA #REQUIRED
android:paddingRight CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:theme CDATA #REQUIRED>
<!ELEMENT ImageView (#PCDATA)>
<!ATTLIST ImageView
android:id CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:src CDATA #REQUIRED>
<!ELEMENT TextView (#PCDATA)>
<!ATTLIST TextView
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:layout_gravity CDATA #REQUIRED
android:layout_marginLeft CDATA #REQUIRED
android:layout_marginTop CDATA #REQUIRED
android:text CDATA #REQUIRED
android:textSize CDATA #REQUIRED
android:textStyle CDATA #REQUIRED>
]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Here's another version with the doctype declaration all on one line like the original:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayout xmlns:android CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:background CDATA #REQUIRED android:gravity CDATA #REQUIRED android:orientation CDATA #REQUIRED android:paddingBottom CDATA #REQUIRED android:paddingLeft CDATA #REQUIRED android:paddingRight CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageView android:id CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextView android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:layout_gravity CDATA #REQUIRED android:layout_marginLeft CDATA #REQUIRED android:layout_marginTop CDATA #REQUIRED android:text CDATA #REQUIRED android:textSize CDATA #REQUIRED android:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270966%2fandroid-attribute-type-is-required-in-declaration-of-cdata%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the attlist declarations, your attribute names aren't separated by spaces.
For example LinearLayoutxmlns:android
(from the error message) should be LinearLayout xmlns:android
.
Another example is #REQUIREDandroid:layout_width
should be #REQUIRED android:layout_width
.
Here's a version with the attlist declarations fixed.
It validates now but since I don't know anything about android development I don't know what changes you made and if they're going to work the way you intended.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [
<!ELEMENT LinearLayout (ImageView|TextView)*>
<!ATTLIST LinearLayout
xmlns:android CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:background CDATA #REQUIRED
android:gravity CDATA #REQUIRED
android:orientation CDATA #REQUIRED
android:paddingBottom CDATA #REQUIRED
android:paddingLeft CDATA #REQUIRED
android:paddingRight CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:theme CDATA #REQUIRED>
<!ELEMENT ImageView (#PCDATA)>
<!ATTLIST ImageView
android:id CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:src CDATA #REQUIRED>
<!ELEMENT TextView (#PCDATA)>
<!ATTLIST TextView
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:layout_gravity CDATA #REQUIRED
android:layout_marginLeft CDATA #REQUIRED
android:layout_marginTop CDATA #REQUIRED
android:text CDATA #REQUIRED
android:textSize CDATA #REQUIRED
android:textStyle CDATA #REQUIRED>
]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Here's another version with the doctype declaration all on one line like the original:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayout xmlns:android CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:background CDATA #REQUIRED android:gravity CDATA #REQUIRED android:orientation CDATA #REQUIRED android:paddingBottom CDATA #REQUIRED android:paddingLeft CDATA #REQUIRED android:paddingRight CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageView android:id CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextView android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:layout_gravity CDATA #REQUIRED android:layout_marginLeft CDATA #REQUIRED android:layout_marginTop CDATA #REQUIRED android:text CDATA #REQUIRED android:textSize CDATA #REQUIRED android:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
add a comment |
In the attlist declarations, your attribute names aren't separated by spaces.
For example LinearLayoutxmlns:android
(from the error message) should be LinearLayout xmlns:android
.
Another example is #REQUIREDandroid:layout_width
should be #REQUIRED android:layout_width
.
Here's a version with the attlist declarations fixed.
It validates now but since I don't know anything about android development I don't know what changes you made and if they're going to work the way you intended.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [
<!ELEMENT LinearLayout (ImageView|TextView)*>
<!ATTLIST LinearLayout
xmlns:android CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:background CDATA #REQUIRED
android:gravity CDATA #REQUIRED
android:orientation CDATA #REQUIRED
android:paddingBottom CDATA #REQUIRED
android:paddingLeft CDATA #REQUIRED
android:paddingRight CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:theme CDATA #REQUIRED>
<!ELEMENT ImageView (#PCDATA)>
<!ATTLIST ImageView
android:id CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:src CDATA #REQUIRED>
<!ELEMENT TextView (#PCDATA)>
<!ATTLIST TextView
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:layout_gravity CDATA #REQUIRED
android:layout_marginLeft CDATA #REQUIRED
android:layout_marginTop CDATA #REQUIRED
android:text CDATA #REQUIRED
android:textSize CDATA #REQUIRED
android:textStyle CDATA #REQUIRED>
]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Here's another version with the doctype declaration all on one line like the original:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayout xmlns:android CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:background CDATA #REQUIRED android:gravity CDATA #REQUIRED android:orientation CDATA #REQUIRED android:paddingBottom CDATA #REQUIRED android:paddingLeft CDATA #REQUIRED android:paddingRight CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageView android:id CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextView android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:layout_gravity CDATA #REQUIRED android:layout_marginLeft CDATA #REQUIRED android:layout_marginTop CDATA #REQUIRED android:text CDATA #REQUIRED android:textSize CDATA #REQUIRED android:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
add a comment |
In the attlist declarations, your attribute names aren't separated by spaces.
For example LinearLayoutxmlns:android
(from the error message) should be LinearLayout xmlns:android
.
Another example is #REQUIREDandroid:layout_width
should be #REQUIRED android:layout_width
.
Here's a version with the attlist declarations fixed.
It validates now but since I don't know anything about android development I don't know what changes you made and if they're going to work the way you intended.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [
<!ELEMENT LinearLayout (ImageView|TextView)*>
<!ATTLIST LinearLayout
xmlns:android CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:background CDATA #REQUIRED
android:gravity CDATA #REQUIRED
android:orientation CDATA #REQUIRED
android:paddingBottom CDATA #REQUIRED
android:paddingLeft CDATA #REQUIRED
android:paddingRight CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:theme CDATA #REQUIRED>
<!ELEMENT ImageView (#PCDATA)>
<!ATTLIST ImageView
android:id CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:src CDATA #REQUIRED>
<!ELEMENT TextView (#PCDATA)>
<!ATTLIST TextView
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:layout_gravity CDATA #REQUIRED
android:layout_marginLeft CDATA #REQUIRED
android:layout_marginTop CDATA #REQUIRED
android:text CDATA #REQUIRED
android:textSize CDATA #REQUIRED
android:textStyle CDATA #REQUIRED>
]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Here's another version with the doctype declaration all on one line like the original:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayout xmlns:android CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:background CDATA #REQUIRED android:gravity CDATA #REQUIRED android:orientation CDATA #REQUIRED android:paddingBottom CDATA #REQUIRED android:paddingLeft CDATA #REQUIRED android:paddingRight CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageView android:id CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextView android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:layout_gravity CDATA #REQUIRED android:layout_marginLeft CDATA #REQUIRED android:layout_marginTop CDATA #REQUIRED android:text CDATA #REQUIRED android:textSize CDATA #REQUIRED android:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
In the attlist declarations, your attribute names aren't separated by spaces.
For example LinearLayoutxmlns:android
(from the error message) should be LinearLayout xmlns:android
.
Another example is #REQUIREDandroid:layout_width
should be #REQUIRED android:layout_width
.
Here's a version with the attlist declarations fixed.
It validates now but since I don't know anything about android development I don't know what changes you made and if they're going to work the way you intended.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [
<!ELEMENT LinearLayout (ImageView|TextView)*>
<!ATTLIST LinearLayout
xmlns:android CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:background CDATA #REQUIRED
android:gravity CDATA #REQUIRED
android:orientation CDATA #REQUIRED
android:paddingBottom CDATA #REQUIRED
android:paddingLeft CDATA #REQUIRED
android:paddingRight CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:theme CDATA #REQUIRED>
<!ELEMENT ImageView (#PCDATA)>
<!ATTLIST ImageView
android:id CDATA #REQUIRED
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:paddingTop CDATA #REQUIRED
android:src CDATA #REQUIRED>
<!ELEMENT TextView (#PCDATA)>
<!ATTLIST TextView
android:layout_width CDATA #REQUIRED
android:layout_height CDATA #REQUIRED
android:layout_gravity CDATA #REQUIRED
android:layout_marginLeft CDATA #REQUIRED
android:layout_marginTop CDATA #REQUIRED
android:text CDATA #REQUIRED
android:textSize CDATA #REQUIRED
android:textStyle CDATA #REQUIRED>
]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
Here's another version with the doctype declaration all on one line like the original:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (ImageView|TextView)*><!ATTLIST LinearLayout xmlns:android CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:background CDATA #REQUIRED android:gravity CDATA #REQUIRED android:orientation CDATA #REQUIRED android:paddingBottom CDATA #REQUIRED android:paddingLeft CDATA #REQUIRED android:paddingRight CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:theme CDATA #REQUIRED><!ELEMENT ImageView (#PCDATA)><!ATTLIST ImageView android:id CDATA #REQUIRED android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:paddingTop CDATA #REQUIRED android:src CDATA #REQUIRED><!ELEMENT TextView (#PCDATA)><!ATTLIST TextView android:layout_width CDATA #REQUIRED android:layout_height CDATA #REQUIRED android:layout_gravity CDATA #REQUIRED android:layout_marginLeft CDATA #REQUIRED android:layout_marginTop CDATA #REQUIRED android:text CDATA #REQUIRED android:textSize CDATA #REQUIRED android:textStyle CDATA #REQUIRED>]>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/pyroappappicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_30sdp"
android:text="@string/app_name"
android:textSize="@dimen/_20sdp"
android:textStyle="bold" />
</LinearLayout>
answered Nov 13 '18 at 3:51
Daniel HaleyDaniel Haley
38.6k45280
38.6k45280
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
add a comment |
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
Ok, first of all, thank you! Why did Android Studio generate it like this, if it's incorrect? Also: i used the version with all in one line, now i get the following error: "Error:(13, 56) cvc-elt.1.a: Cannot find the declaration of element 'LinearLayout'." Do you know, what this means?
– Twisterado
Nov 13 '18 at 6:36
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270966%2fandroid-attribute-type-is-required-in-declaration-of-cdata%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown