Qlikview REST连接器分页命名空间XML [英] Qlikview REST connector pagination namespaced XML

查看:92
本文介绍了Qlikview REST连接器分页命名空间XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在某个网站上有一个XML文件,看起来像这样(去除了机密部分)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">  
  <title type="text">Accounts</title>  
  <id></id>  
  <updated>2016-02-04T08:36:56Z</updated>  
  <link rel="self" title="Accounts" href="Accounts" />  
<entry>  
    <title type="text"></title>  
    <updated>2016-02-04T08:36:56Z</updated>  
    <author>  
      <name />  
    </author>  
    <content type="application/xml">  
      <m:properties>  
        <d:Type>A</d:Type>  
        <d:UniqueTaxpayerReference m:null="true" />  
        <d:VATLiability m:null="true" />  
        <d:VATNumber m:null="true" />  
        <d:Website m:null="true" />  
      </m:properties>  
    </content>  
  </entry>  
  <link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />  
</feed>  

我们使用新的Rest连接器从XML文件中获取数据. XML具有分页功能,每60个条目就可以使用此xml文件底部的链接加载接下来的60个条目.

我遇到的问题是,在REST连接器中,我们想使用以下设置启用分页:

分页类型:Next URL

下一个URL字段路径:

/*[name()="feed"]/*[name()="link"][contains(@rel,"next")]/@href

它似乎不起作用...

旁注:XML文件具有名称空间,因此我需要以这种方式定位元素,而不是/feed/link/...

我正在使用Xpath语法定位链接href,但这也许不是解决之道吗?还是REST连接器没有使用Xpath语法?

真的希望有人能帮助我!

解决方案

实际上,事实证明,这似乎是由于"Qlik REST Connector 1.0"中的错误"所致,因此分页不起作用. >

但是有一个解决方法:

1)确保"Qlik REST连接器1.0连接"对话框的NextUrl设置为:

      feed/link/attr:href

2)在使用SELECT按钮并通过向导之后生成SQL时,您必须修改如下所示的子SELECT:

...

(SELECT  
"attr:rel" AS "rel",  
"attr:title" AS "title",  
"attr:href" AS href,  
"__FK_link"  
FROM "link" FK "__FK_link"),  
.....  

在05行,您将必须删除文本AS href.

所以它应该像这样:

.....  
(SELECT  
"attr:rel" AS "rel",  
"attr:title" AS "title",  
"attr:href",  
"__FK_link"  

FROM "link" FK "__FK_link"),  
....  

3)找到带有RESIDENT [MasterREST在加载脚本中向下的REST]从此子选择加载的LOAD语句,并确保对href的引用已更改为[attr:href]-否则您将获得一个加载时出现错误消息.

更改后应如下所示:

[link]:  
LOAD [rel],  
  [title],  
  [attr:href],  
  [__FK_link] AS [__KEY_feed]  
RESIDENT RestConnectorMasterTable  
WHERE NOT IsNull([__FK_link]);  

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">  
  <title type="text">Accounts</title>  
  <id></id>  
  <updated>2016-02-04T08:36:56Z</updated>  
  <link rel="self" title="Accounts" href="Accounts" />  
<entry>  
    <title type="text"></title>  
    <updated>2016-02-04T08:36:56Z</updated>  
    <author>  
      <name />  
    </author>  
    <content type="application/xml">  
      <m:properties>  
        <d:Type>A</d:Type>  
        <d:UniqueTaxpayerReference m:null="true" />  
        <d:VATLiability m:null="true" />  
        <d:VATNumber m:null="true" />  
        <d:Website m:null="true" />  
      </m:properties>  
    </content>  
  </entry>  
  <link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />  
</feed>  

We use the new Rest connector to get the data out of this XML file. The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.

The problem i have is when, in the REST connector, we want to enable pagination with these setting:

Pagination Type: Next URL

Next URL field path:

/*[name()="feed"]/*[name()="link"][contains(@rel,"next")]/@href

It doesn't seem to work...

side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...

I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?

Really hope someone can help me!

解决方案

Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.

But there is a fix for it:

1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:

      feed/link/attr:href

2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:

.....

(SELECT  
"attr:rel" AS "rel",  
"attr:title" AS "title",  
"attr:href" AS href,  
"__FK_link"  
FROM "link" FK "__FK_link"),  
.....  

On line 05 you will have to remove the text AS href.

So it should look like this:

.....  
(SELECT  
"attr:rel" AS "rel",  
"attr:title" AS "title",  
"attr:href",  
"__FK_link"  

FROM "link" FK "__FK_link"),  
....  

3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.

Should look like this after the change:

[link]:  
LOAD [rel],  
  [title],  
  [attr:href],  
  [__FK_link] AS [__KEY_feed]  
RESIDENT RestConnectorMasterTable  
WHERE NOT IsNull([__FK_link]);  

这篇关于Qlikview REST连接器分页命名空间XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆