Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
16 years ago

Groovy XML Parsing Help

Hello,
I have a element that looks something like this



3085CBFTCBFT - Société Radio-CanadaCBFT02Analog

15756CBFT-HDCBFT-HD ( SOCIÉTÉ RADIO-CANADA )CBFT-HD30852.12.1Digital




I am trying to write some kind of loop that does the following.
1. count number of 'Channel'
2. for each Channel, store all of its attributes (e.g. source_id, short_name, etc) into some variable.

Can you help me out with this.

Thanks

Ali 

7 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    sure.. to give you the best suggestion could you let me know how you intend to use these created objects?

    regards!

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    I need to validate the response below(XML/RPC) by calling another soap based service. I also have to validate the response against a stored procedure call in the database.

    This is what I plan on doing ( I am open to other suggestions)

    1. for each channel in the response below, store all the channel attributes
    2. Call the Validation Web Service. Search the service response based on the sourceId
    3. Call the validation stored proc. search the result set for corresponding row based on sourceId.
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    could you maybe use the response as an XML DataSource and then inside the corresponding DataSource Loop make a request for the first validation and another DataSource for the second? ie something like

    - Request
    - DataSource [XML: Request/Response property with corresponding xpaths]
    - Second Request
    - DataSource for validation
    - DataSourceLoop back to DataSource

    ?

    regards!

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    I am guessing this is using XML Datasource. I am trying to use this but am unable to get it to work.
    I have the following config

    sourceStep: test request where one of the element has XML inside of it (lineup XML in original example)
    source property: response
    row Xpath: selected from response (//methodResponse[1]/params[1]/param[1]/value[1]/struct[1]/member[2]/value[1]/string[1])
    Column Xpath: source_ID/text()
    Property: source_ID

    When I click on the 'play' button, I dont get any rows of 'source_ID'

    Not sure what I am doing wrong.

    Ali
  • omatzura's avatar
    omatzura
    Super Contributor
    Great! Let me know if you need any more assistance!

    regards,

    /Ole
    eviware.com