首页 \ 问答 \ MarkLogic REST API - JSON响应(MarkLogic REST API - JSON Response)

MarkLogic REST API - JSON响应(MarkLogic REST API - JSON Response)

我正在使用MarkLogic 7 REST API在XML文档数据库之上构建AngularJS应用程序。 我的文档采用NEWSML-G2格式。 我已经配置了自定义查询选项,只返回与搜索字符串匹配的每个文档的标题和创建日期。 问题是这个。

我的XML中有一个title元素。

<nitf version="-//IPTC//DTD NITF 3.6//EN" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:newzmeta="http://newz.nl/metadata/" xmlns="http://iptc.org/std/NITF/2006-10-18/">
<head>
<title newz:origin="Generated" xmlns:newz="http://newz.nl/">Test Article</title>
....
</nitf>

在我的自定义查询选项中,我使用了以下行。

<extract-metadata>
  <qname elem-ns="http://iptc.org/std/NITF/2006-10-18/" elem-name="title"/>
  ....
</extract-metadata>

现在,问题是,当我点击REST接口进行查询并以JSON格式请求结果时,我在响应中得到以下内容

"metadata":[{"{http://iptc.org/std/NITF/2006-10-18/}title":"Obama assumes the office of the President of the United States","metadata-type":"element"},{"  {http://iptc.org/std/nar/2006-10-01/}firstCreated":"2009-01-20T05:00:09","metadata-type":"element"}]

如何在UI端检索标题值? 如果我要求,我会收到语法错误

 result.metadata.{http://iptc.org/std/NITF/2006-10-18/}title

有没有办法专门访问此值,或以某种方式更改从MarkLogic端返回的元素的名称?


I'm using the MarkLogic 7 REST API to build an AngularJS application on top of an XML document database. My documents are in NEWSML-G2 format. I've configured custom query options to return only the title and the creation date for each document that matches the search string. The problem is this.

I have a title element in my XML.

<nitf version="-//IPTC//DTD NITF 3.6//EN" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:newzmeta="http://newz.nl/metadata/" xmlns="http://iptc.org/std/NITF/2006-10-18/">
<head>
<title newz:origin="Generated" xmlns:newz="http://newz.nl/">Test Article</title>
....
</nitf>

In my custom query options, I've used the following line.

<extract-metadata>
  <qname elem-ns="http://iptc.org/std/NITF/2006-10-18/" elem-name="title"/>
  ....
</extract-metadata>

Now, the problem is that when I hit the REST interface to make a query and ask for results in JSON format, I get the following in the response

"metadata":[{"{http://iptc.org/std/NITF/2006-10-18/}title":"Obama assumes the office of the President of the United States","metadata-type":"element"},{"  {http://iptc.org/std/nar/2006-10-01/}firstCreated":"2009-01-20T05:00:09","metadata-type":"element"}]

How do I retrieve the title value on the UI side? I get a syntax error if I ask for

 result.metadata.{http://iptc.org/std/NITF/2006-10-18/}title

Is there a way specifically to access this value, or to somehow change the name of the element that's returned from the MarkLogic side?


原文:https://stackoverflow.com/questions/22809823
更新时间:2021-10-18 08:10

最满意答案

试试这个:

<div fullWidthImg [ngStyle]="{'height': '200px', 'width':'200px'}"> </div>

其余的代码工作只是改变div标签! 这里是工作示例: 图像显示


Try this One:

<div fullWidthImg [ngStyle]="{'height': '200px', 'width':'200px'}"> </div>

Rest of code is working just change div tag only!! Here is working example : Image display

相关问答

更多
  • 使用datPercent作为数据保留关键字 data是保留关键字。 jsbin http://jsbin.com/yexonayoho/edit?html,js,output Use datPercent as data is reserved keyword data is reserved keyword. jsbin http://jsbin.com/yexonayoho/edit?html,js,output
  • 语法错了。 private defaultColor:string = 'green'; 使用= not :指定值。 :是为字段定义类型。 The syntax is wrong. private defaultColor:string = 'green'; The value is assigned using = not :. : is to define a type for the field.
  • 自定义指令在很多方面都非常有用。 其中一个将回答你的问题的是以下。 如果您的html中有多个div标签,并且您希望仅为特定div调用该指令。 在这种情况下,最好使用自定义指令。 如果你不在这里使用自定义的,那么你需要检查元素的id或做一些其他的事情,这将有助于你确定它是否是你想要的元素。 这将增加额外的处理,并且还将通过指令调用为该html中的每个不需要的div标签添加额外的处理 Custom directives are really useful in many ways. One of them wh ...
  • 不确定这是否是你想要的,但你可以尝试这样的事情: myApp.directive("customDirective", function () { return { replace : true, template : '
    ' + '

    相关文章

    更多
  • 传说中的WeixinJSBridge和微信rest接口
  • Jackson流式API JsonGenerator、JsonParser
  • 分享一个免费的聊天api
  • JOGL基本模板API
  • 微信公众平台通用接口API指南
  • 使用jQuery、Yahoo API和HTML5的geolocation来开发一个天气预报web应用
  • jquery与servlet交互的json问题
  • API调用太麻烦 eBay推出Web查询语言
  • 微信公众平台自定义菜单接口API指南
  • Google TTS(文字转语音)api 2
  • 最新问答

    更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。