斯潘8
斯潘4
您好:我有一个工作区,我试图用JSON编写器编写一个JSON文件。问题是,JSON的结构有一个子函数与之关联,子特性不随写操作生成。我目前使用的是文本文件编写器,它只是从我的JSonformatter中写入文本行数据。这种方法的问题在于输出是字符串,我有一些字段必须是数字。我在另一个线程上看到了使用xs:int(attribute)或xs:double(attribute)函数将字符串动态转换为int/double。这种方法很好,但是有一些数值为空,为了使用xs函数,我发现这些属性不能为空。我不能通过设置输出的数据类型来使用JSON编写器来处理这个问题吗?但我又不能让JSON编写器生成我的子特性。
@高桥-我在jContemplater之前有一个nullattributemapper,但是检查了所有值(空,失踪,零)。我刚做了你建议的调整,收到了这些错误:
JSontemplater(xmlTemplaterFactory):在第5行附近发生以下错误,查询的第35列:
JSontemplater(xmlTemplaterFactory):“xs:string”:强制转换/构造函数的值无效:无法强制转换为“xs:double”
JSontemplater(xmlTemplaterFactory):发生了致命错误。查看上面的日志文件了解详细信息
下面是JSontemplater中的内容:
{
“totalinvestment”:xs:double(fme:get attribute(“totalinvestment”)),
“squarefootageretail”:xs:double(fme:get属性(“squarefootageretail”)),
“squarefootageoffice”:xs:double(fme:get属性(“squarefootageoffice”)),
“squareFootagManufacturing”:xs:double(fme:get属性(“squareFootagManufacturing”)),
“recordtype”:fme:get属性(“recordtype”),
“projectstage”:fme:get属性(“projectstage”),
“projectname”:fm:get属性(“projectname”),
“projectid”:fme:get属性(“projectid”),
“projectdescription”:fme:get属性(“projectdescription”),
“projectdate”:fme:get属性(“projectdate”),
“属性地址”:。[
FME:过程特征(“SUB”)。
,
“programtype”:fme:get属性(“programtype”),
“numberofUnits”:xs:double(fme:get属性(“numberofUnits”)),
“numberofsqft”:xs:double(fme:get属性(“numberofsqft”)),
“numberofparkingspaces”:xs:double(fme:get属性(“numberofparkingspaces”)),
“numberofhotelrooms”:xs:double(fme:get属性(“numberofhotelrooms”)),
“邻居”:fme:get属性(“邻居”),
“jobsretained”:xs:double(fme:get属性(“jobsretained”)),
“JobsCreated”:xs:double(fme:get属性(“JobsCreated”)),
“developer”:fme:get属性(“developer”),
“类别”:fme:get属性(“类别”),
“cagisid”:fme:get属性(“cagisid”),
“地址”:fme:get属性(“地址”)。
}
确保您已更改
然而,如果属性存储的字符串不代表数值,由于nullattributeValueMapper未删除该属性,因此仍然会出现错误。请使用记录器或检查器检查存储的值。
?2019安全亚搏在线软件公司|合法的