XML Data source - column mapping - xpath problem with attribute and position predicates [message #660426] |
Fri, 18 March 2011 11:43 |
Silvestr Peknik Messages: 4 Registered: March 2011 |
Junior Member |
|
|
Hello,
I have XML data source and i am creating data set. Part of the xml that i want to bind to columns causes troubles to me or to BIRT.
I have XML containing number of "customfield" elements like the one below. They are differentiated by "id" attribute. They can also contain number of values (customfieldvalue element) which have no id and differ just in position and text().
<customfields>
<customfield id="cf10062">
<customfieldname>Tester</customfieldname>
<customfieldvalues>
<customfieldvalue>sipe01</customfieldvalue>
<customfieldvalue>sipe02</customfieldvalue>
</customfieldvalues>
</customfield>
...
</customfields>
The problem i face is that BIRT has problem with XPATH query that contains both attribute predicate and position.
/customfields/customfield[1]/customfieldvalues/customfieldva lue[2]
==> returns "sipe02"
/customfields/customfield[@id="cf10062"]/customfieldvalues/customfieldvalue[2]
==> returns something strange (squares and empty characters? not sure)
Can anyone tell what is wrong?
Thanks a lot,
Silvestr
[Updated on: Fri, 18 March 2011 15:59] Report message to a moderator
|
|
|
Re: XML Data source - column mapping - xpath does not understand position / element predicate [message #660492 is a reply to message #660426] |
Fri, 18 March 2011 15:03 |
|
On problem one, currently the xml driver only supports attributes
filters. On problem two It looks like the cdata section is getting
treated like binary data. Any chance you can log a bug for this?
Jason
On 3/18/2011 7:43 AM, Silvestr Peknik wrote:
> I have XML data source and i am creating data set. Part of the xml that
> i want to bind to columns causes troubles to me or to BIRT.
>
> Problem 1:
>
> <customfields>
> <customfield id="cf10062">
> <customfieldname>Tester</customfieldname>
> <customfieldvalues>
> <customfieldvalue>sipe04</customfieldvalue>
> </customfieldvalues>
> </customfield>
> ... other elements
> </customfields>
>
> I wanted to bind a column to following xpath:
>
> /customfields/customfield[customfieldname="Tester"]/customfieldvalues/customfieldvalue
>
>
> This one does not work - nothing gets selected. Using @id works:
>
> /customfields/customfield[@id=cf10062"]/customfieldvalues/customfieldvalue
>
> returns "sipe04".
>
> Both are valid as far as i can see and should point to the "sipe04"
> value. Why doesnt the first one work?
>
> Problem 2:
>
> <customfields>
> <customfield id="cf10000">
> <customfieldname>Flagged</customfieldname>
> <customfieldvalues>
> <customfieldvalue><![CDATA[Impediment]]></customfieldvalue >
> <customfieldvalue><![CDATA[Test description
> insufficient]]></customfieldvalue>
> </customfieldvalues>
> </customfield>
> ...
> </customfields>
>
> I tried to bind "Test description insufficient" element to a column using:
>
> /customfields/customfield[@id="cf10000"]/customfieldvalues/customfieldvalue[2]
>
>
> but again, no luck. I am not sure what gets returned, in the "Data
> preview" window it shows like squares and empty spaces.
>
> Can anyone help?
|
|
|
|
|
Re: XML Data source - column mapping - xpath problem with attribute and position predicates [message #660839 is a reply to message #660547] |
Mon, 21 March 2011 21:50 |
|
This does look like a bug can you log it?
Jason
On 3/19/2011 3:04 AM, Silvestr Peknik wrote:
> Ok, update without CDATA:
>
> XML:
>
> <item>
> <customs>
> <custom id="2">
> <name>Rick</name>
> <values>
> <value>3</value>
> <value>4</value>
> </values>
> </custom>
> </customs>
> </item>
>
> /customs/custom[1]/values/value[1]
> returns "3"
>
> /customs/custom[@id="2"]/values/value[1]
> does not return anything
>
> /customs/custom[@id="2"]/values/value
> returns "3"
>
>
> Is this a bug or am i missing something?
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03264 seconds