2012-12-14 49 views
1

问题:我创建了一个包含符合atom 1.0模式的数据的示例xml文档。当我在PowerPivot中导入此文件的内容(用于测试目的)时,它会为每个条目中的每个原子元素创建列,而不是为每个内容元素创建一列。为什么是这样?在PowerPivot中导入自定义Atom feed

背景:客户希望从Web服务导入数据,该服务提供使用PowerPivot不支持的自定义XML模式的提要。该服务提供了调用者提供将应用于该提要的XSLT模板的能力。我希望能够将此Feed转换为有效的原子提要,从而允许客户将数据导入PowerPivot。

样品原子的xml:

<?xml version="1.0" encoding="UTF-8"?> 
<feed xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
     xmlns="http://www.w3.org/2005/Atom" 
     xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> 
    <title type="text">My Data Feed</title> 
    <id>http://temp/feed</id> 
    <updated>2012-12-13T00:00:00Z</updated> 
    <entry> 
     <id>http://temp/feed/1</id> 
     <title type="text">Title</title> 
     <author> 
     <name>Author</name> 
     </author> 
     <updated>2012-12-13T00:00:00Z</updated> 
     <content type="application/xml"> 
     <d:Name>John Smith</d:Name> 
     <d:Address>Address</d:Address> 
     <d:Zip>1234</d:Zip> 
     </content> 
    </entry> 
</feed> 

当导入的PowerPivot(选择 “从数据馈送”,点击 “浏览”,并指出XML文件),它看起来像这样:

PowerPivot import result

我正在检查三栏:姓名,地址和邮编。如果我在自动错误更改“包含原子元素”在连接配置中,没有列导入。

回答

2

看来我只是错过了m:properties元素。最终结果 - 还包括空属性和数据类型的示例:

<?xml version="1.0" encoding="UTF-8"?> 
<feed xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
     xmlns="http://www.w3.org/2005/Atom" 
     xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> 
    <title type="text">My Data Feed</title> 
    <id>http://temp/feed</id> 
    <updated>2012-12-13T00:00:00Z</updated> 
    <entry> 
     <id>http://temp/feed/1</id> 
     <title type="text">Title</title> 
     <author> 
     <name>Author</name> 
     </author> 
     <updated>2012-12-13T00:00:00Z</updated> 
     <content type="application/xml"> 

     <!-- attributes placed under the properties element --> 
     <m:properties> 
      <d:Name>John Smith</d:Name> 
      <d:Address>Address</d:Address> 
      <d:Zip m:type="Edm.Int32">1234</d:Zip> 
      <d:Comment m:null="true" /> 
     </m:properties> 

     </content> 
    </entry> 
</feed>