Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to select 2 nodes in XML Dataset(Tried setting xpath to //class1|//class2 but it doesn't match)
How to select 2 nodes in XML Dataset [message #1007204] Mon, 04 February 2013 23:26 Go to next message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
Tried setting xpath (Row Mapping in edit DataSet) to //class1|//class2 but it doesn't match. I get the message on the Column Mapping screen that says: "The table mapping XPath does not exist"

Is there a way to do it?
Thanks
Brad
Re: How to select 2 nodes in XML Dataset [message #1007226 is a reply to message #1007204] Tue, 05 February 2013 06:50 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Can you show a sample xml file and what you're looking for the result set to be?

Michael

Developer Evangelist, Silanis
Re: How to select 2 nodes in XML Dataset [message #1007474 is a reply to message #1007226] Wed, 06 February 2013 03:30 Go to previous messageGo to next message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
Sample XML:

<root>
	<sampleA>
		<truck>
			<type>alpha</type>
			<wheels>16</wheels>
		</truck>
		<truck>
			<type>beta</type>
			<wheels>14</wheels>
		</truck>
		<car>
			<type>phi</type>
			<wheels>4</wheels>
		</car>
	</sampleA>
	<sampleB>
		<truck>
			<type>gamma</type>
			<wheels>12</wheels>
		</truck>
		<car>
			<type>omega</type>
			<wheels>4</wheels>
		</car>
	</sampleB>
</root>


Example XML and report attached. Attempted to match //truck|//car but get the aforementioned error

Note using BIRT designer 2.6.2 (upgrade path restricted)

Thanks
Re: How to select 2 nodes in XML Dataset [message #1007650 is a reply to message #1007474] Wed, 06 February 2013 21:31 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Try this as your row mapping expression "/root/*/*"

Then, use //type and //wheels as your columns. That should get you everything.


Michael

Developer Evangelist, Silanis
Re: How to select 2 nodes in XML Dataset [message #1007659 is a reply to message #1007650] Wed, 06 February 2013 22:26 Go to previous messageGo to next message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
Thanks Michael.

I gave an oversimplified example though. What if I want to ignore <bicycle> siblings of car and truck?
Re: How to select 2 nodes in XML Dataset [message #1007667 is a reply to message #1007659] Wed, 06 February 2013 23:00 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Will filtering work as a workaround? It appears that the '|' character is not liked by BIRT. I'll let you know if I get something working.

Michael

Developer Evangelist, Silanis
Re: How to select 2 nodes in XML Dataset [message #1007879 is a reply to message #1007667] Thu, 07 February 2013 21:56 Go to previous messageGo to next message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
Filtering isn't an option unfortunately. A closer workaround would be to search for all instances of a common child element, then referencing its parent:
//nodeUniqueToThoseIWant/..

But this doesn't work either

Looks like I might have to preprocess the data before BIRT
Re: How to select 2 nodes in XML Dataset [message #1007887 is a reply to message #1007879] Thu, 07 February 2013 22:59 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Ok. If you have a node that is unique to only the ones you want, you should be able to do something like:

//nodeUniqueToThoseYouWant as the row expression.

Then, for the columns, you'd just do ../fieldName1, ../fieldName2, etc.

In this example, I added a <bike> to the xml and added a node to the cars and trucks called property. So, my row xpath was //property and my columns were ../type and ../wheels. This gave me the data for only the cars and trucks that had this node, "property". Hopefully this helps.


Michael

Developer Evangelist, Silanis
Re: How to select 2 nodes in XML Dataset [SOLVED] [message #1007898 is a reply to message #1007887] Fri, 08 February 2013 02:41 Go to previous messageGo to next message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
Hey Michael, that's done it! Just had to check 'suppress duplicates' on the table columns to hide dups and we're in business

Thanks a lot for your help
Brad

[Updated on: Fri, 08 February 2013 02:42]

Report message to a moderator

Re: How to select 2 nodes in XML Dataset [SOLVED] [message #1007901 is a reply to message #1007898] Fri, 08 February 2013 04:31 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Awesome! Glad to help!

Michael

Developer Evangelist, Silanis
Previous Topic:Hierarchy error
Next Topic:sqljdbc_auth.dll already loaded in another classloader
Goto Forum:
  


Current Time: Fri Apr 19 10:32:40 GMT 2024

Powered by FUDForum. Page generated in 0.02196 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top