首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SAPUI5 -模拟服务器

SAPUI5 -模拟服务器
EN

Stack Overflow用户
提问于 2016-11-20 10:34:29
回答 1查看 226关注 0票数 1

我正在跟踪这个模拟服务器教程 for SAPUI5。但我无法检索数据并将其设置为我的模型。我要做的是:

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

  • json数据- Person.json: { "id":1,“first_name”:“克里斯”,“last_name”:“约翰斯顿”,“电子邮件”:“cjohnston0@dailymotion.com”,“性别”:“男性”,"ip_address":"119.220.205.173“}
  • 强调文本

代码语言:javascript
复制
<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>

SAPUI5 Web表示edmx命名空间不存在。

所以我去检查edmx命名空间,它不存在。

也报告了相同的错误:

这可能是问题所在吗?

我查过了,mockserver.init()被触发了。

微软把这个名称空间移到什么地方了吗?因为我找不到它。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2016-11-20 12:53:28

我看到的是,您搞乱了XML结构。正如错误说的那样,XML是无效的。

  • 在文档开头关闭了周围的edmx:Edmx标记
  • 您过早地关闭了edmx:DataServices标记。

此外,属性id的属性名为小写。试着创造一个超感知的名字。

尝试使用以下xml:

代码语言:javascript
复制
<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>

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40703017

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档