1

I'm hoping to convert the content of 3 adjacent TD elements in a TR using Yahoo Pipes to a comma-delimited list of values. Source: Epic Systems Hospitals.

HTML snippet:

...

<table width="623" cellspacing="0" cellpadding="0" border="0">
  <colgroup>
    <tbody>
      <tr height="20">
        <td width="425" height="20">Institution 0</td>
        <td width="134">Minneapolis</td>
        <td width="64">MN</td>
      </tr>
      <tr height="20">
        <td height="20">Institution 1</td>
        <td>Philadelphia</td>
        <td>PA</td>
      </tr>

...

I've used the "XPath fetch page" source to correctly isolate the TR elements using an XPATH=//tr[@height='20'].

I'm having difficulty getting the TD elements, however. It's not obvious to me which component I should be using, so I chose a Sub-element with the 'special variable substitution' syntax. Unfortunately, ${td.0.content} doesn't work.

What am I not understanding?

** edit **

My goal is to create an XML stream that resembles:

<institutions>
  <institution name='Institution 0' city='Minneapolis' region='MN'/>
  <institution name='Institution 1' city='Philadelphia' region='PA'/>
  ...
<institutions/>

enter image description here

4

1 回答 1

3

如果您总是有 3 个 td 单元格,则可以使用Loop带内部的运算符,并通过连接, ,String Builder来构建字符串。item.td.0item.td.1item.td.2

我在这里为您创建了一个示例:

http://pipes.yahoo.com/pipes/pipe.info?_id=3d24486f7c6e8413dc6252ef37c2f086

于 2013-05-28T01:18:57.017 回答