SAPUI5-实体模型服务器

SAPUI5-实体模型服务器,sapui5,Sapui5,我为SAPUI5关注这一点。但我无法检索数据并将其设置为我的模型。我是这样做的: 我稍微更改了数据,所以必须更改两件事: json数据-Person.json: {“id”:1, “名字”:“克里斯”, “姓氏”:“约翰斯顿”,“电子邮件”:cjohnston0@dailymotion.com,“性别”:“男性”,“ip地址”:“119.220.205.173”} 强调文本 `` xmlns:m=”http://schemas.microsoft.com/ado/2007/08/datas

我为SAPUI5关注这一点。但我无法检索数据并将其设置为我的模型。我是这样做的:

我稍微更改了数据,所以必须更改两件事:

  • json数据-Person.json:

    {“id”:1, “名字”:“克里斯”, “姓氏”:“约翰斯顿”,“电子邮件”:cjohnston0@dailymotion.com,“性别”:“男性”,“ip地址”:“119.220.205.173”}

  • 强调文本

``


xmlns:m=”http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
SAPUI5 Web IDE表示
edmx
名称空间不存在

所以我去检查,它不存在

Chrome developer tools报告了相同的错误:

这可能是问题所在吗

我检查并触发了
mockserver.init()

Microsoft是否将此命名空间移动到了某个位置?因为我找不到它


谢谢

我看到的是您弄乱了XML结构。因为错误表明您的XML无效

  • 您已经在文档开头关闭了周围的edmx:edmx标记
  • 您过早地关闭了edmx:DataServices标记
此外,属性id的属性名称是小写的。尽量用大写字母命名

尝试使用以下xml:

<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0"
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityType Name="Person">
            <Key>
                <PropertyRef Name="id"/>
            </Key>
            <Property Name="id" Type="Edm.Int16" Nullable="false"/>
            <Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
            <Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
            <Property Name="email" Type="Edm.String" Nullable="false"/>
            <Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
            <Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
        </EntityType>
    </Schema>
    <Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
            xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
            <EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
        </EntityContainer>
    </Schema>
</edmx:DataServices>

<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0"
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityType Name="Person">
            <Key>
                <PropertyRef Name="id"/>
            </Key>
            <Property Name="id" Type="Edm.Int16" Nullable="false"/>
            <Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
            <Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
            <Property Name="email" Type="Edm.String" Nullable="false"/>
            <Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
            <Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
        </EntityType>
    </Schema>
    <Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
            xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
            <EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
        </EntityContainer>
    </Schema>
</edmx:DataServices>