You could get the data in the "Response" element by loading the entire
string into an XmlDocument object. But the data within is probably
intended to be displayed as such and does not have a defined
structure. You would either need to use string searching or a complex
Regex to separate discrete values from this data.

Another (not-too-clean) way that comes to mind is to Regex split the
string by matching the asterisk pattern. This should get the three
sections of data.(Office profile, Office identification and General
Data). Then split each section by the hyphen and put the odd entries
into keys and even entries into matching values of a Dictionary. Make
sure to trim each split entry.

Check the API docs... maybe they provide a more detailed method to get
individual values of the response.

On Dec 14, 5:43 pm, Anchit Kathuria <[email protected]> wrote:
> Hi,
> I have got the following XML test in a string variable:
>
> string str is assigned the following value :
> "<Cryptic_GetScreen_Reply><CAPI_Screen><Response>* * * * * * * * * * *
> *  PV OFFICE PROFILE  * * * * * * * * * *
> AMADEUS OFFICE ID          - YYZ6W210X      AMID - 288365
> NATIONAL SYSTEM OFFICE ID  - 1S/10019368
> DATE/TIME                  - 02NOV10/1239
>
> * * * * * * * * * * * *  OFFICE IDENTIFICATION  * * * * * * * *
> CIN*IATA NUMBER            - 67906602 - PRIMARY
> ERN*ERSP NUMBER            - 00000000
> CCO*CALL CENTER OFFICE     - NO
> * * * * * * * * * * * *  GENERAL DATA   * * * * * * * * * * * *
> NAM*OFFICE NAME      - CUMBERLAND TRAVEL
> AD1*ADDRESS 1        - 2200 MARKHAM ROAD, UNIT 1
> AD2*ADDRESS 2        - NONE
> AD3*CITY NAME        - SCARBOROUGH, ON M1B 2W4
> CRP*CORPORATE IMPLANT- NONE
> CTN*COUNTRY NAME     - CANADA
> PHO*PHONE PRIMARY    - 416 250-6200
> PH2*PHONE SECONDARY  - NONE
> FAX*FAX PRIMARY      - 416-250-6205
> FA2*FAX SECONDARY    - NONE
> EML*EMAIL ADDRESS    - NONE
> OOH*OPENING HOURS    - M 1): OPEN ALL DAY
> )&gt;</Response></CAPI_Screen></Cryptic_GetScreen_Reply>"
>
> Now, can you please tell me a way to get the values of various fields
> (in above text) from the string. I have already tried using "split"
> function and Regix function on this string but it was getting too
> complicated. May be there is a way to insert this into an XML Document
> object? I need to insert the VALUES from above string into a DB table
> (using ADO.NET). How can I get only the values from above string? (eg:
> YYZ6W210X, 288365, 1S/10019368 etc.)

Reply via email to