简体   繁体   English

根元素后面的文档中的标记必须格式正确吗?

[英]The markup in the document following the root element must be well-formed?

Im getting this error in my activity_main.xml on line 9 by I have no idea why please help. 我在第9行的activity_main.xml中收到此错误,我不知道为什么需要帮助。

<FrameLayout
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >

<WebView
    android:id="@+id/webView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
</FrameLayout>

尝试ctrl + shift + F到您的xml代码,这将格式化代码并在清理项目后重试。它将起作用。

If you would have googled this error, there are lots of post for the same. 如果您会用Google搜索此错误,则有很多相同的帖子。 Eg: 例如:

Android app, The markup in the document following the root element must be well-formed Android应用,根元素后的文档中的标记必须格式正确

The markup in the document following the root element must be well-formed. 根元素后面的文档中的标记必须格式正确。 What is the cause of this? 这是什么原因?

Error : The markup in the document following the root element must be well-formed Please help I am new at android 错误:根元素后面的文档中的标记必须格式正确,请帮助我是android的新手

and so on. 等等。 Basically it says that you can only have one root element for the whole XML file. 基本上,它说整个XML文件只能有一个根元素 The xml sniplet you've shown does not look complete. 您显示的xml片段看起来不完整。 Just make sure that you only have one root element for the XML file and rest of them are child of that root element. 只需确保XML文件只有一个根元素,其余的都是该根元素的子元素。 Hope this helps. 希望这可以帮助。 If it doesn't then please do post the complete XML file for us to help better. 如果没有,请发布完整的XML文件,以帮助我们更好地工作。

Update 更新资料

In the code shown above you have two FrameLayout root elements. 在上面显示的代码中,您有两个FrameLayout根元素。 There should be only one. 应该只有一个。 So change it(based on your needs) to something like below, so that only one root element is there: 因此(根据您的需要)将其更改为如下所示,以便仅存在一个根元素:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fullscreen_custom_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FF000000">
    <FrameLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    <WebView
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</FrameLayout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:根元素后面的文档中的标记必须格式正确 - Error: The markup in the document following the root element must be well-formed 错误! Android中的编程-Java开发人员-根元素后的文档中的标记必须格式正确 - ERROR ! in Android - java developer - The markup in the document following the root element must be well-formed Eclipse错误“根元素后面的文档中的标记必须格式正确 - Eclipse error "The markup in the document following the root element must be well-formed Tomcat错误:根元素后的文档中的标记必须格式正确 - Tomcat error: The markup in the document following the root element must be well-formed 添加导航抽屉会导致:根元素后面的文档中的标记必须格式正确 - Adding Navigation Drawer results in: The markup in the document following the root element must be well-formed Android 应用程序,根元素后面的文档中的标记必须格式正确 - Android app, The markup in the document following the root element must be well-formed web.xml根元素后面的文档中的标记必须格式正确 - web.xml the markup in the document following the root element must be well-formed Java XML 问题:文档中根元素后面的标记必须格式正确 - Java XML Problem: The markup in the document following the root element must be well-formed 我收到此错误:根元素后面的文档中的标记必须格式正确 - i am getting this error: The markup in the document following the root element must be well-formed org.xml.sax.SAXParseException 文档中根元素之后的标记必须格式正确 - org.xml.sax.SAXParseException The markup in the document following the root element must be well-formed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM