检查 'file not found' 或解析错误

Check for 'file not found' or parse errors

当我尝试 运行 应用程序时,我从编译器收到了一条奇怪的错误消息:

com/example/RequestAccess/view/JobProfileCart.view.xml could not be loaded from ./view/JobProfileCart.view.xml. Check for 'file not found' or parse errors. Reason: Error: Invalid XML: <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
    controllerName="com.example.RequestAccess.controller.JobProfileCart" xmlns:html="http://www.w3.org/1999/xhtml">
    <Page id="detail" title="{i18n>jobProfileCart}" backgroundDesign="Standard" floatingFooter="true"
        class="sapUiContentPadding sapUiResponsivePadding--header sapUiResponsivePadding--subHeader sapUiResponsivePadding--content sapUiResponsivePadding--footer">
        <headerContent>

不知道,为什么提示找不到文件:

虽然它存在。

JobProfileCart的内容也应该是正确的:

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
    controllerName="com.example.RequestAccess.controller.JobProfileCart" xmlns:html="http://www.w3.org/1999/xhtml">
    <Page id="detail" title="{i18n>jobProfileCart}" backgroundDesign="Standard" floatingFooter="true"
        class="sapUiContentPadding sapUiResponsivePadding--header sapUiResponsivePadding--subHeader sapUiResponsivePadding--content sapUiResponsivePadding--footer">
        <headerContent>
            <Button icon="sap-icon://user-edit" type="Transparent" press="onPressEdit" ariaLabelledBy="editButtonLabel"/>
        </headerContent>
        <content>
            <f:SimpleForm id="SimpleFormDisplay480" minWidth="1024" maxContainerCols="2" editable="false" layout="ResponsiveGridLayout" labelSpanL="2"
                labelSpanM="2" emptySpanL="0" emptySpanM="0" columnsL="2" columnsM="2">
                <f:content>
                    <Label text="{i18n>id}"/>
                    <Text text="{User>/Id}"/>
                    <Label text="{i18n>name}"/>
                    <Text text="{User>/Surname} {User>/Firstname}"/>
                    <Label text="{i18n>email}"/>
                    <Text text="{User>/Email}"/>
                </f:content>
                <f:layoutData>
                    <FlexItemData shrinkFactor="0" backgroundDesign="Solid" styleClass="sapContrastPlus"/>
                </f:layoutData>
            </f:SimpleForm>
        </content>
        <footer>
            <OverflowToolbar>
                <ToolbarSpacer/>
                <Button type="Accept" enabled="{SendStatus>/enable}" text="Send" press="handleJobProfileSend"/>
            </OverflowToolbar>
        </footer>
    </Page>
</mvc:View>

我做错了什么?

您在 header 中没有命名空间 f 的定义。尝试添加 xmlns:f="sap.ui.layout.form".

<mvc:View <strong>xmlns:f="sap.ui.layout.form"</strong> xmlns:core="sap.ui.core" ...>