Forum

HomeHomeCoreCoreGeneralGeneralXML Query - Extracting Duplicate NodesXML Query - Extracting Duplicate Nodes
Previous
 
Next
New Post
2/17/2011 2:48 AM
 

Hi all,

I was wondering if anyone knows how to extract duplicate nodes using an XML Query.  For example, some RSS feeds have the "Category" element repeated.  See example below;

<channel>
  <item>
.....
    <title>Some title</title>
    <category>Category 1</category>
    <category>Category 2</category>
.....
  </item>
</channel>

In the example above I have set the <ROWS> in the query like this <ROWS>/root/item</ROWS>.  This works fine and maps all the columns as expected.  If there are 3 <ITEM> nodes then i get 3 rows.  But the problem is that within each <ITEM> node of the RSS feed I am mapping the <CATEGORY> element which can repeat multiple times.   When there are duplicate elements only one of the duplicates is mapped (cant remember if its the first or last).    

So is it possible to map duplicates.. perhaps map them to the target as comma separated values?

Cheers

John

New Post
2/21/2011 8:37 PM
 

While playing around with an XML query i accidentally stumbled upon something interesting in the debugging output. I left the "ROWS" and "COLUMNS" tags empty and just placed "rss" into the transform source below and to my surprise OWS seemed to parse the entire XML and create multiple output tables. See Query & Results below. It even seemed to create "ID" columns for the parent/child relationships between parent and child nodes. ie; "rss_Id", "channel_id" etc. So the million dollar question is ... How can i read the data in the tables. As it stands all know to do at the moment is loop through the data from the first table returned. Is there a way to loop through the other tables returned. Thanks

Query

====

<TRANSFORM>
<SOURCE>rss</SOURCE>
</TRANSFORM>
<ROWS></ROWS>
<COLUMNS></COLUMNS>

Results

======.

 

rss -  Rows: 1 Columns: 2
    * rss_Id System.Int32
    * version System.String

channel -  Rows: 1 Columns: 14
    * title System.String
    * link System.String
    * description System.String
    * language System.String
    * copyright System.String
    * ttl System.String
    * webMaster System.String
    * managingEditor System.String
    * generator System.String
    * pubDate System.String
    * lastBuildDate System.String
    * channel_Id System.Int32
    * docs System.String
    * rss_Id System.Int32

image -  Rows: 1 Columns: 6
    * url System.String
    * title System.String
    * link System.String
    * width System.String
    * height System.String
    * channel_Id System.Int32

category -  Rows: 6 Columns: 2
    * category_Text System.String
    * channel_Id System.Int32

skipDays -  Rows: 2 Columns: 2
    * skipDays_Text System.String
    * channel_Id System.Int32

skipHours -  Rows: 13 Columns: 2
    * skipHours_Text System.String
    * channel_Id System.Int32

item -  Rows: 24 Columns: 6
    * title System.String
    * link System.String
    * description System.String
    * pubDate System.String
    * author System.String
    * channel_Id System.Int32

 

New Post
3/10/2012 5:24 AM
 

i know its an old thread but I was just curious if anyone ever found a solution to this.  ie; How would i extract the data for every repeating <category> element.

 

Cheers

John

New Post
3/23/2017 10:05 AM
 
Now the thread is very very old but having spent two days trying to find the XPATH to extract some XML I'm just about to give up again.
In debug my XML seems to be in separate tables. I can access the top (first) table but not the others.
eg,

findItemsByKeywordsResponse - Rows: 1 Columns: 5
ack System.String
version System.String
timestamp System.String
findItemsByKeywordsResponse_Id System.Int32
itemSearchURL System.String


searchResult - Rows: 1 Columns: 3
searchResult_Id System.Int32
count System.String
findItemsByKeywordsResponse_Id System.Int32

How to access the data in the table "searchResults" for example?
The docs on here are so broken, incomplete or useless the information is just NOT there at all.
It's all guess work.

Has anybody got a working example of consuming XML or JSON from say eBay developer calls?

BTW you never know where the problem lies. My XPATHs generally work in the XPATH testers online. So is it OWS that's broken? I hope not, as trying to get Kevin to do anything is now impossible.

Previous
 
Next
HomeHomeCoreCoreGeneralGeneralXML Query - Extracting Duplicate NodesXML Query - Extracting Duplicate Nodes


 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share