![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extracting tag values from XML using perl | Steve_altius | Shell Programming and Scripting | 3 | 08-06-2008 06:23 AM |
| How to sort a field in a file having date values | risshanth | Shell Programming and Scripting | 4 | 06-04-2008 05:03 AM |
| read from a file and calculate values for a specified field | lucho_1 | Shell Programming and Scripting | 3 | 03-11-2008 07:24 PM |
| extracting a field from directory path ?????? | skyineyes | Shell Programming and Scripting | 15 | 07-10-2007 12:42 AM |
| Extracting values from files | Master Error | Shell Programming and Scripting | 4 | 08-15-2004 09:23 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Extracting Field values for XML file
i have an input file of XML type with data like
<nx-charging:additional-parameter name="NX_INTERNATIONALIZED_CLID" value="919427960829"/><nx-charging:finalStatus>RESPONSE , Not/Applicable , OK</nx-charging:finalStatus></nx-charging rocess>i want to extract data such that i get the output like: additional-parameter name=NX_INTERNATIONALIZED_CLID value=919427960829 finalStatus=RESPONSE Not/Applicable , OK i have done some coding for it #include <stdio.h> #include <string.h> int main() { char DataIn[] = "<nx-charging:additional-parameter name=\"NX_INTERNATIONALIZED_CLID\" value=\"919427960829\"/><nx-charging:finalStatus>RESPONSE , Not/Applicable , OK</nx-charging:finalStatus></nx-charging rocess>";char *str = DataIn; char *token; while ( (token = strtok ( str, ":<>/" )) ) { puts(token); str = 0; } return 0; } But my output comes as: /***OUTPUT***** nx-charging additional-parameter name="NX_INTERNATIONALIZED_CLID" value="919427960829" nx-charging finalStatus RESPONSE , Not Applicable , OK nx-charging finalStatus nx-charging process the fields highlighted are not required by me. Plus the fields finalStatus RESPONSE , Not Applicable , OK should come as finalStatus=RESPONSE Not/Applicable , OK please suggest me some changes. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|