Forum Discussion

BA_Service_Haus's avatar
BA_Service_Haus
Regular Contributor
11 years ago

Better Support of XML-Data-Sources

Hi,

when creating an XML-DataSource I sometimes met a problem regarding the parameter "Column XPaths".
Using the select-Button, I choose the xml-node to use for "Column XPaths". But I always get a message "Column xpath must start with RowPath expression".

This is not very helpfull.

I also wonder, why this field ("Column XPaths") is not editable like "Row XPath" is.
Especially when a namespace declaration is required, the field content gets confusing (hard to read).

I hope this can be improved in the future.
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi Rao,

    the wildcard (*) is matching all namespace prefixes, isn't it.
    So if using it, one cannot ensure, that the correct/required namespace prefix is used.
    e.g.
    *:name is matching ns2:name and ns3:name

    Maybe this could be ensured by checking the schema compliance of the corresponding soap response. But this is nothing but a workaround.

    Anyway, if there are two nodes of the same name, which can be distinguished only by their namespace, this workaround isn't helpfull anymore.
    The followong example shows, what I mean. There a two name-nodes. One contains the original spelling (inlcuding mutated vowels/umlauts), the other one
    <ns1:person>
    <ns2:name>Dömme</ns2:name>
    <ns3:name>Doemme</ns3:name>
    </ns1:person>

    To be true, this migth be a rare scenario. But you know Murphy's law, don't you?

    Best regards
  • nmrao's avatar
    nmrao
    Champion Level 3
    Agree. One could do that too by defining namespace in Row Xpath for the one to be used on column xpath as well.
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi Rao,

    sorry, this doesn't work.
    I need to declare the namespace of "firstName" in the ColumnXPaths-Field, like : declare namespace ns2='http://test.com/names'; ns2:firstName/text()
    Otherwise I only get emtpy rows (btw. the count is correct).

    Also I wonder what the "select" button at "Column XPaths" is for, when one cannot select the required xPath.

    Best regard
  • nmrao's avatar
    nmrao
    Champion Level 3
    Ok. Let me tell you how I did.

    In the row xpath, selected the column value I wanted so that its namespace also come inside Row xpath.
    In this instance select Row Xpath //ns:response[1]/ns1:person[1]/ns2:firstName[1] along with those three namespaces.
    Then add property in left hand side firstName
    Now you would see column xpath as firstName/text()
    then use edit button to change it to ns2:firstName/text() in the column Xpath and in edit Row xpath remove '[1]' i.e., //ns:response/ns1:person
    In fact I donot even face error.
    Then just click on run button, you would see the data.
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi Rao,

    this still does not work.
    I also don't get any error message as I don't use the "Select"-button on "Column XPaths" section.
    But when running the test, the data log still shows empty rows.

    Best regards
  • nmrao's avatar
    nmrao
    Champion Level 3
    Would you like to send the xml sample that you are trying, so that I will see if possible to clear you.
    Otherwise you may do the same with xml sample that I provided.
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi nmrao,

    there is a main difference between your example and mine.
    I want to use an node-element as "Row XPath" while you used an attribute.

    I try to explain it with a more realistic example. In the follwoing response I want to get all names (ueb:name) of all customers (kun:kunde).


    This leads to the error, I described before.

    Best regards
  • nmrao's avatar
    nmrao
    Champion Level 3
    Don't you see data in the data log in the screen shot I attached?