在R中出现以下错误:错误:1:期望开始标记,'<'未找到

时间:2016-01-24 10:09:22

标签: r

我彻底搜索了网站,但未找到答案。该脚本查看文件目录并附加到文件名向量中(然后我将其转换为数据帧)。 For然后用于迭代自定义函数,该函数使用文件名作为参数。解析器可以正常工作一个文件名(即当我在解析器(文件名)中强制它时,否则在通过for循环运行时失败)。所以我怀疑这是我如何通过论证。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.machimanapc.howzit.CommentActivity">
<RelativeLayout
    android:id="@+id/header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="@color/colorPrimary"
    android:paddingTop="5dp"
    android:paddingBottom="5dp">
    <ImageButton
        android:id="@+id/imgBack"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_action_left_white"
        android:background="?android:selectableItemBackground"
        android:layout_centerInParent="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginStart="5dp"
        android:layout_marginLeft="5dp"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/reply"
        android:textColor="@color/textColorPrimary"
        android:layout_centerInParent="true"
        android:textSize="25sp"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:layout_centerVertical="true"/>


</RelativeLayout>
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:id="@+id/content"
    android:layout_marginTop="5dp"
    android:layout_below="@+id/header">
    <TextView
        android:id="@+id/txtUsername_view_Respond"
        android:textColor="@color/colorPrimaryDark"
        android:textStyle="bold"
        android:layout_marginStart="10dp"
        android:layout_marginLeft="10dp"
        android:textSize="6pt"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    <LinearLayout
        android:id="@+id/stuff"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_below="@+id/txtUsername_view_Respond"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:gravity="end">
        <TextView

            android:id="@+id/txtContent_view_Respond"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_weight="1"
            android:textSize="6pt"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:textAppearance="?android:attr/textAppearanceSmall"/>


        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginRight="10dp"
            android:layout_marginEnd="10dp"
            android:layout_gravity="end">

            <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0dp"
                android:src="@drawable/ic_action_up"
                android:background="?android:selectableItemBackground"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:textColor="@color/colorPrimary"
                android:textStyle="bold" />

            <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_action_down"
                android:background="?android:selectableItemBackground"
                />
        </LinearLayout>
    </LinearLayout>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/stuff">
        <TextView
            android:id="@+id/txtTimestamp_Reply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:textColor="@color/Timestamp"
            android:textSize="@dimen/feed_item_timestamp"/>


    </RelativeLayout>
</RelativeLayout>
<ListView
    android:id="@+id/posts_list_view"
    android:layout_below="@+id/content"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginTop="5dp"
    />
<RelativeLayout
    android:id="@+id/footer"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@color/textColorPrimary"
    android:layout_alignParentBottom="true">

    <EditText
        android:id="@+id/txtEdit_Text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxLines="1"
        android:hint="@string/prompt_reply"
        android:layout_marginRight="5dp"
        android:layout_marginEnd="5dp"
        android:layout_marginTop="13dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_toLeftOf="@+id/txtCharacter_count"
        android:layout_toStartOf="@+id/txtCharacter_count"
        android:inputType="textMultiLine"
        android:singleLine="true"/>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/btnPost"
        android:layout_marginRight="5dp"
        android:layout_marginEnd="5dp"
        android:layout_centerInParent="true"
        android:text="@string/prompt_post"
        android:background="@drawable/newrounded"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"/>
    <TextView
        android:id="@+id/txtCharacter_count"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/btnPost"
        android:layout_toStartOf="@+id/btnPost"
        android:layout_marginBottom="@dimen/activity_vertical_margin"
        android:text="@string/character_count_placeholder"
        android:layout_marginRight="5dp"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:gravity="center"
        android:layout_marginTop="25dp"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"/>
</RelativeLayout>

当我打印(as.character(files.df [i,])时,输出是预期的。再次,运行带有一个文件名的自定义解析器(在for循环之外)作为参数完美地工作.setwd是与读取文件的位置相同。

您之前遇到过的任何事情?

更新:脚本昨天用一个文件工作正常,但现在我得到了同样的错误。这似乎发生在这一行:

files <- list.files(path="~/pathname", pattern="*.xml", full.names = F, recursive=FALSE)
files.df <- as.data.frame(files)
for (i in 1:nrow(files.df)) {
parser(as.character(files.df[i,]))
}

0 个答案:

没有答案